diff options
author | ludovicm67 <ludovicmuller1@gmail.com> | 2019-04-10 21:50:03 +0200 |
---|---|---|
committer | Quentin Gliech <quentingliech@gmail.com> | 2019-05-22 20:22:35 +0200 |
commit | 9adf6de4b5f3df44657d336ed49f9b992d50f458 (patch) | |
tree | 87355784512d4b067cd3d6c2418f40ad39c8e3b5 /graphql/resolvers/label.go | |
parent | d156f41d997b4d33d3aa690796f09bbf66889bbe (diff) | |
download | git-bug-9adf6de4b5f3df44657d336ed49f9b992d50f458.tar.gz git-bug-9adf6de4b5f3df44657d336ed49f9b992d50f458.zip |
graphql: expose label color
Diffstat (limited to 'graphql/resolvers/label.go')
-rw-r--r-- | graphql/resolvers/label.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/graphql/resolvers/label.go b/graphql/resolvers/label.go new file mode 100644 index 000000000..7619f7484 --- /dev/null +++ b/graphql/resolvers/label.go @@ -0,0 +1,22 @@ +package resolvers + +import ( + "context" + "image/color" + + "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/graphql/graph" +) + +var _ graph.LabelResolver = &labelResolver{} + +type labelResolver struct{} + +func (labelResolver) Name(ctx context.Context, obj *bug.Label) (string, error) { + return obj.String(), nil +} + +func (labelResolver) Color(ctx context.Context, obj *bug.Label) (*color.RGBA, error) { + rgba := obj.RGBA() + return &rgba, nil +} |