flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 1c780cf98187163d3149ff1a98f04c9657bd69e5
parent 48c4084ba652171948827c35a6803c8c54aa98da
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 24 Oct 2020 13:13:41 -0700

fix get users

Diffstat:
Mmain.go | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/main.go b/main.go @@ -24,7 +24,20 @@ type File struct { } func getUsers() ([]string, error) { - return []string{"me", "other guy"}, nil + rows, err := DB.Query(`SELECT username from user`) + if err != nil { + return nil, err + } + var users []string + for rows.Next() { + var user string + err = rows.Scan(&user) + if err != nil { + return nil, err + } + users = append(users, user) + } + return users, nil } /// Perform some checks to make sure the file is OK