diff options
Diffstat (limited to 'backend/contains.go')
-rw-r--r-- | backend/contains.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/backend/contains.go b/backend/contains.go new file mode 100644 index 0000000..a4fb83d --- /dev/null +++ b/backend/contains.go @@ -0,0 +1,23 @@ +package backend + +import ( + "fmt" + "log" +) + +// containsStar returns true if the node with the given id contains a star and returns false if not. +func containsStar(id int64) bool { + var starID int64 + + query := fmt.Sprintf("SELECT star_id FROM nodes WHERE node_id=%d", id) + err := db.QueryRow(query).Scan(&starID) + if err != nil { + log.Fatalf("[ E ] containsStar query: %v\n\t\t\t query: %s\n", err, query) + } + + if starID != 0 { + return true + } + + return false +} |