Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OpaqueCursor ¶
OpaqueCursor is a struct that contains the filters and sorters for a query. Generally used in GraphQL based APIs to pass the cursor as a string. But the scenarios are not limited to GraphQL only, you could use it in any API that requires a cursor.
func Unmarshal ¶
func Unmarshal[Filters any, Sorters any](cursor string) (*OpaqueCursor[Filters, Sorters], error)
Unmarshal decodes the cursor string and returns the OpaqueCursor struct.
func UnmarshalWithDefaults ¶
func UnmarshalWithDefaults[Filters any, Sorters any](cursor string, defaults OpaqueCursor[Filters, Sorters]) (*OpaqueCursor[Filters, Sorters], error)
UnmarshalWithDefaults decodes the cursor string and returns the OpaqueCursor struct with defaults additionally.
func (OpaqueCursor[F, S]) IsValid ¶
func (oc OpaqueCursor[F, S]) IsValid() bool
IsValid checks if the cursor is valid or not. It checks if the sorters are valid or not.
NOTICE: currently the sorters are checked for ASC and DESC only.
Click to show internal directories.
Click to hide internal directories.