diff options
Diffstat (limited to 'graphql/connections')
-rw-r--r-- | graphql/connections/connections.go | 4 | ||||
-rw-r--r-- | graphql/connections/gen_lazy_bug.go | 11 | ||||
-rw-r--r-- | graphql/connections/gen_lazy_identity.go | 11 | ||||
-rw-r--r-- | graphql/connections/lazy_bug.go | 4 | ||||
-rw-r--r-- | graphql/connections/lazy_identity.go | 4 |
5 files changed, 20 insertions, 14 deletions
diff --git a/graphql/connections/connections.go b/graphql/connections/connections.go index d54a5068..d82c5620 100644 --- a/graphql/connections/connections.go +++ b/graphql/connections/connections.go @@ -1,5 +1,5 @@ -//go:generate genny -in=connection_template.go -out=gen_lazy_bug.go gen "Name=LazyBug NodeType=string EdgeType=LazyBugEdge ConnectionType=models.BugConnection" -//go:generate genny -in=connection_template.go -out=gen_lazy_identity.go gen "Name=LazyIdentity NodeType=string EdgeType=LazyIdentityEdge ConnectionType=models.IdentityConnection" +//go:generate genny -in=connection_template.go -out=gen_lazy_bug.go gen "Name=LazyBug NodeType=entity.Id EdgeType=LazyBugEdge ConnectionType=models.BugConnection" +//go:generate genny -in=connection_template.go -out=gen_lazy_identity.go gen "Name=LazyIdentity NodeType=entity.Id EdgeType=LazyIdentityEdge ConnectionType=models.IdentityConnection" //go:generate genny -in=connection_template.go -out=gen_identity.go gen "Name=Identity NodeType=identity.Interface EdgeType=models.IdentityEdge ConnectionType=models.IdentityConnection" //go:generate genny -in=connection_template.go -out=gen_operation.go gen "Name=Operation NodeType=bug.Operation EdgeType=models.OperationEdge ConnectionType=models.OperationConnection" //go:generate genny -in=connection_template.go -out=gen_comment.go gen "Name=Comment NodeType=bug.Comment EdgeType=models.CommentEdge ConnectionType=models.CommentConnection" diff --git a/graphql/connections/gen_lazy_bug.go b/graphql/connections/gen_lazy_bug.go index 6c9eb012..9638e86b 100644 --- a/graphql/connections/gen_lazy_bug.go +++ b/graphql/connections/gen_lazy_bug.go @@ -7,23 +7,24 @@ package connections import ( "fmt" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/graphql/models" ) -// StringEdgeMaker define a function that take a string and an offset and +// EntityIdEdgeMaker define a function that take a entity.Id and an offset and // create an Edge. -type LazyBugEdgeMaker func(value string, offset int) Edge +type LazyBugEdgeMaker func(value entity.Id, offset int) Edge // LazyBugConMaker define a function that create a models.BugConnection type LazyBugConMaker func( edges []*LazyBugEdge, - nodes []string, + nodes []entity.Id, info *models.PageInfo, totalCount int) (*models.BugConnection, error) // LazyBugCon will paginate a source according to the input of a relay connection -func LazyBugCon(source []string, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error) { - var nodes []string +func LazyBugCon(source []entity.Id, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error) { + var nodes []entity.Id var edges []*LazyBugEdge var cursors []string var pageInfo = &models.PageInfo{} diff --git a/graphql/connections/gen_lazy_identity.go b/graphql/connections/gen_lazy_identity.go index 96461be5..932d802c 100644 --- a/graphql/connections/gen_lazy_identity.go +++ b/graphql/connections/gen_lazy_identity.go @@ -7,23 +7,24 @@ package connections import ( "fmt" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/graphql/models" ) -// StringEdgeMaker define a function that take a string and an offset and +// EntityIdEdgeMaker define a function that take a entity.Id and an offset and // create an Edge. -type LazyIdentityEdgeMaker func(value string, offset int) Edge +type LazyIdentityEdgeMaker func(value entity.Id, offset int) Edge // LazyIdentityConMaker define a function that create a models.IdentityConnection type LazyIdentityConMaker func( edges []*LazyIdentityEdge, - nodes []string, + nodes []entity.Id, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) // LazyIdentityCon will paginate a source according to the input of a relay connection -func LazyIdentityCon(source []string, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) { - var nodes []string +func LazyIdentityCon(source []entity.Id, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) { + var nodes []entity.Id var edges []*LazyIdentityEdge var cursors []string var pageInfo = &models.PageInfo{} diff --git a/graphql/connections/lazy_bug.go b/graphql/connections/lazy_bug.go index 24eda0b6..00692e8b 100644 --- a/graphql/connections/lazy_bug.go +++ b/graphql/connections/lazy_bug.go @@ -1,8 +1,10 @@ package connections +import "github.com/MichaelMure/git-bug/entity" + // LazyBugEdge is a special relay edge used to implement a lazy loading connection type LazyBugEdge struct { - Id string + Id entity.Id Cursor string } diff --git a/graphql/connections/lazy_identity.go b/graphql/connections/lazy_identity.go index 34ba579a..3274dd7e 100644 --- a/graphql/connections/lazy_identity.go +++ b/graphql/connections/lazy_identity.go @@ -1,8 +1,10 @@ package connections +import "github.com/MichaelMure/git-bug/entity" + // LazyIdentityEdge is a special relay edge used to implement a lazy loading connection type LazyIdentityEdge struct { - Id string + Id entity.Id Cursor string } |