rano/graph/generated/root.generated.go

636 lines
20 KiB
Go
Raw Permalink Normal View History

2024-11-01 14:25:30 +00:00
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package generated
import (
"context"
"errors"
"fmt"
"strconv"
"sync/atomic"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/vektah/gqlparser/v2/ast"
2024-11-01 17:49:56 +00:00
"gitserver.in/patialtech/rano/graph/model"
2024-11-01 14:25:30 +00:00
)
// region ************************** generated!.gotpl **************************
type MutationResolver interface {
2024-11-17 16:58:29 +00:00
AccountVerifyEmail(ctx context.Context, token *string) (bool, error)
AccountLogin(ctx context.Context, email string, pwd string) (*model.AuthUser, error)
AccountLogout(ctx context.Context) (bool, error)
2024-11-01 14:25:30 +00:00
}
type QueryResolver interface {
2024-11-01 17:49:56 +00:00
Me(ctx context.Context) (*model.AuthUser, error)
2024-11-01 14:25:30 +00:00
}
// endregion ************************** generated!.gotpl **************************
// region ***************************** args.gotpl *****************************
2024-11-17 16:58:29 +00:00
func (ec *executionContext) field_Mutation_accountLogin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
2024-11-01 14:25:30 +00:00
var err error
args := map[string]interface{}{}
2024-11-17 16:58:29 +00:00
arg0, err := ec.field_Mutation_accountLogin_argsEmail(ctx, rawArgs)
2024-11-01 14:25:30 +00:00
if err != nil {
return nil, err
}
args["email"] = arg0
2024-11-17 16:58:29 +00:00
arg1, err := ec.field_Mutation_accountLogin_argsPwd(ctx, rawArgs)
2024-11-01 14:25:30 +00:00
if err != nil {
return nil, err
}
args["pwd"] = arg1
2024-11-01 14:25:30 +00:00
return args, nil
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) field_Mutation_accountLogin_argsEmail(
2024-11-01 14:25:30 +00:00
ctx context.Context,
rawArgs map[string]interface{},
) (string, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("email"))
if tmp, ok := rawArgs["email"]; ok {
2024-11-01 14:25:30 +00:00
return ec.unmarshalNString2string(ctx, tmp)
}
var zeroVal string
return zeroVal, nil
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) field_Mutation_accountLogin_argsPwd(
2024-11-01 14:25:30 +00:00
ctx context.Context,
rawArgs map[string]interface{},
) (string, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("pwd"))
if tmp, ok := rawArgs["pwd"]; ok {
2024-11-01 14:25:30 +00:00
return ec.unmarshalNString2string(ctx, tmp)
}
var zeroVal string
return zeroVal, nil
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) field_Mutation_accountVerifyEmail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
arg0, err := ec.field_Mutation_accountVerifyEmail_argsToken(ctx, rawArgs)
if err != nil {
return nil, err
}
args["token"] = arg0
return args, nil
}
func (ec *executionContext) field_Mutation_accountVerifyEmail_argsToken(
ctx context.Context,
rawArgs map[string]interface{},
) (*string, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("token"))
if tmp, ok := rawArgs["token"]; ok {
return ec.unmarshalOString2ᚖstring(ctx, tmp)
}
var zeroVal *string
return zeroVal, nil
}
2024-11-01 14:25:30 +00:00
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
arg0, err := ec.field_Query___type_argsName(ctx, rawArgs)
if err != nil {
return nil, err
}
args["name"] = arg0
return args, nil
}
func (ec *executionContext) field_Query___type_argsName(
ctx context.Context,
rawArgs map[string]interface{},
) (string, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
if tmp, ok := rawArgs["name"]; ok {
return ec.unmarshalNString2string(ctx, tmp)
}
var zeroVal string
return zeroVal, nil
}
// endregion ***************************** args.gotpl *****************************
// region ************************** directives.gotpl **************************
// endregion ************************** directives.gotpl **************************
// region **************************** field.gotpl *****************************
2024-11-17 16:58:29 +00:00
func (ec *executionContext) _Mutation_accountVerifyEmail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_accountVerifyEmail(ctx, field)
2024-11-01 14:25:30 +00:00
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
2024-11-17 16:58:29 +00:00
return ec.resolvers.Mutation().AccountVerifyEmail(rctx, fc.Args["token"].(*string))
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Mutation_accountVerifyEmail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Mutation_accountVerifyEmail_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _Mutation_accountLogin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_accountLogin(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().AccountLogin(rctx, fc.Args["email"].(string), fc.Args["pwd"].(string))
2024-11-01 14:25:30 +00:00
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*model.AuthUser)
2024-11-01 14:25:30 +00:00
fc.Result = res
return ec.marshalNAuthUser2ᚖgitserverᚗinᚋpatialtechᚋranoᚋgraphᚋmodelᚐAuthUser(ctx, field.Selections, res)
2024-11-01 14:25:30 +00:00
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) fieldContext_Mutation_accountLogin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
2024-11-01 14:25:30 +00:00
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_AuthUser_id(ctx, field)
case "email":
return ec.fieldContext_AuthUser_email(ctx, field)
2024-11-17 16:58:29 +00:00
case "name":
return ec.fieldContext_AuthUser_name(ctx, field)
case "roleID":
return ec.fieldContext_AuthUser_roleID(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type AuthUser", field.Name)
2024-11-01 14:25:30 +00:00
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
2024-11-17 16:58:29 +00:00
if fc.Args, err = ec.field_Mutation_accountLogin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
2024-11-01 14:25:30 +00:00
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) _Mutation_accountLogout(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_accountLogout(ctx, field)
2024-11-01 14:25:30 +00:00
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
2024-11-17 16:58:29 +00:00
return ec.resolvers.Mutation().AccountLogout(rctx)
2024-11-01 14:25:30 +00:00
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
2024-11-17 16:58:29 +00:00
func (ec *executionContext) fieldContext_Mutation_accountLogout(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
2024-11-01 14:25:30 +00:00
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
return fc, nil
}
2024-11-01 17:49:56 +00:00
func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Query_me(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().Me(rctx)
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*model.AuthUser)
fc.Result = res
return ec.marshalOAuthUser2ᚖgitserverᚗinᚋpatialtechᚋranoᚋgraphᚋmodelᚐAuthUser(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Query",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_AuthUser_id(ctx, field)
case "email":
return ec.fieldContext_AuthUser_email(ctx, field)
2024-11-17 16:58:29 +00:00
case "name":
return ec.fieldContext_AuthUser_name(ctx, field)
2024-11-01 17:49:56 +00:00
case "roleID":
return ec.fieldContext_AuthUser_roleID(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type AuthUser", field.Name)
},
}
return fc, nil
}
2024-11-01 14:25:30 +00:00
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Query___type(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectType(fc.Args["name"].(string))
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*introspection.Type)
fc.Result = res
return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Query",
Field: field,
IsMethod: true,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "kind":
return ec.fieldContext___Type_kind(ctx, field)
case "name":
return ec.fieldContext___Type_name(ctx, field)
case "description":
return ec.fieldContext___Type_description(ctx, field)
case "fields":
return ec.fieldContext___Type_fields(ctx, field)
case "interfaces":
return ec.fieldContext___Type_interfaces(ctx, field)
case "possibleTypes":
return ec.fieldContext___Type_possibleTypes(ctx, field)
case "enumValues":
return ec.fieldContext___Type_enumValues(ctx, field)
case "inputFields":
return ec.fieldContext___Type_inputFields(ctx, field)
case "ofType":
return ec.fieldContext___Type_ofType(ctx, field)
case "specifiedByURL":
return ec.fieldContext___Type_specifiedByURL(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Query___schema(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectSchema()
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*introspection.Schema)
fc.Result = res
return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Query",
Field: field,
IsMethod: true,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "description":
return ec.fieldContext___Schema_description(ctx, field)
case "types":
return ec.fieldContext___Schema_types(ctx, field)
case "queryType":
return ec.fieldContext___Schema_queryType(ctx, field)
case "mutationType":
return ec.fieldContext___Schema_mutationType(ctx, field)
case "subscriptionType":
return ec.fieldContext___Schema_subscriptionType(ctx, field)
case "directives":
return ec.fieldContext___Schema_directives(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name)
},
}
return fc, nil
}
// endregion **************************** field.gotpl *****************************
// region **************************** input.gotpl *****************************
// endregion **************************** input.gotpl *****************************
// region ************************** interface.gotpl ***************************
// endregion ************************** interface.gotpl ***************************
// region **************************** object.gotpl ****************************
var mutationImplementors = []string{"Mutation"}
func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors)
ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
Object: "Mutation",
})
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name,
Field: field,
})
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("Mutation")
2024-11-17 16:58:29 +00:00
case "accountVerifyEmail":
2024-11-01 14:25:30 +00:00
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
2024-11-17 16:58:29 +00:00
return ec._Mutation_accountVerifyEmail(ctx, field)
2024-11-01 14:25:30 +00:00
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
2024-11-17 16:58:29 +00:00
case "accountLogin":
2024-11-01 14:25:30 +00:00
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
2024-11-17 16:58:29 +00:00
return ec._Mutation_accountLogin(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "accountLogout":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_accountLogout(ctx, field)
2024-11-01 14:25:30 +00:00
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var queryImplementors = []string{"Query"}
func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
Object: "Query",
})
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name,
Field: field,
})
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("Query")
2024-11-01 17:49:56 +00:00
case "me":
field := field
innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._Query_me(ctx, field)
return res
}
rrm := func(ctx context.Context) graphql.Marshaler {
return ec.OperationContext.RootResolverMiddleware(ctx,
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
}
2024-11-01 14:25:30 +00:00
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
case "__type":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Query___type(ctx, field)
})
case "__schema":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Query___schema(ctx, field)
})
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
// endregion **************************** object.gotpl ****************************
// region ***************************** type.gotpl *****************************
2024-11-17 16:58:29 +00:00
func (ec *executionContext) unmarshalNUID2string(ctx context.Context, v interface{}) (string, error) {
res, err := graphql.UnmarshalString(v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
res := graphql.MarshalString(v)
if res == graphql.Null {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
}
return res
}
2024-11-01 14:25:30 +00:00
// endregion ***************************** type.gotpl *****************************