Documentation
¶
Index ¶
- func GetNodeProcessor[T any](ctx context.Context) func(ctx context.Context, node T) (T, error)
- func WithNodeProcessor[T any](ctx context.Context, processor func(ctx context.Context, node T) (T, error)) context.Context
- func WithSkip(ctx context.Context, skip Skip) context.Context
- type ApplyCursorsFunc
- type ApplyCursorsRequest
- type ApplyCursorsResponse
- type Connection
- type CursorMiddleware
- type Edge
- type LazyEdge
- type OrderBy
- type PageInfo
- type PaginateRequest
- type Pagination
- type PaginationFunc
- type PaginationMiddleware
- type Skip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNodeProcessor ¶ added in v0.3.0
func WithNodeProcessor ¶ added in v0.3.0
Types ¶
type ApplyCursorsFunc ¶
type ApplyCursorsFunc[T any] func(ctx context.Context, req *ApplyCursorsRequest) (*ApplyCursorsResponse[T], error)
https://relay.dev/graphql/connections.htm#ApplyCursorsToEdges()
type ApplyCursorsRequest ¶
type ApplyCursorsResponse ¶
type Connection ¶ added in v0.3.0
type CursorMiddleware ¶
type CursorMiddleware[T any] func(next ApplyCursorsFunc[T]) ApplyCursorsFunc[T]
CursorMiddleware is a wrapper for ApplyCursorsFunc (middleware pattern)
func CursorMiddlewaresFromContext ¶
func CursorMiddlewaresFromContext[T any](ctx context.Context) []CursorMiddleware[T]
type OrderBy ¶
func AppendPrimaryOrderBy ¶
type PaginateRequest ¶
type Pagination ¶
type Pagination[T any] interface { Paginate(ctx context.Context, req *PaginateRequest[T]) (*Connection[T], error) }
func New ¶
func New[T any](applyCursorsFunc ApplyCursorsFunc[T], middlewares ...PaginationMiddleware[T]) Pagination[T]
type PaginationFunc ¶
type PaginationFunc[T any] func(ctx context.Context, req *PaginateRequest[T]) (*Connection[T], error)
func (PaginationFunc[T]) Paginate ¶
func (f PaginationFunc[T]) Paginate(ctx context.Context, req *PaginateRequest[T]) (*Connection[T], error)
type PaginationMiddleware ¶
type PaginationMiddleware[T any] func(next Pagination[T]) Pagination[T]
PaginationMiddleware is a wrapper for Pagination (middleware pattern)
func AppendCursorMiddleware ¶
func AppendCursorMiddleware[T any](cursorMiddlewares ...CursorMiddleware[T]) PaginationMiddleware[T]
func EnsureLimits ¶ added in v0.2.0
func EnsureLimits[T any](defaultLimit, maxLimit int) PaginationMiddleware[T]
EnsureLimits ensures that the limit is within the range 0 -> maxLimit and uses defaultLimit if limit is not set or is negative This method introduced a breaking change in version 0.4.0, intentionally swapping the order of parameters to strongly indicate the breaking change. https://github.com/theplant/relay/compare/genx?expand=1#diff-02f50901140d6057da6310a106670552aa766a093efbc2200fb34c099b762131R14
func EnsurePrimaryOrderBy ¶ added in v0.2.0
func EnsurePrimaryOrderBy[T any](primaryOrderBys ...OrderBy) PaginationMiddleware[T]
Click to show internal directories.
Click to hide internal directories.