SortField

Defines a field name and the order type used to sort query results.

Description

The SortField class allows you to define a field used to sort query results. In addition, it allows you to specify the order type as ascending or descending.

Constructors

NewSortField

Creates a new instance and assigns its values.

NewSortField(name string, ascending bool) SortField

  • name: string - the name of the field to sort by.
  • ascending: bool - true to sort in ascending order, and false to sort in descending order.

NewEmptySortField

Creates a new empty instance.

NewEmptySortField() SortField

Fields

Name

Field name to sort by

Name: string

Ascending

Flag to define sorting order. True to sort ascending, false to sort descending

Ascending: bool

Examples

filter := NewFilterParamsFromTuples("type", "Type1")
paging := NewPagingParams(0, 100)
sorting := NewSortingParams(NewSortField("create_time", true))

err, page = myDataClient.GetDataByFilter(context.Background(), filter, paging, sorting)

See also