about summary refs log tree commit diff
path: root/backend/contains.go
blob: a4fb83d94e3cde10b8f7a9edc85ed5c72f3fe670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
}