Documentation
¶
Index ¶
- type Cursor
- type CursorPagination
- type CursorPaginationInput
- type Dialect
- type Direction
- type Driver
- type Filter
- type FilterColumn
- type FilterColumnWhere
- type FilterMap
- type FilterMapColumn
- type OffsetPagination
- type Operator
- type PaginationResponse
- type Param
- type Query
- type QueryMod
- type Relation
- type Search
- type Sort
- type SortColumn
- type SortColumnSlice
- type TableColumns
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func (*Cursor) IsBackward ¶
type CursorPagination ¶
type CursorPagination struct {
// contains filtered or unexported fields
}
func ParseCursorPagination ¶
func ParseCursorPagination(raw string, sort *Sort, maxLimit int, hasAutoIncrementID bool) *CursorPagination
func (*CursorPagination) Apply ¶
func (p *CursorPagination) Apply(q *Query)
func (*CursorPagination) Limit ¶
func (p *CursorPagination) Limit() int
func (*CursorPagination) Mods ¶
func (p *CursorPagination) Mods(tn string) []qm.QueryMod
DESC = high to low | latests to oldest | new to old ASC = low to high | oldest to latests | old to new
func (*CursorPagination) SQL ¶
func (p *CursorPagination) SQL() string
type CursorPaginationInput ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func ParseFilter ¶
func ParseFilter(raw string, allowedColumns TableColumns) *Filter
type FilterColumn ¶
type FilterColumn struct {
Column string
Where []*FilterColumnWhere
Or *FilterColumn
}
type FilterColumnWhere ¶
type FilterMap ¶
type FilterMap map[string]json.RawMessage
{"name": {"eq": "test", "or": "test3"}, "age": {"gte": 34, "lte": 65}, "status": {"in": ["active", "paused"]}, "or": {"name":{"eq": "test2"}}}
type FilterMapColumn ¶
type FilterMapColumn map[Operator]json.RawMessage
type OffsetPagination ¶
func ParseOffsetPagination ¶
func ParseOffsetPagination(raw string, maxLimit int) *OffsetPagination
func (*OffsetPagination) Apply ¶
func (p *OffsetPagination) Apply(q *Query)
func (*OffsetPagination) Mods ¶
func (p *OffsetPagination) Mods() []qm.QueryMod
func (*OffsetPagination) SQL ¶
func (p *OffsetPagination) SQL() string
type PaginationResponse ¶
type PaginationResponse struct {
HasNextPage bool `json:"has_next_page"`
NextPageCursor string `json:"next_page_cursor,omitempty"`
HasPrevPage bool `json:"has_prev_page"`
PrevPageCursor string `json:"prev_page_cursor,omitempty"`
}
func PaginateCursorPagination ¶
func PaginateCursorPagination[T any](p *CursorPagination, data []*T) ([]*T, *PaginationResponse)
func PaginateOffsetPagination ¶
func PaginateOffsetPagination[T any](p *OffsetPagination, d []T) ([]T, *PaginationResponse)
type Param ¶
type Param struct {
Value any
// contains filtered or unexported fields
}
func ParseParam ¶
type Query ¶
type Query struct {
Filter *Filter
Sort *Sort
OffsetPagination *OffsetPagination
CursorPagination *CursorPagination
Relation *Relation
Param *Param
Search *Search
// contains filtered or unexported fields
}
type Sort ¶
type Sort struct {
// contains filtered or unexported fields
}
func ParseSort ¶
func ParseSort(raw string, allowedColumns TableColumns) *Sort
func (*Sort) SetDefault ¶
func (s *Sort) SetDefault(f func(o sql.Order) []SortColumn)
type SortColumn ¶
type SortColumnSlice ¶
type SortColumnSlice []SortColumn
type TableColumns ¶
func (TableColumns) Has ¶
func (c TableColumns) Has(column string) bool
Click to show internal directories.
Click to hide internal directories.