From b1fe38782abdc177c5983e9dee2a6ed166cfbbfc Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Sun, 19 Sep 2021 19:36:03 +0300 Subject: [PATCH] Now builds, added db to .gitignore --- .gitignore | 1 + dbHandle/handle.go | 24 ++++++++++++++++++------ go.sum | 2 ++ main.go | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 95c00ca..27d6ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ logs.log +database.db crud-api crud-api.exe \ No newline at end of file diff --git a/dbHandle/handle.go b/dbHandle/handle.go index 441b15f..ae9d41e 100644 --- a/dbHandle/handle.go +++ b/dbHandle/handle.go @@ -7,13 +7,21 @@ import ( _ "github.com/mattn/go-sqlite3" ) -func (db *DB) GetEverything() ([]*randomdata.RandomData, error) +func (db *DB) GetEverything() ([]*randomdata.RandomData, error) { + return nil, nil +} -func (db *DB) GetSpecific() (*randomdata.RandomData, error) +func (db *DB) GetSpecific() (*randomdata.RandomData, error) { + return nil, nil +} -func (db *DB) DeleteSpecific() error +func (db *DB) DeleteSpecific() error { + return nil +} -func (db *DB) PatchSpecific() error +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) @@ -24,6 +32,10 @@ func (db *DB) Create(rd randomdata.RandomData) error { return nil } -func (db *DB) HandleSpecificWeb(w http.ResponseWriter, r *http.Request) +func (db *DB) HandleSpecificWeb(w http.ResponseWriter, r *http.Request) { + +} -func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request) +func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request) { + +} diff --git a/go.sum b/go.sum index e69de29..0293daa 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU= +github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= diff --git a/main.go b/main.go index 36e7233..53e1cb2 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,7 @@ func main() { if err != nil { log.Fatalf("error setting up a database: %s", err) } + log.Println("Created db") mux := http.NewServeMux() mux.HandleFunc("/", helpPage)