package db import ( "xorm.io/xorm" "applet/app/db/model" "applet/app/utils/logx" ) func DbsUser(eg *xorm.Engine, uid int) (*[]model.UserRelate, error) { var userRelate []model.UserRelate if err := eg.Where("uid = ?", uid).Asc("level").Find(&userRelate); err != nil { return nil, logx.Error(err) } if len(userRelate) == 0 { return nil, nil } return &userRelate, nil } func DbsUserFindByIds(eg *xorm.Engine, uid []int) (*[]model.User, error) { var users []model.User if err := eg.In("uid", uid).Asc("level").Find(&users); err != nil { return nil, logx.Error(err) } if len(users) == 0 { return nil, nil } return &users, nil } func DbsUserRelate(eg *xorm.Engine, uid int) (*[]model.UserRelate, error) { var userRelate []model.UserRelate if err := eg.Where("uid = ?", uid).Asc("level").Find(&userRelate); err != nil { return nil, logx.Error(err) } if len(userRelate) == 0 { return nil, nil } return &userRelate, nil }