go-common/app/admin/main/videoup/dao/manager/auth_role.go
2019-04-22 18:49:16 +08:00

23 lines
455 B
Go

package manager
import (
"context"
"database/sql"
"go-common/library/log"
)
const (
_getUserRoleSQL = "SELECT `role` FROM `auth_role` WHERE uid = ?"
)
// GetUserRole 用户角色
func (d *Dao) GetUserRole(c context.Context, uid int64) (role int8, err error) {
err = d.managerDB.QueryRow(c, _getUserRoleSQL, uid).Scan(&role)
if err != nil && err != sql.ErrNoRows {
log.Error("d.managerDB.Query error(%v)", err)
return
}
return role, nil
}