git-bug/api/graphql/resolvers/color.go
Michael Muré 2ab6381a94
Reorganize the webUI and API code
Included in the changes:
- create a new /api root package to hold all API code, migrate /graphql in there
- git API handlers all use the cache instead of the repo directly
- git API handlers are now tested
- git API handlers now require a "repo" mux parameter
- lots of untangling of API/handlers/middleware
- less code in commands/webui.go
2020-06-27 23:03:05 +02:00

25 lines
487 B
Go

package resolvers
import (
"context"
"image/color"
"github.com/MichaelMure/git-bug/api/graphql/graph"
)
var _ graph.ColorResolver = &colorResolver{}
type colorResolver struct{}
func (colorResolver) R(_ context.Context, obj *color.RGBA) (int, error) {
return int(obj.R), nil
}
func (colorResolver) G(_ context.Context, obj *color.RGBA) (int, error) {
return int(obj.G), nil
}
func (colorResolver) B(_ context.Context, obj *color.RGBA) (int, error) {
return int(obj.B), nil
}