manager.go 530 B

12345678910111213141516171819202122232425
  1. package manager
  2. import (
  3. "context"
  4. "go-common/app/admin/main/videoup/model/manager"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _userInfoSQL = "SELECT id,username,nickname,state FROM user WHERE id = ?"
  9. )
  10. // User get manager user by id
  11. func (d *Dao) User(c context.Context, id int64) (u *manager.User, err error) {
  12. var (
  13. row = d.managerDB.QueryRow(c, _userInfoSQL, id)
  14. )
  15. u = &manager.User{}
  16. if err = row.Scan(&u.ID, &u.UserName, &u.NickName, &u.State); err != nil {
  17. log.Error("row.Scan error(%v)", err)
  18. return
  19. }
  20. return
  21. }