relay

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection[Model any] struct {
	TotalCount int64          `json:"totalCount"`
	Edges      []*Edge[Model] `json:"edges"`
	PageInfo   *PageInfo      `json:"pageInfo"`
}

func Paginate

func Paginate[Model any](db *gorm.DB, _where any, _orderBy any, option PaginateOption) (*Connection[Model], error)

type Edge

type Edge[T any] struct {
	Cursor string `json:"cursor"`
	Node   *T     `json:"node"`
}

type PageInfo

type PageInfo struct {
	HasNextPage     bool    `json:"hasNextPage"`
	HasPreviousPage bool    `json:"hasPreviousPage"`
	StartCursor     *string `json:"startCursor,omitempty"`
	EndCursor       *string `json:"endCursor,omitempty"`
}

func (*PageInfo) SetHasNextPage added in v1.1.1

func (p *PageInfo) SetHasNextPage(remainingCount, edgesLen int, first, last *int, before, after *string)

func (*PageInfo) SetHasPreviousPage added in v1.1.1

func (p *PageInfo) SetHasPreviousPage(totalCount, edgesLen int, after *string)

type PaginateOption

type PaginateOption struct {
	First      *int
	Last       *int
	After      *string
	Before     *string
	Prefix     *string
	Table      string
	Tables     *map[string]string
	PrimaryKey string
}

Jump to

Keyboard shortcuts

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