40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package graph
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
// Code generated by github.com/99designs/gqlgen version v0.17.64
|
|
|
|
import (
|
|
"context"
|
|
|
|
"labprogramming.net/shenikan"
|
|
"labprogramming.net/shenikan_server/graph/model"
|
|
)
|
|
|
|
// Dictionary is the resolver for the dictionary field.
|
|
func (r *queryResolver) Dictionary(ctx context.Context) (m *model.Dictionary, err error) {
|
|
if shenikan.Dict == nil {
|
|
return nil, shenikan.DictError
|
|
}
|
|
|
|
m = &model.Dictionary{}
|
|
m.Glyphs = make([]model.Glyph, len(shenikan.Dict.Glyphs))
|
|
for i, g := range shenikan.Dict.Glyphs {
|
|
m.Glyphs[i] = model.Glyph{
|
|
Kind: model.GlyphKind(g.Kind),
|
|
Ortho: g.Ortho,
|
|
Attrs: make([]model.GlyphAttribute, len(g.Attrs)),
|
|
}
|
|
for j, a := range g.Attrs {
|
|
m.Glyphs[i].Attrs[j] = model.GlyphAttribute(a)
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Query returns QueryResolver implementation.
|
|
func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }
|
|
|
|
type queryResolver struct{ *Resolver }
|