diff options
author | Emile <hanemile@protonmail.com> | 2019-03-07 16:14:12 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-03-07 16:14:12 +0100 |
commit | c8ca77ad65e9c0b31c6bd5289de0c1d332c06e63 (patch) | |
tree | ead406696f0c02a6b51e49a7dbcbbd1afce848c4 /backend/contains.go | |
parent | 4d7880421ddc732d2f9fd3a2eaf1ca2c22a485c6 (diff) |
subdivided the project into multiple logical compartments
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 +} |