// List returns list of all users retrievable for the current user, depending on role
List returns list of all users retrievable for the current user, depending on role
// List returns list of all users retrievable for the current user depending on role
func (u *User) List(db orm.DB, qp *gorsk.ListQuery, p *gorsk.Pagination) ([]gorsk.User, error) {
	var users []gorsk.User
	q := db.Model(&users).Column("user.*", "Role").Limit(p.Limit).Offset(p.Offset).Where("deleted_at is null").Order("user.id desc")
	if qp != nil {
		q.Where(qp.Query, qp.ID)
	}
	if err := q.Select(); err != nil {
		return nil, err
	}
	return users, nil
}
func ( u * User ) List ( db orm . DB , qp * gorsk . ListQuery , p * gorsk . Pagination ) ( [ ] gorsk . User , error ) { var users [ ] gorsk . User q := db . Model ( & users ) . Column ( " " , " " ) . Limit ( p . Limit ) . Offset ( p . Offset ) . Where ( " " ) . Order ( " " ) if qp != nil { q . Where ( qp . Query , qp . ID ) } if err := q . Select ( ) ; err != nil { return nil , err } return users , nil }
List returns list of all users retrievable for the current user, depending on role
List returns list of all users retrievable for the current user depending on role