Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestParamOptions ¶
type RequestParamOptions func(*RequestParams)
RequestParamOptions is a functional option that allows setting values to request parameters
func WithIncludeDeleted ¶
func WithIncludeDeleted(hasDeleted bool) RequestParamOptions
WithIncludeDeleted sets whether to include deleted records
func WithOffset ¶
func WithOffset(offset int) RequestParamOptions
WithOffset sets the offset of a pagination request
func WithOrderBy ¶
func WithOrderBy(orderBy OrderBy) RequestParamOptions
WithSortOrder sets how to sort records
func WithRequestLimit ¶
func WithRequestLimit(limit int) RequestParamOptions
WithRequestLimit sets the limit of a request
func WithSortOrder ¶
func WithSortOrder(sortOrder SortOrder) RequestParamOptions
WithSortOrder sets how to sort records
type RequestParams ¶
type RequestParams struct {
// IncludedDeleted includes "softly" deleted records in the result of the query
IncludeDeleted bool
// Limit is the page size
Limit int
// Offset is the page number or cursor
Offset int
// OrderOption contains ordering options for the filter
OrderOption RequestParamsOrderOption
}
RequestParams are parameters that can be passed when fetching records from a database
func NewRequestParams ¶
func NewRequestParams(opts ...RequestParamOptions) RequestParams
NewRequestParams creates a new request params object with reasonable defaults set
type RequestParamsOrderOption ¶
type RequestParamsOrderOption struct {
// OrderBy is the field to order records by
OrderBy OrderBy
// SortOrder is the order to sort the records by
SortOrder SortOrder
}
RequestParamsOrderOption contains filtering values to use for ordering
Click to show internal directories.
Click to hide internal directories.