Documentation
¶
Overview ¶
Package sorts contains query field sorting structures.
Index ¶
- Variables
- type Order
- type SortField
- func Copy(s *SortField) *SortField
- func New(m *models.ModelStruct, sort string, disallowFK bool, order ...Order) (*SortField, error)
- func NewSortField(sField *models.StructField, o Order, subs ...*SortField) *SortField
- func NewUniques(m *models.ModelStruct, disallowFK bool, sorts ...string) ([]*SortField, error)
Constants ¶
This section is empty.
Variables ¶
var MaxNestedRelLevel = 1
MaxNestedRelLevel is a temporary maximum nested check while creating sort fields TODO: change the variable into config settable.
Functions ¶
This section is empty.
Types ¶
type SortField ¶
type SortField struct {
// contains filtered or unexported fields
}
SortField is a field that describes the sorting rules for given query.
func New ¶ added in v0.5.1
New creates new SortField based on the provided model 'm', string 'sort', flag 'disallowFK' - which doesn't allow to create foreign keys, and optional order.
func NewSortField ¶
func NewSortField(sField *models.StructField, o Order, subs ...*SortField) *SortField
NewSortField creates new SortField with given models.StructField 'sField', order 'o' and sub sort fields: 'subs'.
func NewUniques ¶ added in v0.5.1
NewUniques creates new unique sort fiellds for provided model 'm'.
func (*SortField) SetSubfield ¶ added in v0.2.1
func (s *SortField) SetSubfield(sortSplitted []string, order Order, disallowFK bool) errors.DetailedError
SetSubfield sets the subfield for given sortfield.
func (*SortField) StructField ¶
func (s *SortField) StructField() *models.StructField
StructField returns sortField's model.StructField.