Documentation
¶
Index ¶
Constants ¶
View Source
const ( Forward direction = iota Backward )
page cursor direction values
View Source
const ( Asc sortOrder Desc )
page cursor sort order values
View Source
const ( // Spanner builder type Spanner sqlBuilderKind = iota + 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder interface { WithSQL(sql string) Builder WithAlias(alias string) Builder WithParams(params BuilderParams) Builder ToSQL() (string, BuilderParams, error) }
Builder ...
type Cursor ¶
type Cursor interface { // CursorID is base64 encoded string containing field name and value to be used as a cursor CursorID() string // Limit result length with this number Limit() uint32 // Direction of the search, can be either Forward or Backward Direction() direction // IsForward is true if the direction is Forward IsForward() bool // IsBackward is true if the direction is Backward IsBackward() bool // IsAsc is true if the sort order is ascending IsAsc() bool // IsPointer is true if cursor mode is Pointer IsPointer() bool // IsOffset is true if cursor mode is Offset IsOffset() bool // IsSlice is true if cursor mode is Slice IsSlice() bool // IsDesc is true if the sort order is descending IsDesc() bool // Field name in the model to be used as a cursor Field() string // Kind is a data type of cursor field Kind() valueType // Value of cursor field which will be used for search Value() any // Offset only valid for cursors with Offset mode Offset() uint64 // CreateID generates new base64 cursor id // - for cursor mode Pointer - it will point to the passed object // - for cursor mode Offset - it will set cursor offset to passed index // // Deprecated: it should not be used as it creates confusion on what type of parameter // has to be passed. In general, if you need universal way // to generate cursor ids - GetEdges use function instead. CreateID(param any) string // PointerID generates new base64 cursor id for pointer mode PointerID(obj any) string // OffsetID generates new base64 cursor id for offset mode OffsetID(index uint64) string // WithLimit sets result length limit WithLimit(limit uint32) Cursor // WithDirection sets search direction WithDirection(dir direction) Cursor // WithCursorID applies new cursor id to be used in a search WithCursorID(cursorID string) Cursor // WithSliceID changes mode to offset and applies passed id WithSliceID(cursorID string) Cursor // WithField sets cursor field explicitly WithField(field string) Cursor // WithSort sets cursor sorting order explicitly WithSort(sort sortOrder) Cursor // WithOffset applies offset to cursor WithOffset(offset uint64) Cursor // ToOffset force swap cursor mode and use value as offset ToOffset() Cursor // Builder helper method which returns sql builder with this cursor Builder(kind sqlBuilderKind) Builder }
Cursor descriptor providing information about cursor and method to modify it
func FromParams ¶
FromParams creates new page cursor from Params object
type Edge ¶
type Edge[R any] struct { // contains filtered or unexported fields }
Edge is a cursor item container with id and node object
type Page ¶
type Page interface { // FirstID is id of first item on a page FirstID() string // LastID is id of last item on a page LastID() string // HasPrev indicates that there's items on a previous page HasPrev() bool // HasNext indicates that there's items on a next page HasNext() bool // Length returns length of result set Length() uint32 // WithHasPrev sets HasPrev flag WithHasPrev(bool) Page // WithHasNext sets HasNext flag WithHasNext(bool) Page // WithFirstID sets first id WithFirstID(string) Page // WithLastID sets last id WithLastID(string) Page // WithLength sets length WithLength(uint32) Page }
Page provides information about result page
Click to show internal directories.
Click to hide internal directories.