Documentation
¶
Index ¶
- type Cursor
- type CursorKey
- func (ck CursorKey) Bytes() []byte
- func (ck CursorKey) FieldValue() any
- func (ck CursorKey) MarshalBinary() ([]byte, error)
- func (ck CursorKey) MarshalJSON() ([]byte, error)
- func (ck CursorKey) MarshalText() ([]byte, error)
- func (ck CursorKey) String() string
- func (ck *CursorKey) UnmarshalBinary(data []byte) error
- func (ck *CursorKey) UnmarshalJSON(data []byte) error
- func (ck *CursorKey) UnmarshalText(data []byte) error
- type OrderBy
- type OrderDirection
- type OrderField
- type Page
- type PageInfo
- type Paginable
- type Position
- type StringCursorKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor[T OrderField] struct { Size int Position Position Key *CursorKey OrderBy OrderBy[T] }
func NewCursor ¶
func NewCursor[T OrderField](size int, from *CursorKey, pos Position, orderBy OrderBy[T]) *Cursor[T]
func (*Cursor[T]) SQLArguments ¶
func (c *Cursor[T]) SQLArguments() pgx.NamedArgs
func (*Cursor[T]) SQLFragment ¶
type CursorKey ¶
func ParseCursorKey ¶
func (CursorKey) FieldValue ¶ added in v0.2.0
func (CursorKey) MarshalBinary ¶
func (CursorKey) MarshalJSON ¶ added in v0.2.0
func (CursorKey) MarshalText ¶
func (*CursorKey) UnmarshalBinary ¶
func (*CursorKey) UnmarshalJSON ¶ added in v0.2.0
func (*CursorKey) UnmarshalText ¶
type OrderBy ¶ added in v0.2.0
type OrderBy[T OrderField] struct { Field T Direction OrderDirection }
type OrderDirection ¶ added in v0.2.0
type OrderDirection string
const ( OrderDirectionAsc OrderDirection = "ASC" OrderDirectionDesc OrderDirection = "DESC" )
func (OrderDirection) MarshalText ¶ added in v0.2.0
func (od OrderDirection) MarshalText() ([]byte, error)
func (OrderDirection) String ¶ added in v0.2.0
func (od OrderDirection) String() string
func (*OrderDirection) UnmarshalText ¶ added in v0.2.0
func (od *OrderDirection) UnmarshalText(data []byte) error
type OrderField ¶ added in v0.2.0
type Page ¶
type Page[T Paginable[U], U OrderField] struct { Info *PageInfo Cursor *Cursor[U] Data []T }
func NewPage ¶
func NewPage[T Paginable[U], U OrderField](data []T, c *Cursor[U]) *Page[T, U]
type Paginable ¶
type Paginable[T OrderField] interface { CursorKey(orderBy T) CursorKey }
type Position ¶
type Position string
const ( DefaultCursorSize = 25 Tail Position = "TAIL" Head Position = "HEAD" )
type StringCursorKey ¶ added in v0.4.0
StringCursorKey is a cursor key for string IDs
Click to show internal directories.
Click to hide internal directories.