Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultPageSize = 20 MaxPageSize = 100 )
Variables ¶
This section is empty.
Functions ¶
func BuildPaginatedQuery ¶
func BuildPaginatedQuery(opts *BuildPaginatedQueryOptions) error
BuildPaginatedQuery builds a query with cursor-based pagination
func EncodeCursor ¶
func EncodeCursor(pk PrimaryKey) (string, error)
EncodeCursor creates an encoded cursor from a model's primary key values
Types ¶
type BaseModel ¶
type BaseModel interface { GetTableName() string GetTableAlias() string GetPrimaryKey() PrimaryKey GetID() string }
BaseModel defines required methods for models using cursor pagination
type BuildPaginatedQueryOptions ¶
type BuildPaginatedQueryOptions struct { Query *bun.SelectQuery PaginationOpts Query Model BaseModel }
BuildPaginatedQueryOptions contains options for building paginated queries
type Cursor ¶
Cursor represents a position in the dataset using composite keys
func DecodeCursor ¶
DecodeCursor decodes a cursor string into cursor values
type Cursors ¶
type Cursors struct { Next *string `json:"next,omitempty"` // Cursor for next page Previous *string `json:"previous,omitempty"` // Cursor for previous page }
Cursors contains pagination cursors for navigation
type Meta ¶
type Meta struct { TotalCount int `json:"totalCount"` // Total number of records HasMore bool `json:"hasMore"` // Whether there are more records }
Meta contains metadata about the pagination state
type PrimaryKey ¶
type PrimaryKey struct { Fields []string // Field names in the composite key Values []any // Values for each field Composite bool // Whether this is a composite key }
PrimaryKey defines the structure of a composite primary key
type Query ¶
type Query struct { Cursor *string `json:"cursor"` // Encoded cursor for the current position PageSize int `json:"pageSize"` // Number of items per page }
Query represents pagination parameters
Click to show internal directories.
Click to hide internal directories.