Documentation ¶
Overview ¶
Package connections implement a generic GraphQL relay connection
Index ¶
- func CommentCon(source []bug.Comment, edgeMaker CommentEdgeMaker, conMaker CommentConMaker, ...) (*models.CommentConnection, error)
- func CursorToOffset(cursor string) (int, error)
- func IdentityCon(source []models.IdentityWrapper, edgeMaker IdentityEdgeMaker, ...) (*models.IdentityConnection, error)
- func LabelCon(source []bug.Label, edgeMaker LabelEdgeMaker, conMaker LabelConMaker, ...) (*models.LabelConnection, error)
- func LazyBugCon(source []entity.Id, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, ...) (*models.BugConnection, error)
- func LazyIdentityCon(source []entity.Id, edgeMaker LazyIdentityEdgeMaker, ...) (*models.IdentityConnection, error)
- func OffsetToCursor(offset int) string
- func OperationCon(source []dag.Operation, edgeMaker OperationEdgeMaker, ...) (*models.OperationConnection, error)
- func TimelineItemCon(source []bug.TimelineItem, edgeMaker TimelineItemEdgeMaker, ...) (*models.TimelineItemConnection, error)
- type CommentConMaker
- type CommentEdgeMaker
- type ConnectionType
- type Edge
- type EdgeType
- type IdentityConMaker
- type IdentityEdgeMaker
- type LabelConMaker
- type LabelEdgeMaker
- type LazyBugConMaker
- type LazyBugEdge
- type LazyBugEdgeMaker
- type LazyIdentityConMaker
- type LazyIdentityEdge
- type LazyIdentityEdgeMaker
- type Name
- type NameConMaker
- type NameEdgeMaker
- type NodeType
- type OperationConMaker
- type OperationEdgeMaker
- type TimelineItemConMaker
- type TimelineItemEdgeMaker
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 ¶
CursorToOffset re-derives the offset from the cursor string.
func IdentityCon ¶
func IdentityCon(source []models.IdentityWrapper, edgeMaker IdentityEdgeMaker, conMaker IdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error)
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 ¶
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 ¶
func TimelineItemCon(source []bug.TimelineItem, edgeMaker TimelineItemEdgeMaker, conMaker TimelineItemConMaker, input models.ConnectionInput) (*models.TimelineItemConnection, error)
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 ¶
BugCommentEdgeMaker define a function that take a bug.Comment and an offset and create an Edge.
type ConnectionType ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
EntityIdEdgeMaker define a function that take a entity.Id and an offset and create an Edge.
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 ¶
NodeTypeEdgeMaker define a function that take a NodeType and an offset and create an Edge.
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 ¶
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.