From 3605887345792d2f981f971c6c4a2cb7f86a343e Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 11 Sep 2018 22:04:16 +0200 Subject: reorganize package for a more idomatic go --- graphql/gqlgen.yml | 12 ++++++------ graphql/graph/gen_graph.go | 28 ++++++++++++++-------------- graphql/resolvers/mutation.go | 6 +++--- graphql/resolvers/operations.go | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'graphql') diff --git a/graphql/gqlgen.yml b/graphql/gqlgen.yml index 9be33ef7..34eb13c2 100644 --- a/graphql/gqlgen.yml +++ b/graphql/gqlgen.yml @@ -18,16 +18,16 @@ models: Label: model: github.com/MichaelMure/git-bug/bug.Label Hash: - model: github.com/MichaelMure/git-bug/util.Hash + model: github.com/MichaelMure/git-bug/util/git.Hash Operation: model: github.com/MichaelMure/git-bug/bug.Operation CreateOperation: - model: github.com/MichaelMure/git-bug/bug/operations.CreateOperation + model: github.com/MichaelMure/git-bug/operations.CreateOperation SetTitleOperation: - model: github.com/MichaelMure/git-bug/bug/operations.SetTitleOperation + model: github.com/MichaelMure/git-bug/operations.SetTitleOperation AddCommentOperation: - model: github.com/MichaelMure/git-bug/bug/operations.AddCommentOperation + model: github.com/MichaelMure/git-bug/operations.AddCommentOperation SetStatusOperation: - model: github.com/MichaelMure/git-bug/bug/operations.SetStatusOperation + model: github.com/MichaelMure/git-bug/operations.SetStatusOperation LabelChangeOperation: - model: github.com/MichaelMure/git-bug/bug/operations.LabelChangeOperation + model: github.com/MichaelMure/git-bug/operations.LabelChangeOperation diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go index a8be6cd3..6969f008 100644 --- a/graphql/graph/gen_graph.go +++ b/graphql/graph/gen_graph.go @@ -10,9 +10,9 @@ import ( time "time" bug "github.com/MichaelMure/git-bug/bug" - operations "github.com/MichaelMure/git-bug/bug/operations" models "github.com/MichaelMure/git-bug/graphql/models" - util "github.com/MichaelMure/git-bug/util" + operations "github.com/MichaelMure/git-bug/operations" + git "github.com/MichaelMure/git-bug/util/git" graphql "github.com/vektah/gqlgen/graphql" introspection "github.com/vektah/gqlgen/neelance/introspection" query "github.com/vektah/gqlgen/neelance/query" @@ -42,8 +42,8 @@ type Resolvers interface { LabelChangeOperation_date(ctx context.Context, obj *operations.LabelChangeOperation) (time.Time, error) - Mutation_newBug(ctx context.Context, repoRef *string, title string, message string, files []util.Hash) (bug.Snapshot, error) - Mutation_addComment(ctx context.Context, repoRef *string, prefix string, message string, files []util.Hash) (bug.Snapshot, error) + Mutation_newBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) + Mutation_addComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) Mutation_changeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (bug.Snapshot, error) Mutation_open(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) Mutation_close(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) @@ -90,8 +90,8 @@ type LabelChangeOperationResolver interface { Date(ctx context.Context, obj *operations.LabelChangeOperation) (time.Time, error) } type MutationResolver interface { - NewBug(ctx context.Context, repoRef *string, title string, message string, files []util.Hash) (bug.Snapshot, error) - AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []util.Hash) (bug.Snapshot, error) + NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) + AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (bug.Snapshot, error) Open(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) Close(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) @@ -146,11 +146,11 @@ func (s shortMapper) LabelChangeOperation_date(ctx context.Context, obj *operati return s.r.LabelChangeOperation().Date(ctx, obj) } -func (s shortMapper) Mutation_newBug(ctx context.Context, repoRef *string, title string, message string, files []util.Hash) (bug.Snapshot, error) { +func (s shortMapper) Mutation_newBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) { return s.r.Mutation().NewBug(ctx, repoRef, title, message, files) } -func (s shortMapper) Mutation_addComment(ctx context.Context, repoRef *string, prefix string, message string, files []util.Hash) (bug.Snapshot, error) { +func (s shortMapper) Mutation_addComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) { return s.r.Mutation().AddComment(ctx, repoRef, prefix, message, files) } @@ -1356,7 +1356,7 @@ func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql. } } args["message"] = arg2 - var arg3 []util.Hash + var arg3 []git.Hash if tmp, ok := field.Args["files"]; ok { var err error var rawIf1 []interface{} @@ -1365,7 +1365,7 @@ func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql. rawIf1 = tmp1 } } - arg3 = make([]util.Hash, len(rawIf1)) + arg3 = make([]git.Hash, len(rawIf1)) for idx1 := range rawIf1 { err = (&arg3[idx1]).UnmarshalGQL(rawIf1[idx1]) } @@ -1382,7 +1382,7 @@ func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql. rctx.PushField(field.Alias) defer rctx.Pop() resTmp, err := ec.ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.Mutation_newBug(ctx, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]util.Hash)) + return ec.resolvers.Mutation_newBug(ctx, args["repoRef"].(*string), args["title"].(string), args["message"].(string), args["files"].([]git.Hash)) }) if err != nil { ec.Error(ctx, err) @@ -1432,7 +1432,7 @@ func (ec *executionContext) _Mutation_addComment(ctx context.Context, field grap } } args["message"] = arg2 - var arg3 []util.Hash + var arg3 []git.Hash if tmp, ok := field.Args["files"]; ok { var err error var rawIf1 []interface{} @@ -1441,7 +1441,7 @@ func (ec *executionContext) _Mutation_addComment(ctx context.Context, field grap rawIf1 = tmp1 } } - arg3 = make([]util.Hash, len(rawIf1)) + arg3 = make([]git.Hash, len(rawIf1)) for idx1 := range rawIf1 { err = (&arg3[idx1]).UnmarshalGQL(rawIf1[idx1]) } @@ -1458,7 +1458,7 @@ func (ec *executionContext) _Mutation_addComment(ctx context.Context, field grap rctx.PushField(field.Alias) defer rctx.Pop() resTmp, err := ec.ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.Mutation_addComment(ctx, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]util.Hash)) + return ec.resolvers.Mutation_addComment(ctx, args["repoRef"].(*string), args["prefix"].(string), args["message"].(string), args["files"].([]git.Hash)) }) if err != nil { ec.Error(ctx, err) diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go index 7cc98aac..c0776266 100644 --- a/graphql/resolvers/mutation.go +++ b/graphql/resolvers/mutation.go @@ -5,7 +5,7 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/util" + "github.com/MichaelMure/git-bug/util/git" ) type mutationResolver struct { @@ -20,7 +20,7 @@ func (r mutationResolver) getRepo(repoRef *string) (*cache.RepoCache, error) { return r.cache.DefaultRepo() } -func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []util.Hash) (bug.Snapshot, error) { +func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { return bug.Snapshot{}, err @@ -57,7 +57,7 @@ func (r mutationResolver) Commit(ctx context.Context, repoRef *string, prefix st return *snap, nil } -func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []util.Hash) (bug.Snapshot, error) { +func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) { repo, err := r.getRepo(repoRef) if err != nil { return bug.Snapshot{}, err diff --git a/graphql/resolvers/operations.go b/graphql/resolvers/operations.go index a0058a42..b49b4f83 100644 --- a/graphql/resolvers/operations.go +++ b/graphql/resolvers/operations.go @@ -6,8 +6,8 @@ import ( "time" "github.com/MichaelMure/git-bug/bug" - "github.com/MichaelMure/git-bug/bug/operations" "github.com/MichaelMure/git-bug/graphql/models" + "github.com/MichaelMure/git-bug/operations" ) type addCommentOperationResolver struct{} -- cgit