all repos — flounder @ 1c780cf98187163d3149ff1a98f04c9657bd69e5

A small site builder for the Gemini protocol

fix get users
alex wennerberg alex@alexwennerberg.com
Sat, 24 Oct 2020 13:13:41 -0700
commit

1c780cf98187163d3149ff1a98f04c9657bd69e5

parent

48c4084ba652171948827c35a6803c8c54aa98da

1 files changed, 14 insertions(+), 1 deletions(-)

jump to
M main.gomain.go

@@ -24,7 +24,20 @@ UpdatedTime time.Time

} 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