From 0ccd866b3a57349e6542bf353356a2fd71cdff3a Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Wed, 22 Sep 2021 22:38:55 +0300 Subject: [PATCH] Removed unecessary function --- dbHandle/handle.go | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/dbHandle/handle.go b/dbHandle/handle.go index 563a1a3..5e549a8 100644 --- a/dbHandle/handle.go +++ b/dbHandle/handle.go @@ -14,33 +14,6 @@ import ( _ "github.com/mattn/go-sqlite3" ) -// Check if a row with given id exists -func (db *DB) Exists(id uint) (bool, error) { - row, err := db.Query(fmt.Sprintf("SELECT * FROM %s WHERE id=%d", tableName, id)) - if err != nil { - return false, err - } - - // there should be only one row, because we search with id - for row.Next() { - var realID uint - var title string - var text string - var dateCreated int64 - var lastUpdated int64 - - row.Scan(&realID, &title, &text, &dateCreated, &lastUpdated) - - fmt.Printf("real %d --- given %d\n", realID, id) - - if realID == id { - return true, nil - } - } - - return false, nil -} - // Collect and return all rows in db func (db *DB) GetEverything() ([]*randomdata.RandomData, error) { rows, err := db.Query(fmt.Sprintf("SELECT * FROM %s", tableName))