diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-02 14:15:25 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-02 14:15:25 -0500 |
commit | e365e8c2fd4e3a595c696849734236008fc67e1f (patch) | |
tree | 072316b0ff99dd94d698090b6ad3b02ab7852d95 /db/user.go | |
parent | 9fe48ae66c2cc8d6b46e44ae35e9447ab51d9dd6 (diff) |
implement basic user operations
Diffstat (limited to 'db/user.go')
-rw-r--r-- | db/user.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9,7 +9,7 @@ import ( func getNextUserId(db *sql.DB) (int, error) { - row := db.QueryRow("select max(userid) from users;") + row := db.QueryRow("select coalesce(max(userid), 0) from users;") if row.Err() != nil { return -1, row.Err() } @@ -19,7 +19,7 @@ func getNextUserId(db *sql.DB) (int, error) { if err != nil { return -1, err } - return id, nil + return id+1, nil } |