From 671c3a765ffc53575f517cef715dc16be5aa43c5 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Fri, 11 Jun 2021 17:17:26 +0530 Subject: cleaned up some code and fixed formatter for the client name/address --- server/database/people.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'server/database/people.go') diff --git a/server/database/people.go b/server/database/people.go index 01cbba8..e0930b0 100644 --- a/server/database/people.go +++ b/server/database/people.go @@ -14,10 +14,10 @@ import ( _ "github.com/mattn/go-sqlite3" ) type Person struct { - ID int - Name string - Phone string - Email string + Name string + Address string + Phone string + Email string } func GetAllPeople() []Person { @@ -27,13 +27,12 @@ func GetAllPeople() []Person { ) var ( - name, phone, email string - id int + name, address, phone, email string ) for rows.Next() { - rows.Scan(&id, &name, &phone, &email) - allPeople = append(allPeople, Person{id, name, phone, email}) + rows.Scan(&name, &address, &phone, &email) + allPeople = append(allPeople, Person{name, address, phone, email}) } return allPeople @@ -43,12 +42,12 @@ func RegisterPerson(person Person) bool { register_person, _ := myDatabase.Prepare( `INSERT INTO People - (Name, Phone, Email) + (Name, Address, Phone, Email) VALUES (?, ?, ?)`, ) register_person.Exec( - person.Name, person.Phone, person.Email, + person.Name, person.Address, person.Phone, person.Email, ) return true -- cgit v1.2.3