Add Getuserid

This commit is contained in:
scs 2019-01-11 21:39:47 +00:00
parent 9093104c28
commit 4767b8556a
1 changed files with 11 additions and 0 deletions

11
main.go
View File

@ -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)