sorts

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sorts contains query sort order structures.

Index

Constants

This section is empty.

Variables

View Source
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 Order

type Order int

Order is an enumerator that describes the order of sorting.

const (
	// AscendingOrder is the enum defines ascending sorting order.
	AscendingOrder Order = iota

	// DescendingOrder is the enum that defines descending sorting order.
	DescendingOrder
)

func (Order) String

func (o Order) String() string

String implements Stringer interface.

type SortField

type SortField struct {
	// contains filtered or unexported fields
}

SortField is a field that describes the sorting rules for given query.

func Copy

func Copy(s *SortField) *SortField

Copy copies provided SortField.

func NewRawSortField

func NewRawSortField(m *models.ModelStruct, sort string, disallowFK bool) (*SortField, error)

NewRawSortField creates and returns new sort field for given model 'm', with sort field value 'sort' and a flag if foreign key should be disallowed - 'disallowFK'

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 (*SortField) Order

func (s *SortField) Order() Order

Order gets the sort field's order.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL