package organize import ( "context" "git.nobla.cn/golang/moto/common/db" "git.nobla.cn/golang/moto/internal/organize/types" ) func Profile(ctx context.Context, uid string) (profile *types.Profile, err error) { profile = &types.Profile{} tx := db.WithContext(ctx) err = tx.Table("users AS u"). Select("u.uid as id", "u.username", "u.avatar", "u.email", "u.description", "u.role", "r.permissions"). Joins("left join roles AS r on r.id = u.role").Where("u.uid=? ", uid). First(profile).Error return }