connections

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package connections implement a generic GraphQL relay connection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentCon

func CommentCon(source []bug.Comment, edgeMaker CommentEdgeMaker, conMaker CommentConMaker, input models.ConnectionInput) (*models.CommentConnection, error)

CommentCon will paginate a source according to the input of a relay connection

func CursorToOffset

func CursorToOffset(cursor string) (int, error)

CursorToOffset re-derives the offset from the cursor string.

func IdentityCon

IdentityCon will paginate a source according to the input of a relay connection

func LabelCon

func LabelCon(source []bug.Label, edgeMaker LabelEdgeMaker, conMaker LabelConMaker, input models.ConnectionInput) (*models.LabelConnection, error)

LabelCon will paginate a source according to the input of a relay connection

func LazyBugCon

func LazyBugCon(source []entity.Id, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error)

LazyBugCon will paginate a source according to the input of a relay connection

func LazyIdentityCon

func LazyIdentityCon(source []entity.Id, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error)

LazyIdentityCon will paginate a source according to the input of a relay connection

func OffsetToCursor

func OffsetToCursor(offset int) string

OffsetToCursor create the cursor string from an offset

func OperationCon

func OperationCon(source []dag.Operation, edgeMaker OperationEdgeMaker, conMaker OperationConMaker, input models.ConnectionInput) (*models.OperationConnection, error)

OperationCon will paginate a source according to the input of a relay connection

func TimelineItemCon

TimelineItemCon will paginate a source according to the input of a relay connection

Types

type CommentConMaker

type CommentConMaker func(
	edges []*models.CommentEdge,
	nodes []bug.Comment,
	info *models.PageInfo,
	totalCount int) (*models.CommentConnection, error)

CommentConMaker define a function that create a models.CommentConnection

type CommentEdgeMaker

type CommentEdgeMaker func(value bug.Comment, offset int) Edge

BugCommentEdgeMaker define a function that take a bug.Comment and an offset and create an Edge.

type ConnectionType

type ConnectionType generic.Type

ConnectionType define the connection type handled by this relay connection

func NameCon

func NameCon(source []NodeType, edgeMaker NameEdgeMaker, conMaker NameConMaker, input models.ConnectionInput) (*ConnectionType, error)

NameCon will paginate a source according to the input of a relay connection

type Edge

type Edge interface {
	GetCursor() string
}

Edge define the contract for an edge in a relay connection

type EdgeType

type EdgeType generic.Type

EdgeType define the edge type handled by this relay connection

type IdentityConMaker

type IdentityConMaker func(
	edges []*models.IdentityEdge,
	nodes []models.IdentityWrapper,
	info *models.PageInfo,
	totalCount int) (*models.IdentityConnection, error)

IdentityConMaker define a function that create a models.IdentityConnection

type IdentityEdgeMaker

type IdentityEdgeMaker func(value models.IdentityWrapper, offset int) Edge

ModelsIdentityWrapperEdgeMaker define a function that take a models.IdentityWrapper and an offset and create an Edge.

type LabelConMaker

type LabelConMaker func(
	edges []*models.LabelEdge,
	nodes []bug.Label,
	info *models.PageInfo,
	totalCount int) (*models.LabelConnection, error)

LabelConMaker define a function that create a models.LabelConnection

type LabelEdgeMaker

type LabelEdgeMaker func(value bug.Label, offset int) Edge

BugLabelEdgeMaker define a function that take a bug.Label and an offset and create an Edge.

type LazyBugConMaker

type LazyBugConMaker func(
	edges []*LazyBugEdge,
	nodes []entity.Id,
	info *models.PageInfo,
	totalCount int) (*models.BugConnection, error)

LazyBugConMaker define a function that create a models.BugConnection

type LazyBugEdge

type LazyBugEdge struct {
	Id     entity.Id
	Cursor string
}

LazyBugEdge is a special relay edge used to implement a lazy loading connection

func (LazyBugEdge) GetCursor

func (lbe LazyBugEdge) GetCursor() string

GetCursor return the cursor of a LazyBugEdge

type LazyBugEdgeMaker

type LazyBugEdgeMaker func(value entity.Id, offset int) Edge

EntityIdEdgeMaker define a function that take a entity.Id and an offset and create an Edge.

type LazyIdentityConMaker

type LazyIdentityConMaker func(
	edges []*LazyIdentityEdge,
	nodes []entity.Id,
	info *models.PageInfo,
	totalCount int) (*models.IdentityConnection, error)

LazyIdentityConMaker define a function that create a models.IdentityConnection

type LazyIdentityEdge

type LazyIdentityEdge struct {
	Id     entity.Id
	Cursor string
}

LazyIdentityEdge is a special relay edge used to implement a lazy loading connection

func (LazyIdentityEdge) GetCursor

func (lbe LazyIdentityEdge) GetCursor() string

GetCursor return the cursor of a LazyIdentityEdge

type LazyIdentityEdgeMaker

type LazyIdentityEdgeMaker func(value entity.Id, offset int) Edge

EntityIdEdgeMaker define a function that take a entity.Id and an offset and create an Edge.

type Name

type Name generic.Type

Name define the name of the connection

type NameConMaker

type NameConMaker func(
	edges []*EdgeType,
	nodes []NodeType,
	info *models.PageInfo,
	totalCount int) (*ConnectionType, error)

NameConMaker define a function that create a ConnectionType

type NameEdgeMaker

type NameEdgeMaker func(value NodeType, offset int) Edge

NodeTypeEdgeMaker define a function that take a NodeType and an offset and create an Edge.

type NodeType

type NodeType generic.Type

NodeType define the node type handled by this relay connection

type OperationConMaker

type OperationConMaker func(
	edges []*models.OperationEdge,
	nodes []dag.Operation,
	info *models.PageInfo,
	totalCount int) (*models.OperationConnection, error)

OperationConMaker define a function that create a models.OperationConnection

type OperationEdgeMaker

type OperationEdgeMaker func(value dag.Operation, offset int) Edge

DagOperationEdgeMaker define a function that take a dag.Operation and an offset and create an Edge.

type TimelineItemConMaker

type TimelineItemConMaker func(
	edges []*models.TimelineItemEdge,
	nodes []bug.TimelineItem,
	info *models.PageInfo,
	totalCount int) (*models.TimelineItemConnection, error)

TimelineItemConMaker define a function that create a models.TimelineItemConnection

type TimelineItemEdgeMaker

type TimelineItemEdgeMaker func(value bug.TimelineItem, offset int) Edge

BugTimelineItemEdgeMaker define a function that take a bug.TimelineItem and an offset and create an Edge.

Jump to

Keyboard shortcuts

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