pagination

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Empty

func Empty() *empty

Empty returns a pagination instance that will force a query an empty page

func EmptyFromRaw added in v0.6.0

func EmptyFromRaw(raw []byte) (*empty, error)

func Keyset added in v0.6.0

func Keyset[I comparable, V any](offset int, pageSize int, sqlIdName common.FieldName, idGetter func(V) I) (*keyset[I, V], error)

Keyset creates a keyset pagination

func KeysetFromRaw added in v0.6.0

func KeysetFromRaw[I comparable](raw []byte, idFieldName PropertyName[I]) (*keyset[I, any], error)

KeysetFromRaw initializes a Keyset pagination struct from a buffer. It also needs to get the field name of the id in the struct returned by the database. This is used in a member function and is not serializable.

func KeysetWithField added in v0.6.0

func KeysetWithField[I comparable](offset int, pageSize int, sqlIdName common.FieldName, idFieldName PropertyName[I]) (*keyset[I, any], error)

KeysetWithField creates a keyset pagination where the id has field name idFieldName

func KeysetWithId added in v0.6.0

func KeysetWithId[I comparable, V id[I]](offset int, pageSize int, sqlIdName common.FieldName) (*keyset[I, V], error)

KeysetWithId creates a keyset pagination where the result object implements id[I]

func NewDefaultInterpreter

func NewDefaultInterpreter() *interpreter

func NewPage added in v0.6.0

func NewPage[V any](results collections.Iterator[*V], pagination driver.Pagination) (*driver.PageIterator[*V], error)

NewPage creates a new page where the id is a string

func None

func None() *none

None returns a pagination instance that will force a query to return everything in one shot

func NoneFromRaw added in v0.6.0

func NoneFromRaw(raw []byte) (*none, error)

func Offset

func Offset(os int, pageSize int) (*offset, error)

Offset creates a pagination using OFFSET

func OffsetFromRaw added in v0.6.0

func OffsetFromRaw(raw []byte) (*offset, error)

Types

type PropertyName added in v0.6.0

type PropertyName[V comparable] string

PropertyName is the name of the field in the struct that is returned from the database V is the type of the field

func (PropertyName[V]) ExtractField added in v0.6.0

func (p PropertyName[V]) ExtractField(v any) V

ExtractField extracts the field from the given value

Jump to

Keyboard shortcuts

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