aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-03 22:00:10 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-03 22:00:10 +0530
commit6fb69cc9c26c70ce54a1bf8ccf8ce8a7d2b957b8 (patch)
tree4f975a0bc4a5297eb859b37578b3cadab6317a92 /server
parent5846185f5a6662265c5330fbed229f49efb26b89 (diff)
the people api now also gives the ID of the client
Diffstat (limited to 'server')
-rw-r--r--server/database/people.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/database/people.go b/server/database/people.go
index 6083af4..01cbba8 100644
--- a/server/database/people.go
+++ b/server/database/people.go
@@ -13,8 +13,8 @@ package database
import (
_ "github.com/mattn/go-sqlite3"
)
-
type Person struct {
+ ID int
Name string
Phone string
Email string
@@ -23,16 +23,17 @@ type Person struct {
func GetAllPeople() []Person {
var allPeople []Person
rows, _ := myDatabase.Query(
- `SELECT Name, Phone, Email FROM People`,
+ `SELECT id, Name, Phone, Email FROM People`,
)
var (
name, phone, email string
+ id int
)
for rows.Next() {
- rows.Scan(&name, &phone, &email)
- allPeople = append(allPeople, Person{name, phone, email})
+ rows.Scan(&id, &name, &phone, &email)
+ allPeople = append(allPeople, Person{id, name, phone, email})
}
return allPeople