about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-02-16 23:47:09 +0100
committerEmile <hanemile@protonmail.com>2019-02-16 23:47:09 +0100
commit5209d81a012a34ed3129181ecb877feda11cf379 (patch)
tree6f00f23cd6840c4887cada5dbd7383bf9d15191a
parent14a7ec37898c56c2aeb0b099cadd6e0b04dd1b97 (diff)
The insert star function now returns the starID of the inserted star
-rw-r--r--db_actions.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/db_actions.go b/db_actions.go
index 59cadef..985ba6e 100644
--- a/db_actions.go
+++ b/db_actions.go
@@ -87,7 +87,7 @@ func NewTree(database *sql.DB, width float64) {
 }
 
 // insertStar inserts the given star into the stars table and the nodes table tree
-func InsertStar(database *sql.DB, star structs.Star2D, index int64) {
+func InsertStar(database *sql.DB, star structs.Star2D, index int64) int64 {
 	db = database
 	start := time.Now()
 
@@ -117,6 +117,7 @@ func InsertStar(database *sql.DB, star structs.Star2D, index int64) {
 	insertIntoTree(starID, id)
 	elapsedTime := time.Since(start)
 	log.Printf("\t\t\t\t\t %s", elapsedTime)
+	return starID
 }
 
 // insertIntoStars inserts the given star into the stars table