An example of a CRUD api in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
756 B

package dbhandle
import (
"net/http"
randomdata "github.com/Unbewohnte/crud-api/randomData"
_ "github.com/mattn/go-sqlite3"
)
func (db *DB) GetEverything() ([]*randomdata.RandomData, error) {
return nil, nil
}
func (db *DB) GetSpecific() (*randomdata.RandomData, error) {
return nil, nil
}
func (db *DB) DeleteSpecific() error {
return nil
}
func (db *DB) PatchSpecific() error {
return nil
}
func (db *DB) Create(rd randomdata.RandomData) error {
_, err := db.Exec("INSERT INTO randomdata (title, text) VALUES (?, ?)", rd.Title, rd.Text)
if err != nil {
return err
}
return nil
}
func (db *DB) HandleSpecificWeb(w http.ResponseWriter, r *http.Request) {
}
func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request) {
}