From acdce91198372d3adc6ade479badf7e581c41784 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Tue, 18 Jun 2024 09:12:10 -0500 Subject: [PATCH] regenerate with updated packages (#177) Signed-off-by: Mike Mason --- internal/ent/generated/gql_collection.go | 60 +++++------- internal/ent/generated/gql_node.go | 25 +++-- internal/ent/generated/gql_pagination.go | 9 +- internal/ent/generated/tenant.go | 6 -- internal/ent/templates/interfaces.tmpl | 10 -- internal/graphapi/ent_resolvers.go | 2 +- internal/graphapi/entity_resolvers.go | 2 +- internal/graphapi/gen_federation.go | 12 ++- internal/graphapi/gen_server.go | 118 +++++++++++------------ internal/graphapi/tenant_resolvers.go | 5 +- schema/ent.graphql | 4 +- 11 files changed, 117 insertions(+), 136 deletions(-) diff --git a/internal/ent/generated/gql_collection.go b/internal/ent/generated/gql_collection.go index bb4517d2..02cf0d53 100644 --- a/internal/ent/generated/gql_collection.go +++ b/internal/ent/generated/gql_collection.go @@ -34,13 +34,13 @@ func (t *TenantQuery) CollectFields(ctx context.Context, satisfies ...string) (* if fc == nil { return t, nil } - if err := t.collectField(ctx, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { + if err := t.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return t, nil } -func (t *TenantQuery) collectField(ctx context.Context, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { +func (t *TenantQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool @@ -49,13 +49,14 @@ func (t *TenantQuery) collectField(ctx context.Context, opCtx *graphql.Operation ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { + case "parent": var ( alias = field.Alias path = append(path, alias) query = (&TenantClient{config: t.config}).Query() ) - if err := query.collectField(ctx, opCtx, field, path, satisfies...); err != nil { + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, tenantImplementors)...); err != nil { return err } t.withParent = query @@ -63,6 +64,7 @@ func (t *TenantQuery) collectField(ctx context.Context, opCtx *graphql.Operation selectedFields = append(selectedFields, tenant.FieldParentTenantID) fieldSeen[tenant.FieldParentTenantID] = struct{}{} } + case "children": var ( alias = field.Alias @@ -134,13 +136,17 @@ func (t *TenantQuery) collectField(ctx context.Context, opCtx *graphql.Operation } path = append(path, edgesField, nodeField) if field := collectedField(ctx, path...); field != nil { - if err := query.collectField(ctx, opCtx, *field, path, mayAddCondition(satisfies, "Tenant")...); err != nil { + if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, tenantImplementors)...); err != nil { return err } } if limit := paginateLimit(args.first, args.last); limit > 0 { - modify := limitRows(tenant.ChildrenColumn, limit, pager.orderExpr(query)) - query.modifiers = append(query.modifiers, modify) + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(tenant.ChildrenColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } } else { query = pager.applyOrder(query) } @@ -282,39 +288,17 @@ func unmarshalArgs(ctx context.Context, whereInput any, args map[string]any) map return args } -func limitRows(partitionBy string, limit int, orderBy ...sql.Querier) func(s *sql.Selector) { - return func(s *sql.Selector) { - d := sql.Dialect(s.Dialect()) - s.SetDistinct(false) - with := d.With("src_query"). - As(s.Clone()). - With("limited_query"). - As( - d.Select("*"). - AppendSelectExprAs( - sql.RowNumber().PartitionBy(partitionBy).OrderExpr(orderBy...), - "row_number", - ). - From(d.Table("src_query")), - ) - t := d.Table("limited_query").As(s.TableName()) - *s = *d.Select(s.UnqualifiedColumns()...). - From(t). - Where(sql.LTE(t.C("row_number"), limit)). - Prefix(with) - } -} - // mayAddCondition appends another type condition to the satisfies list -// if condition is enabled (Node/Nodes) and it does not exist in the list. -func mayAddCondition(satisfies []string, typeCond string) []string { - if len(satisfies) == 0 { - return satisfies - } - for _, s := range satisfies { - if typeCond == s { - return satisfies +// if it does not exist in the list. +func mayAddCondition(satisfies []string, typeCond []string) []string { +Cond: + for _, c := range typeCond { + for _, s := range satisfies { + if c == s { + continue Cond + } } + satisfies = append(satisfies, c) } - return append(satisfies, typeCond) + return satisfies } diff --git a/internal/ent/generated/gql_node.go b/internal/ent/generated/gql_node.go index fc6e2308..49d529b4 100644 --- a/internal/ent/generated/gql_node.go +++ b/internal/ent/generated/gql_node.go @@ -32,8 +32,16 @@ type Noder interface { IsNode() } +var tenantImplementors = []string{"Tenant", "Node", "ResourceOwner", "MetadataNode"} + // IsNode implements the Node interface check for GQLGen. -func (n *Tenant) IsNode() {} +func (*Tenant) IsNode() {} + +// IsResourceOwner implements the ResourceOwner interface check for GQLGen. +func (*Tenant) IsResourceOwner() {} + +// IsMetadataNode implements the MetadataNode interface check for GQLGen. +func (*Tenant) IsMetadataNode() {} var errNodeInvalidID = &NotFoundError{"node"} @@ -100,15 +108,12 @@ func (c *Client) noder(ctx context.Context, table string, id gidx.PrefixedID) (N } query := c.Tenant.Query(). Where(tenant.ID(uid)) - query, err := query.CollectFields(ctx, "Tenant") - if err != nil { - return nil, err - } - n, err := query.Only(ctx) - if err != nil { - return nil, err + if fc := graphql.GetFieldContext(ctx); fc != nil { + if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, tenantImplementors...); err != nil { + return nil, err + } } - return n, nil + return query.Only(ctx) default: return nil, fmt.Errorf("cannot resolve noder from table %q: %w", table, errNodeInvalidID) } @@ -185,7 +190,7 @@ func (c *Client) noders(ctx context.Context, table string, ids []gidx.PrefixedID case tenant.Table: query := c.Tenant.Query(). Where(tenant.IDIn(ids...)) - query, err := query.CollectFields(ctx, "Tenant") + query, err := query.CollectFields(ctx, tenantImplementors...) if err != nil { return nil, err } diff --git a/internal/ent/generated/gql_pagination.go b/internal/ent/generated/gql_pagination.go index 12a2ab1b..1c220b45 100644 --- a/internal/ent/generated/gql_pagination.go +++ b/internal/ent/generated/gql_pagination.go @@ -288,7 +288,9 @@ func (t *TenantQuery) Paginate( if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { - if conn.TotalCount, err = t.Clone().Count(ctx); err != nil { + c := t.Clone() + c.ctx.Fields = nil + if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 @@ -301,11 +303,12 @@ func (t *TenantQuery) Paginate( if t, err = pager.applyCursors(t, after, before); err != nil { return nil, err } - if limit := paginateLimit(first, last); limit != 0 { + limit := paginateLimit(first, last) + if limit != 0 { t.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { - if err := t.collectField(ctx, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { + if err := t.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } diff --git a/internal/ent/generated/tenant.go b/internal/ent/generated/tenant.go index 75ab7e0d..da0ee102 100644 --- a/internal/ent/generated/tenant.go +++ b/internal/ent/generated/tenant.go @@ -213,12 +213,6 @@ func (t *Tenant) String() string { // IsEntity implement fedruntime.Entity func (t Tenant) IsEntity() {} -// IsMetadataNode implements interface for MetadataNode -func (t Tenant) IsMetadataNode() {} - -// IsResourceOwner implements interface for ResourceOwner -func (t Tenant) IsResourceOwner() {} - // NamedChildren returns the Children named value or an error if the edge was not // loaded in eager-loading with this name. func (t *Tenant) NamedChildren(name string) ([]*Tenant, error) { diff --git a/internal/ent/templates/interfaces.tmpl b/internal/ent/templates/interfaces.tmpl index a5ca09eb..90877fa8 100644 --- a/internal/ent/templates/interfaces.tmpl +++ b/internal/ent/templates/interfaces.tmpl @@ -1,13 +1,3 @@ -{{ define "model/additional/interfaces" }} - {{- if eq $.Name "Tenant" }} - // IsMetadataNode implements interface for MetadataNode - func ({{ $.Receiver }} {{ $.Name }}) IsMetadataNode() {} - - // IsResourceOwner implements interface for ResourceOwner - func ({{ $.Receiver }} {{ $.Name }}) IsResourceOwner() {} - {{ end }} -{{ end }} - {{ define "interfaces" }} {{ $pkg := base $.Config.Package }} {{ template "header" $ }} diff --git a/internal/graphapi/ent_resolvers.go b/internal/graphapi/ent_resolvers.go index 05fefbfc..8e6869e3 100644 --- a/internal/graphapi/ent_resolvers.go +++ b/internal/graphapi/ent_resolvers.go @@ -2,7 +2,7 @@ package graphapi // 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.45 +// Code generated by github.com/99designs/gqlgen version v0.17.49 // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } diff --git a/internal/graphapi/entity_resolvers.go b/internal/graphapi/entity_resolvers.go index 535d332a..d08c4764 100644 --- a/internal/graphapi/entity_resolvers.go +++ b/internal/graphapi/entity_resolvers.go @@ -2,7 +2,7 @@ package graphapi // 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.45 +// Code generated by github.com/99designs/gqlgen version v0.17.49 import ( "context" diff --git a/internal/graphapi/gen_federation.go b/internal/graphapi/gen_federation.go index d35d6cc9..55d22faf 100644 --- a/internal/graphapi/gen_federation.go +++ b/internal/graphapi/gen_federation.go @@ -177,8 +177,18 @@ func entityResolverNameForTenant(ctx context.Context, rep map[string]interface{} ok bool ) _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true m = rep - if _, ok = m["id"]; !ok { + val, ok = m["id"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { break } return "findTenantByID", nil diff --git a/internal/graphapi/gen_server.go b/internal/graphapi/gen_server.go index d8e92832..6ffce616 100644 --- a/internal/graphapi/gen_server.go +++ b/internal/graphapi/gen_server.go @@ -476,8 +476,8 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../../schema/ent.graphql", Input: `directive @goField(forceResolver: Boolean, name: String) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION -directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION + {Name: "../../schema/ent.graphql", Input: `directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION +directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """ Input information to create a tenant. """ @@ -1358,7 +1358,7 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, @@ -1402,7 +1402,7 @@ func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, @@ -1443,7 +1443,7 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_startCursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, @@ -1484,7 +1484,7 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PageInfo_endCursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, @@ -1654,7 +1654,7 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C return ec.marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query__service(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__service(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -1773,7 +1773,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -1831,7 +1831,7 @@ func (ec *executionContext) _Tenant_id(ctx context.Context, field graphql.Collec return ec.marshalNID2goᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -1875,7 +1875,7 @@ func (ec *executionContext) _Tenant_createdAt(ctx context.Context, field graphql return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -1919,7 +1919,7 @@ func (ec *executionContext) _Tenant_updatedAt(ctx context.Context, field graphql return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_updatedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -1963,7 +1963,7 @@ func (ec *executionContext) _Tenant_name(ctx context.Context, field graphql.Coll return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -2004,7 +2004,7 @@ func (ec *executionContext) _Tenant_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -2045,7 +2045,7 @@ func (ec *executionContext) _Tenant_parent(ctx context.Context, field graphql.Co return ec.marshalOTenant2ᚖgoᚗinfratographerᚗcomᚋtenantᚑapiᚋinternalᚋentᚋgeneratedᚐTenant(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tenant_parent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tenant_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Tenant", Field: field, @@ -2165,7 +2165,7 @@ func (ec *executionContext) _TenantConnection_edges(ctx context.Context, field g return ec.marshalOTenantEdge2ᚕᚖgoᚗinfratographerᚗcomᚋtenantᚑapiᚋinternalᚋentᚋgeneratedᚐTenantEdge(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantConnection", Field: field, @@ -2215,7 +2215,7 @@ func (ec *executionContext) _TenantConnection_pageInfo(ctx context.Context, fiel return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantConnection_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantConnection", Field: field, @@ -2269,7 +2269,7 @@ func (ec *executionContext) _TenantConnection_totalCount(ctx context.Context, fi return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantConnection_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantConnection", Field: field, @@ -2313,7 +2313,7 @@ func (ec *executionContext) _TenantCreatePayload_tenant(ctx context.Context, fie return ec.marshalNTenant2ᚖgoᚗinfratographerᚗcomᚋtenantᚑapiᚋinternalᚋentᚋgeneratedᚐTenant(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantCreatePayload_tenant(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantCreatePayload_tenant(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantCreatePayload", Field: field, @@ -2373,7 +2373,7 @@ func (ec *executionContext) _TenantDeletePayload_deletedID(ctx context.Context, return ec.marshalNID2goᚗinfratographerᚗcomᚋxᚋgidxᚐPrefixedID(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantDeletePayload_deletedID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantDeletePayload_deletedID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantDeletePayload", Field: field, @@ -2414,7 +2414,7 @@ func (ec *executionContext) _TenantEdge_node(ctx context.Context, field graphql. return ec.marshalOTenant2ᚖgoᚗinfratographerᚗcomᚋtenantᚑapiᚋinternalᚋentᚋgeneratedᚐTenant(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantEdge", Field: field, @@ -2474,7 +2474,7 @@ func (ec *executionContext) _TenantEdge_cursor(ctx context.Context, field graphq return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantEdge", Field: field, @@ -2518,7 +2518,7 @@ func (ec *executionContext) _TenantUpdatePayload_tenant(ctx context.Context, fie return ec.marshalNTenant2ᚖgoᚗinfratographerᚗcomᚋtenantᚑapiᚋinternalᚋentᚋgeneratedᚐTenant(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TenantUpdatePayload_tenant(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TenantUpdatePayload_tenant(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TenantUpdatePayload", Field: field, @@ -2575,7 +2575,7 @@ func (ec *executionContext) __Service_sdl(ctx context.Context, field graphql.Col return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext__Service_sdl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__Service_sdl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "_Service", Field: field, @@ -2619,7 +2619,7 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -2660,7 +2660,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -2704,7 +2704,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -2748,7 +2748,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -2802,7 +2802,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -2846,7 +2846,7 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -2887,7 +2887,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -2931,7 +2931,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -2972,7 +2972,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -3016,7 +3016,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3057,7 +3057,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3101,7 +3101,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3155,7 +3155,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3221,7 +3221,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3262,7 +3262,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -3306,7 +3306,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -3347,7 +3347,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -3391,7 +3391,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -3454,7 +3454,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -3495,7 +3495,7 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3539,7 +3539,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3605,7 +3605,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3668,7 +3668,7 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3731,7 +3731,7 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3797,7 +3797,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -3853,7 +3853,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -3894,7 +3894,7 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -3935,7 +3935,7 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4042,7 +4042,7 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4105,7 +4105,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4230,7 +4230,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4281,7 +4281,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return ec.marshalO__Type2ᚖgithub.comᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4344,7 +4344,7 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -4726,8 +4726,6 @@ func (ec *executionContext) _MetadataNode(ctx context.Context, sel ast.Selection switch obj := (obj).(type) { case nil: return graphql.Null - case generated.Tenant: - return ec._Tenant(ctx, sel, &obj) case *generated.Tenant: if obj == nil { return graphql.Null @@ -4756,8 +4754,6 @@ func (ec *executionContext) _ResourceOwner(ctx context.Context, sel ast.Selectio switch obj := (obj).(type) { case nil: return graphql.Null - case generated.Tenant: - return ec._Tenant(ctx, sel, &obj) case *generated.Tenant: if obj == nil { return graphql.Null @@ -5115,7 +5111,7 @@ func (ec *executionContext) _Tenant(ctx context.Context, sel ast.SelectionSet, o case "parent": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) diff --git a/internal/graphapi/tenant_resolvers.go b/internal/graphapi/tenant_resolvers.go index 192f2fdb..c5c72271 100644 --- a/internal/graphapi/tenant_resolvers.go +++ b/internal/graphapi/tenant_resolvers.go @@ -2,17 +2,16 @@ package graphapi // 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.45 +// Code generated by github.com/99designs/gqlgen version v0.17.49 import ( "context" "fmt" "github.com/metal-toolbox/iam-runtime-contrib/iamruntime" - "go.infratographer.com/x/gidx" - "go.infratographer.com/tenant-api/internal/ent/generated" "go.infratographer.com/tenant-api/internal/ent/generated/tenant" + "go.infratographer.com/x/gidx" ) // TenantCreate is the resolver for the tenantCreate field. diff --git a/schema/ent.graphql b/schema/ent.graphql index bafc35f2..5ade4eb6 100644 --- a/schema/ent.graphql +++ b/schema/ent.graphql @@ -1,5 +1,5 @@ -directive @goField(forceResolver: Boolean, name: String) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION -directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION +directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION +directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """ Input information to create a tenant. """