From 4767b8556accc83e9f1c0bfd24c96cbc549dc9b6 Mon Sep 17 00:00:00 2001 From: scs Date: Fri, 11 Jan 2019 21:39:47 +0000 Subject: [PATCH] Add Getuserid --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.go b/main.go index 8526068..2499fa8 100644 --- a/main.go +++ b/main.go @@ -140,6 +140,17 @@ func ChangePassword(username, oldpass, newpass string) bool { return true } + +func GetUserid(username string) int64 { + var i int64 + q:=fmt.Sprintf("select userid from %s_auth where username=$1", c.TablePrefix) + err:=c.db.Get(&i, q, username) + if err != nil { + log.Printf("scsusers.getUserId: Error loading user: %s : %s\n", username, err.Error()) + return 0 + } + return i +} func LoadUser(username string) (UserData, error) { var u UserData q:=fmt.Sprintf("select data from %s_userdata where username=$1", c.TablePrefix)