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.
30 lines
672 B
30 lines
672 B
3 years ago
|
package dbhandle
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
randomdata "github.com/Unbewohnte/crud-api/randomData"
|
||
|
_ "github.com/mattn/go-sqlite3"
|
||
|
)
|
||
|
|
||
|
func (db *DB) GetEverything() ([]*randomdata.RandomData, error)
|
||
|
|
||
|
func (db *DB) GetSpecific() (*randomdata.RandomData, error)
|
||
|
|
||
|
func (db *DB) DeleteSpecific() error
|
||
|
|
||
|
func (db *DB) PatchSpecific() error
|
||
|
|
||
|
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)
|