From 3d454d9dc8ba2409046c0938618a70864e6eb8ef Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 25 Jul 2022 13:16:16 +0200 Subject: entity/dag: proper base operation for simplified implementation - reduce boilerplace necessary to implement an operation - consolidate what an operation is in the core, which in turn pave the way for a generic cache layer mechanism - avoid the previously complex unmarshalling process - support operation metadata from the core - simplified testing --- api/graphql/connections/connections.go | 2 +- api/graphql/connections/gen_operation.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'api/graphql/connections') diff --git a/api/graphql/connections/connections.go b/api/graphql/connections/connections.go index 0083f8b2..bfdf8909 100644 --- a/api/graphql/connections/connections.go +++ b/api/graphql/connections/connections.go @@ -1,7 +1,7 @@ //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=models.IdentityWrapper 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_operation.go gen "Name=Operation NodeType=dag.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" //go:generate genny -in=connection_template.go -out=gen_timeline.go gen "Name=TimelineItem NodeType=bug.TimelineItem EdgeType=models.TimelineItemEdge ConnectionType=models.TimelineItemConnection" //go:generate genny -in=connection_template.go -out=gen_label.go gen "Name=Label NodeType=bug.Label EdgeType=models.LabelEdge ConnectionType=models.LabelConnection" diff --git a/api/graphql/connections/gen_operation.go b/api/graphql/connections/gen_operation.go index 4bd84895..848cebd6 100644 --- a/api/graphql/connections/gen_operation.go +++ b/api/graphql/connections/gen_operation.go @@ -8,23 +8,23 @@ import ( "fmt" "github.com/MichaelMure/git-bug/api/graphql/models" - "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/entity/dag" ) -// BugOperationEdgeMaker define a function that take a bug.Operation and an offset and +// DagOperationEdgeMaker define a function that take a dag.Operation and an offset and // create an Edge. -type OperationEdgeMaker func(value bug.Operation, offset int) Edge +type OperationEdgeMaker func(value dag.Operation, offset int) Edge // OperationConMaker define a function that create a models.OperationConnection type OperationConMaker func( edges []*models.OperationEdge, - nodes []bug.Operation, + nodes []dag.Operation, info *models.PageInfo, totalCount int) (*models.OperationConnection, error) // OperationCon will paginate a source according to the input of a relay connection -func OperationCon(source []bug.Operation, edgeMaker OperationEdgeMaker, conMaker OperationConMaker, input models.ConnectionInput) (*models.OperationConnection, error) { - var nodes []bug.Operation +func OperationCon(source []dag.Operation, edgeMaker OperationEdgeMaker, conMaker OperationConMaker, input models.ConnectionInput) (*models.OperationConnection, error) { + var nodes []dag.Operation var edges []*models.OperationEdge var cursors []string var pageInfo = &models.PageInfo{} -- cgit