entity

package
v0.0.0-...-9d3213b Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CityInvalidPagination = errors.New("City invalid pagination parameters")

Functions

func EncodeCityCursor

func EncodeCityCursor(cursor *CityCursor) string

Types

type City

type City struct {
	ID   int     `json:"id"`
	Name *string `json:"name"`
}

func (City) GetID

func (c City) GetID() relay.ID

func (City) IsNode

func (City) IsNode()

func (City) String

func (c City) String() string

type CityConnection

type CityConnection struct {
	Edges      []CityEdge     `json:"edges"`
	PageInfo   relay.PageInfo `json:"pageInfo"`
	TotalCount *int           `json:"totalCount"`
}

CityConnection is the connection containing edges of City

func NewCityPage

func NewCityPage(defaultLimit int, first *int, afterCursor *string, beforeCursor *string, paginate CityPaginationFunc) (*CityConnection, error)

func (CityConnection) IsConnection

func (CityConnection) IsConnection()

type CityCursor

type CityCursor struct {
	Offset int    `json:"offset"`
	ID     string `json:"id"`
}

CityCursor is the edge representation of City

func DecodeCityCursor

func DecodeCityCursor(cursor string) (*CityCursor, error)

func MustDecodeCityCursor

func MustDecodeCityCursor(cursor string) *CityCursor

func NewCityCursor

func NewCityCursor(offset int, id fmt.Stringer) *CityCursor

type CityEdge

type CityEdge struct {
	Cursor string `json:"cursor"`
	Node   *City  `json:"node"`
}

CityEdge is the edge representation of City

func (CityEdge) IsEdge

func (CityEdge) IsEdge()

type CityPaginationFunc

type CityPaginationFunc = func(offset, limit int) (items []*City, total *int, err error)

type Connection

type Connection interface {
	IsConnection()
}

type CursorPaginationInput

type CursorPaginationInput struct {
	First  *int      `json:"first"`
	After  *string   `json:"after"`
	Last   *int      `json:"last"`
	Before *string   `json:"before"`
	SortBy []*string `json:"sortBy"`
}

func (*CursorPaginationInput) DecodeParam

func (p *CursorPaginationInput) DecodeParam(param url.Values) url.Values

type Edge

type Edge interface {
	IsEdge()
}

type PageInfo

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

type PagePaginationInput

type PagePaginationInput struct {
	SortBy []*string `json:"sortBy"`
	Limit  *int      `json:"limit"`
	Page   *int      `json:"page"`
}

func (*PagePaginationInput) DecodeParam

func (p *PagePaginationInput) DecodeParam(param url.Values) url.Values

type Pagination

type Pagination struct {
	CurrentPage     *int      `json:"current_page"`
	CurrentElements *int      `json:"current_elements"`
	TotalPages      *int      `json:"total_pages"`
	TotalElements   *int      `json:"total_elements"`
	SortBy          *[]string `json:"sort_by,omitempty"`
	CursorStart     *string   `json:"cursor_start,omitempty"`
	CursorEnd       *string   `json:"cursor_end,omitempty"`
}

type ParamCityInput

type ParamCityInput struct {
	ID []*int `json:"id"`
}

Jump to

Keyboard shortcuts

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