diff --git a/tavern/app.go b/tavern/app.go index abfaadc7c..cdd39a588 100644 --- a/tavern/app.go +++ b/tavern/app.go @@ -129,6 +129,9 @@ func NewServer(ctx context.Context, options ...func(*Config)) (*Server, error) { return nil, fmt.Errorf("failed to upload default tomes: %w", err) } + // Initialize Git Tome Importer + git := cfg.NewGitImporter(client) + // Initialize Test Data if cfg.IsTestDataEnabled() { createTestData(ctx, client) @@ -159,7 +162,7 @@ func NewServer(ctx context.Context, options ...func(*Config)) (*Server, error) { client, "https://www.googleapis.com/oauth2/v3/userinfo", )}, - "/graphql": tavernhttp.Endpoint{Handler: newGraphQLHandler(client)}, + "/graphql": tavernhttp.Endpoint{Handler: newGraphQLHandler(client, git)}, "/c2.C2/": tavernhttp.Endpoint{Handler: newGRPCHandler(client)}, "/cdn/": tavernhttp.Endpoint{Handler: cdn.NewDownloadHandler(client)}, "/cdn/upload": tavernhttp.Endpoint{Handler: cdn.NewUploadHandler(client)}, @@ -226,8 +229,8 @@ func NewServer(ctx context.Context, options ...func(*Config)) (*Server, error) { return tSrv, nil } -func newGraphQLHandler(client *ent.Client) http.Handler { - srv := handler.NewDefaultServer(graphql.NewSchema(client)) +func newGraphQLHandler(client *ent.Client, repoImporter graphql.RepoImporter) http.Handler { + srv := handler.NewDefaultServer(graphql.NewSchema(client, repoImporter)) srv.Use(entgql.Transactioner{TxOpener: client}) // GraphQL Logging diff --git a/tavern/config.go b/tavern/config.go index 2c93488d5..8b0364375 100644 --- a/tavern/config.go +++ b/tavern/config.go @@ -10,6 +10,7 @@ import ( "golang.org/x/oauth2" "golang.org/x/oauth2/google" "realm.pub/tavern/internal/ent" + "realm.pub/tavern/tomes" "entgo.io/ent/dialect/sql" "github.com/go-sql-driver/mysql" @@ -111,6 +112,12 @@ func (cfg *Config) Connect(options ...ent.Option) (*ent.Client, error) { return ent.NewClient(append(options, ent.Driver(drv))...), nil } +// NewGitImporter configures and returns a new RepoImporter using git. +func (cfg *Config) NewGitImporter(client *ent.Client) *tomes.GitImporter { + var options []tomes.GitImportOption + return tomes.NewGitImporter(client, options...) +} + // IsMetricsEnabled returns true if the /metrics http endpoint has been enabled. func (cfg *Config) IsMetricsEnabled() bool { return EnvEnableMetrics.String() != "" diff --git a/tavern/internal/ent/client.go b/tavern/internal/ent/client.go index 43f5637c0..3b815fa93 100644 --- a/tavern/internal/ent/client.go +++ b/tavern/internal/ent/client.go @@ -22,6 +22,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -47,6 +48,8 @@ type Client struct { HostProcess *HostProcessClient // Quest is the client for interacting with the Quest builders. Quest *QuestClient + // Repository is the client for interacting with the Repository builders. + Repository *RepositoryClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // Task is the client for interacting with the Task builders. @@ -77,6 +80,7 @@ func (c *Client) init() { c.HostFile = NewHostFileClient(c.config) c.HostProcess = NewHostProcessClient(c.config) c.Quest = NewQuestClient(c.config) + c.Repository = NewRepositoryClient(c.config) c.Tag = NewTagClient(c.config) c.Task = NewTaskClient(c.config) c.Tome = NewTomeClient(c.config) @@ -173,6 +177,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { HostFile: NewHostFileClient(cfg), HostProcess: NewHostProcessClient(cfg), Quest: NewQuestClient(cfg), + Repository: NewRepositoryClient(cfg), Tag: NewTagClient(cfg), Task: NewTaskClient(cfg), Tome: NewTomeClient(cfg), @@ -203,6 +208,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) HostFile: NewHostFileClient(cfg), HostProcess: NewHostProcessClient(cfg), Quest: NewQuestClient(cfg), + Repository: NewRepositoryClient(cfg), Tag: NewTagClient(cfg), Task: NewTaskClient(cfg), Tome: NewTomeClient(cfg), @@ -237,7 +243,7 @@ func (c *Client) Close() error { func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ c.Beacon, c.File, c.Host, c.HostCredential, c.HostFile, c.HostProcess, c.Quest, - c.Tag, c.Task, c.Tome, c.User, + c.Repository, c.Tag, c.Task, c.Tome, c.User, } { n.Use(hooks...) } @@ -248,7 +254,7 @@ func (c *Client) Use(hooks ...Hook) { func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ c.Beacon, c.File, c.Host, c.HostCredential, c.HostFile, c.HostProcess, c.Quest, - c.Tag, c.Task, c.Tome, c.User, + c.Repository, c.Tag, c.Task, c.Tome, c.User, } { n.Intercept(interceptors...) } @@ -271,6 +277,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.HostProcess.mutate(ctx, m) case *QuestMutation: return c.Quest.mutate(ctx, m) + case *RepositoryMutation: + return c.Repository.mutate(ctx, m) case *TagMutation: return c.Tag.mutate(ctx, m) case *TaskMutation: @@ -1505,6 +1513,172 @@ func (c *QuestClient) mutate(ctx context.Context, m *QuestMutation) (Value, erro } } +// RepositoryClient is a client for the Repository schema. +type RepositoryClient struct { + config +} + +// NewRepositoryClient returns a client for the Repository from the given config. +func NewRepositoryClient(c config) *RepositoryClient { + return &RepositoryClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `repository.Hooks(f(g(h())))`. +func (c *RepositoryClient) Use(hooks ...Hook) { + c.hooks.Repository = append(c.hooks.Repository, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `repository.Intercept(f(g(h())))`. +func (c *RepositoryClient) Intercept(interceptors ...Interceptor) { + c.inters.Repository = append(c.inters.Repository, interceptors...) +} + +// Create returns a builder for creating a Repository entity. +func (c *RepositoryClient) Create() *RepositoryCreate { + mutation := newRepositoryMutation(c.config, OpCreate) + return &RepositoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of Repository entities. +func (c *RepositoryClient) CreateBulk(builders ...*RepositoryCreate) *RepositoryCreateBulk { + return &RepositoryCreateBulk{config: c.config, builders: builders} +} + +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *RepositoryClient) MapCreateBulk(slice any, setFunc func(*RepositoryCreate, int)) *RepositoryCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &RepositoryCreateBulk{err: fmt.Errorf("calling to RepositoryClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*RepositoryCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &RepositoryCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for Repository. +func (c *RepositoryClient) Update() *RepositoryUpdate { + mutation := newRepositoryMutation(c.config, OpUpdate) + return &RepositoryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *RepositoryClient) UpdateOne(r *Repository) *RepositoryUpdateOne { + mutation := newRepositoryMutation(c.config, OpUpdateOne, withRepository(r)) + return &RepositoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *RepositoryClient) UpdateOneID(id int) *RepositoryUpdateOne { + mutation := newRepositoryMutation(c.config, OpUpdateOne, withRepositoryID(id)) + return &RepositoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for Repository. +func (c *RepositoryClient) Delete() *RepositoryDelete { + mutation := newRepositoryMutation(c.config, OpDelete) + return &RepositoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *RepositoryClient) DeleteOne(r *Repository) *RepositoryDeleteOne { + return c.DeleteOneID(r.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *RepositoryClient) DeleteOneID(id int) *RepositoryDeleteOne { + builder := c.Delete().Where(repository.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &RepositoryDeleteOne{builder} +} + +// Query returns a query builder for Repository. +func (c *RepositoryClient) Query() *RepositoryQuery { + return &RepositoryQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeRepository}, + inters: c.Interceptors(), + } +} + +// Get returns a Repository entity by its id. +func (c *RepositoryClient) Get(ctx context.Context, id int) (*Repository, error) { + return c.Query().Where(repository.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *RepositoryClient) GetX(ctx context.Context, id int) *Repository { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// QueryTomes queries the tomes edge of a Repository. +func (c *RepositoryClient) QueryTomes(r *Repository) *TomeQuery { + query := (&TomeClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := r.ID + step := sqlgraph.NewStep( + sqlgraph.From(repository.Table, repository.FieldID, id), + sqlgraph.To(tome.Table, tome.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, repository.TomesTable, repository.TomesColumn), + ) + fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryOwner queries the owner edge of a Repository. +func (c *RepositoryClient) QueryOwner(r *Repository) *UserQuery { + query := (&UserClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := r.ID + step := sqlgraph.NewStep( + sqlgraph.From(repository.Table, repository.FieldID, id), + sqlgraph.To(user.Table, user.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, repository.OwnerTable, repository.OwnerColumn), + ) + fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// Hooks returns the client hooks. +func (c *RepositoryClient) Hooks() []Hook { + hooks := c.hooks.Repository + return append(hooks[:len(hooks):len(hooks)], repository.Hooks[:]...) +} + +// Interceptors returns the client interceptors. +func (c *RepositoryClient) Interceptors() []Interceptor { + return c.inters.Repository +} + +func (c *RepositoryClient) mutate(ctx context.Context, m *RepositoryMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&RepositoryCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&RepositoryUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&RepositoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&RepositoryDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown Repository mutation op: %q", m.Op()) + } +} + // TagClient is a client for the Tag schema. type TagClient struct { config @@ -2008,6 +2182,22 @@ func (c *TomeClient) QueryUploader(t *Tome) *UserQuery { return query } +// QueryRepository queries the repository edge of a Tome. +func (c *TomeClient) QueryRepository(t *Tome) *RepositoryQuery { + query := (&RepositoryClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := t.ID + step := sqlgraph.NewStep( + sqlgraph.From(tome.Table, tome.FieldID, id), + sqlgraph.To(repository.Table, repository.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, tome.RepositoryTable, tome.RepositoryColumn), + ) + fromV = sqlgraph.Neighbors(t.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *TomeClient) Hooks() []Hook { hooks := c.hooks.Tome @@ -2186,11 +2376,11 @@ func (c *UserClient) mutate(ctx context.Context, m *UserMutation) (Value, error) // hooks and interceptors per client, for fast access. type ( hooks struct { - Beacon, File, Host, HostCredential, HostFile, HostProcess, Quest, Tag, Task, - Tome, User []ent.Hook + Beacon, File, Host, HostCredential, HostFile, HostProcess, Quest, Repository, + Tag, Task, Tome, User []ent.Hook } inters struct { - Beacon, File, Host, HostCredential, HostFile, HostProcess, Quest, Tag, Task, - Tome, User []ent.Interceptor + Beacon, File, Host, HostCredential, HostFile, HostProcess, Quest, Repository, + Tag, Task, Tome, User []ent.Interceptor } ) diff --git a/tavern/internal/ent/ent.go b/tavern/internal/ent/ent.go index 0074a889c..7540701b9 100644 --- a/tavern/internal/ent/ent.go +++ b/tavern/internal/ent/ent.go @@ -19,6 +19,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -90,6 +91,7 @@ func checkColumn(table, column string) error { hostfile.Table: hostfile.ValidColumn, hostprocess.Table: hostprocess.ValidColumn, quest.Table: quest.ValidColumn, + repository.Table: repository.ValidColumn, tag.Table: tag.ValidColumn, task.Table: task.ValidColumn, tome.Table: tome.ValidColumn, diff --git a/tavern/internal/ent/gql_collection.go b/tavern/internal/ent/gql_collection.go index ec69555a0..dfc4b6d53 100644 --- a/tavern/internal/ent/gql_collection.go +++ b/tavern/internal/ent/gql_collection.go @@ -15,6 +15,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -1045,6 +1046,138 @@ func newQuestPaginateArgs(rv map[string]any) *questPaginateArgs { return args } +// CollectFields tells the query-builder to eagerly load connected nodes by resolver context. +func (r *RepositoryQuery) CollectFields(ctx context.Context, satisfies ...string) (*RepositoryQuery, error) { + fc := graphql.GetFieldContext(ctx) + if fc == nil { + return r, nil + } + if err := r.collectField(ctx, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { + return nil, err + } + return r, nil +} + +func (r *RepositoryQuery) collectField(ctx context.Context, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { + path = append([]string(nil), path...) + var ( + unknownSeen bool + fieldSeen = make(map[string]struct{}, len(repository.Columns)) + selectedFields = []string{repository.FieldID} + ) + for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { + switch field.Name { + case "tomes": + var ( + alias = field.Alias + path = append(path, alias) + query = (&TomeClient{config: r.config}).Query() + ) + if err := query.collectField(ctx, opCtx, field, path, satisfies...); err != nil { + return err + } + r.WithNamedTomes(alias, func(wq *TomeQuery) { + *wq = *query + }) + case "owner": + var ( + alias = field.Alias + path = append(path, alias) + query = (&UserClient{config: r.config}).Query() + ) + if err := query.collectField(ctx, opCtx, field, path, satisfies...); err != nil { + return err + } + r.withOwner = query + case "createdAt": + if _, ok := fieldSeen[repository.FieldCreatedAt]; !ok { + selectedFields = append(selectedFields, repository.FieldCreatedAt) + fieldSeen[repository.FieldCreatedAt] = struct{}{} + } + case "lastModifiedAt": + if _, ok := fieldSeen[repository.FieldLastModifiedAt]; !ok { + selectedFields = append(selectedFields, repository.FieldLastModifiedAt) + fieldSeen[repository.FieldLastModifiedAt] = struct{}{} + } + case "url": + if _, ok := fieldSeen[repository.FieldURL]; !ok { + selectedFields = append(selectedFields, repository.FieldURL) + fieldSeen[repository.FieldURL] = struct{}{} + } + case "publicKey": + if _, ok := fieldSeen[repository.FieldPublicKey]; !ok { + selectedFields = append(selectedFields, repository.FieldPublicKey) + fieldSeen[repository.FieldPublicKey] = struct{}{} + } + case "id": + case "__typename": + default: + unknownSeen = true + } + } + if !unknownSeen { + r.Select(selectedFields...) + } + return nil +} + +type repositoryPaginateArgs struct { + first, last *int + after, before *Cursor + opts []RepositoryPaginateOption +} + +func newRepositoryPaginateArgs(rv map[string]any) *repositoryPaginateArgs { + args := &repositoryPaginateArgs{} + if rv == nil { + return args + } + if v := rv[firstField]; v != nil { + args.first = v.(*int) + } + if v := rv[lastField]; v != nil { + args.last = v.(*int) + } + if v := rv[afterField]; v != nil { + args.after = v.(*Cursor) + } + if v := rv[beforeField]; v != nil { + args.before = v.(*Cursor) + } + if v, ok := rv[orderByField]; ok { + switch v := v.(type) { + case []*RepositoryOrder: + args.opts = append(args.opts, WithRepositoryOrder(v)) + case []any: + var orders []*RepositoryOrder + for i := range v { + mv, ok := v[i].(map[string]any) + if !ok { + continue + } + var ( + err1, err2 error + order = &RepositoryOrder{Field: &RepositoryOrderField{}, Direction: entgql.OrderDirectionAsc} + ) + if d, ok := mv[directionField]; ok { + err1 = order.Direction.UnmarshalGQL(d) + } + if f, ok := mv[fieldField]; ok { + err2 = order.Field.UnmarshalGQL(f) + } + if err1 == nil && err2 == nil { + orders = append(orders, order) + } + } + args.opts = append(args.opts, WithRepositoryOrder(orders)) + } + } + if v, ok := rv[whereField].(*RepositoryWhereInput); ok { + args.opts = append(args.opts, WithRepositoryFilter(v.Filter)) + } + return args +} + // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (t *TagQuery) CollectFields(ctx context.Context, satisfies ...string) (*TagQuery, error) { fc := graphql.GetFieldContext(ctx) @@ -1380,6 +1513,16 @@ func (t *TomeQuery) collectField(ctx context.Context, opCtx *graphql.OperationCo return err } t.withUploader = query + case "repository": + var ( + alias = field.Alias + path = append(path, alias) + query = (&RepositoryClient{config: t.config}).Query() + ) + if err := query.collectField(ctx, opCtx, field, path, satisfies...); err != nil { + return err + } + t.withRepository = query case "createdAt": if _, ok := fieldSeen[tome.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, tome.FieldCreatedAt) diff --git a/tavern/internal/ent/gql_edge.go b/tavern/internal/ent/gql_edge.go index 7ce11df1e..b92c4ca5d 100644 --- a/tavern/internal/ent/gql_edge.go +++ b/tavern/internal/ent/gql_edge.go @@ -184,6 +184,26 @@ func (q *Quest) Creator(ctx context.Context) (*User, error) { return result, MaskNotFound(err) } +func (r *Repository) Tomes(ctx context.Context) (result []*Tome, err error) { + if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { + result, err = r.NamedTomes(graphql.GetFieldContext(ctx).Field.Alias) + } else { + result, err = r.Edges.TomesOrErr() + } + if IsNotLoaded(err) { + result, err = r.QueryTomes().All(ctx) + } + return result, err +} + +func (r *Repository) Owner(ctx context.Context) (*User, error) { + result, err := r.Edges.OwnerOrErr() + if IsNotLoaded(err) { + result, err = r.QueryOwner().Only(ctx) + } + return result, MaskNotFound(err) +} + func (t *Tag) Hosts(ctx context.Context) (result []*Host, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = t.NamedHosts(graphql.GetFieldContext(ctx).Field.Alias) @@ -268,6 +288,14 @@ func (t *Tome) Uploader(ctx context.Context) (*User, error) { return result, MaskNotFound(err) } +func (t *Tome) Repository(ctx context.Context) (*Repository, error) { + result, err := t.Edges.RepositoryOrErr() + if IsNotLoaded(err) { + result, err = t.QueryRepository().Only(ctx) + } + return result, MaskNotFound(err) +} + func (u *User) Tomes(ctx context.Context) (result []*Tome, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = u.NamedTomes(graphql.GetFieldContext(ctx).Field.Alias) diff --git a/tavern/internal/ent/gql_mutation_input.go b/tavern/internal/ent/gql_mutation_input.go index ab87ac40e..b44c0fdf4 100644 --- a/tavern/internal/ent/gql_mutation_input.go +++ b/tavern/internal/ent/gql_mutation_input.go @@ -151,6 +151,22 @@ func (c *QuestCreate) SetInput(i CreateQuestInput) *QuestCreate { return c } +// CreateRepositoryInput represents a mutation input for creating repositories. +type CreateRepositoryInput struct { + URL string +} + +// Mutate applies the CreateRepositoryInput on the RepositoryMutation builder. +func (i *CreateRepositoryInput) Mutate(m *RepositoryMutation) { + m.SetURL(i.URL) +} + +// SetInput applies the change-set in the CreateRepositoryInput on the RepositoryCreate builder. +func (c *RepositoryCreate) SetInput(i CreateRepositoryInput) *RepositoryCreate { + i.Mutate(c.Mutation()) + return c +} + // CreateTagInput represents a mutation input for creating tags. type CreateTagInput struct { Name string diff --git a/tavern/internal/ent/gql_node.go b/tavern/internal/ent/gql_node.go index 416bef993..b30938469 100644 --- a/tavern/internal/ent/gql_node.go +++ b/tavern/internal/ent/gql_node.go @@ -22,6 +22,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -54,6 +55,9 @@ func (n *HostProcess) IsNode() {} // IsNode implements the Node interface check for GQLGen. func (n *Quest) IsNode() {} +// IsNode implements the Node interface check for GQLGen. +func (n *Repository) IsNode() {} + // IsNode implements the Node interface check for GQLGen. func (n *Tag) IsNode() {} @@ -208,6 +212,18 @@ func (c *Client) noder(ctx context.Context, table string, id int) (Noder, error) return nil, err } return n, nil + case repository.Table: + query := c.Repository.Query(). + Where(repository.ID(id)) + query, err := query.CollectFields(ctx, "Repository") + if err != nil { + return nil, err + } + n, err := query.Only(ctx) + if err != nil { + return nil, err + } + return n, nil case tag.Table: query := c.Tag.Query(). Where(tag.ID(id)) @@ -441,6 +457,22 @@ func (c *Client) noders(ctx context.Context, table string, ids []int) ([]Noder, *noder = node } } + case repository.Table: + query := c.Repository.Query(). + Where(repository.IDIn(ids...)) + query, err := query.CollectFields(ctx, "Repository") + if err != nil { + return nil, err + } + nodes, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, node := range nodes { + for _, noder := range idmap[node.ID] { + *noder = node + } + } case tag.Table: query := c.Tag.Query(). Where(tag.IDIn(ids...)) diff --git a/tavern/internal/ent/gql_pagination.go b/tavern/internal/ent/gql_pagination.go index e8d65b9c8..73d239e22 100644 --- a/tavern/internal/ent/gql_pagination.go +++ b/tavern/internal/ent/gql_pagination.go @@ -22,6 +22,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -2501,6 +2502,353 @@ func (q *Quest) ToEdge(order *QuestOrder) *QuestEdge { } } +// RepositoryEdge is the edge representation of Repository. +type RepositoryEdge struct { + Node *Repository `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// RepositoryConnection is the connection containing edges to Repository. +type RepositoryConnection struct { + Edges []*RepositoryEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + +func (c *RepositoryConnection) build(nodes []*Repository, pager *repositoryPager, after *Cursor, first *int, before *Cursor, last *int) { + c.PageInfo.HasNextPage = before != nil + c.PageInfo.HasPreviousPage = after != nil + if first != nil && *first+1 == len(nodes) { + c.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && *last+1 == len(nodes) { + c.PageInfo.HasPreviousPage = true + nodes = nodes[:len(nodes)-1] + } + var nodeAt func(int) *Repository + if last != nil { + n := len(nodes) - 1 + nodeAt = func(i int) *Repository { + return nodes[n-i] + } + } else { + nodeAt = func(i int) *Repository { + return nodes[i] + } + } + c.Edges = make([]*RepositoryEdge, len(nodes)) + for i := range nodes { + node := nodeAt(i) + c.Edges[i] = &RepositoryEdge{ + Node: node, + Cursor: pager.toCursor(node), + } + } + if l := len(c.Edges); l > 0 { + c.PageInfo.StartCursor = &c.Edges[0].Cursor + c.PageInfo.EndCursor = &c.Edges[l-1].Cursor + } + if c.TotalCount == 0 { + c.TotalCount = len(nodes) + } +} + +// RepositoryPaginateOption enables pagination customization. +type RepositoryPaginateOption func(*repositoryPager) error + +// WithRepositoryOrder configures pagination ordering. +func WithRepositoryOrder(order []*RepositoryOrder) RepositoryPaginateOption { + return func(pager *repositoryPager) error { + for _, o := range order { + if err := o.Direction.Validate(); err != nil { + return err + } + } + pager.order = append(pager.order, order...) + return nil + } +} + +// WithRepositoryFilter configures pagination filter. +func WithRepositoryFilter(filter func(*RepositoryQuery) (*RepositoryQuery, error)) RepositoryPaginateOption { + return func(pager *repositoryPager) error { + if filter == nil { + return errors.New("RepositoryQuery filter cannot be nil") + } + pager.filter = filter + return nil + } +} + +type repositoryPager struct { + reverse bool + order []*RepositoryOrder + filter func(*RepositoryQuery) (*RepositoryQuery, error) +} + +func newRepositoryPager(opts []RepositoryPaginateOption, reverse bool) (*repositoryPager, error) { + pager := &repositoryPager{reverse: reverse} + for _, opt := range opts { + if err := opt(pager); err != nil { + return nil, err + } + } + for i, o := range pager.order { + if i > 0 && o.Field == pager.order[i-1].Field { + return nil, fmt.Errorf("duplicate order direction %q", o.Direction) + } + } + return pager, nil +} + +func (p *repositoryPager) applyFilter(query *RepositoryQuery) (*RepositoryQuery, error) { + if p.filter != nil { + return p.filter(query) + } + return query, nil +} + +func (p *repositoryPager) toCursor(r *Repository) Cursor { + cs := make([]any, 0, len(p.order)) + for _, o := range p.order { + cs = append(cs, o.Field.toCursor(r).Value) + } + return Cursor{ID: r.ID, Value: cs} +} + +func (p *repositoryPager) applyCursors(query *RepositoryQuery, after, before *Cursor) (*RepositoryQuery, error) { + idDirection := entgql.OrderDirectionAsc + if p.reverse { + idDirection = entgql.OrderDirectionDesc + } + fields, directions := make([]string, 0, len(p.order)), make([]OrderDirection, 0, len(p.order)) + for _, o := range p.order { + fields = append(fields, o.Field.column) + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + directions = append(directions, direction) + } + predicates, err := entgql.MultiCursorsPredicate(after, before, &entgql.MultiCursorsOptions{ + FieldID: DefaultRepositoryOrder.Field.column, + DirectionID: idDirection, + Fields: fields, + Directions: directions, + }) + if err != nil { + return nil, err + } + for _, predicate := range predicates { + query = query.Where(predicate) + } + return query, nil +} + +func (p *repositoryPager) applyOrder(query *RepositoryQuery) *RepositoryQuery { + var defaultOrdered bool + for _, o := range p.order { + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(o.Field.toTerm(direction.OrderTermOption())) + if o.Field.column == DefaultRepositoryOrder.Field.column { + defaultOrdered = true + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(o.Field.column) + } + } + if !defaultOrdered { + direction := entgql.OrderDirectionAsc + if p.reverse { + direction = direction.Reverse() + } + query = query.Order(DefaultRepositoryOrder.Field.toTerm(direction.OrderTermOption())) + } + return query +} + +func (p *repositoryPager) orderExpr(query *RepositoryQuery) sql.Querier { + if len(query.ctx.Fields) > 0 { + for _, o := range p.order { + query.ctx.AppendFieldOnce(o.Field.column) + } + } + return sql.ExprFunc(func(b *sql.Builder) { + for _, o := range p.order { + direction := o.Direction + if p.reverse { + direction = direction.Reverse() + } + b.Ident(o.Field.column).Pad().WriteString(string(direction)) + b.Comma() + } + direction := entgql.OrderDirectionAsc + if p.reverse { + direction = direction.Reverse() + } + b.Ident(DefaultRepositoryOrder.Field.column).Pad().WriteString(string(direction)) + }) +} + +// Paginate executes the query and returns a relay based cursor connection to Repository. +func (r *RepositoryQuery) Paginate( + ctx context.Context, after *Cursor, first *int, + before *Cursor, last *int, opts ...RepositoryPaginateOption, +) (*RepositoryConnection, error) { + if err := validateFirstLast(first, last); err != nil { + return nil, err + } + pager, err := newRepositoryPager(opts, last != nil) + if err != nil { + return nil, err + } + if r, err = pager.applyFilter(r); err != nil { + return nil, err + } + conn := &RepositoryConnection{Edges: []*RepositoryEdge{}} + ignoredEdges := !hasCollectedField(ctx, edgesField) + if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { + hasPagination := after != nil || first != nil || before != nil || last != nil + if hasPagination || ignoredEdges { + if conn.TotalCount, err = r.Clone().Count(ctx); err != nil { + return nil, err + } + conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 + conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 + } + } + if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { + return conn, nil + } + if r, err = pager.applyCursors(r, after, before); err != nil { + return nil, err + } + if limit := paginateLimit(first, last); limit != 0 { + r.Limit(limit) + } + if field := collectedField(ctx, edgesField, nodeField); field != nil { + if err := r.collectField(ctx, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { + return nil, err + } + } + r = pager.applyOrder(r) + nodes, err := r.All(ctx) + if err != nil { + return nil, err + } + conn.build(nodes, pager, after, first, before, last) + return conn, nil +} + +var ( + // RepositoryOrderFieldCreatedAt orders Repository by created_at. + RepositoryOrderFieldCreatedAt = &RepositoryOrderField{ + Value: func(r *Repository) (ent.Value, error) { + return r.CreatedAt, nil + }, + column: repository.FieldCreatedAt, + toTerm: repository.ByCreatedAt, + toCursor: func(r *Repository) Cursor { + return Cursor{ + ID: r.ID, + Value: r.CreatedAt, + } + }, + } + // RepositoryOrderFieldLastModifiedAt orders Repository by last_modified_at. + RepositoryOrderFieldLastModifiedAt = &RepositoryOrderField{ + Value: func(r *Repository) (ent.Value, error) { + return r.LastModifiedAt, nil + }, + column: repository.FieldLastModifiedAt, + toTerm: repository.ByLastModifiedAt, + toCursor: func(r *Repository) Cursor { + return Cursor{ + ID: r.ID, + Value: r.LastModifiedAt, + } + }, + } +) + +// String implement fmt.Stringer interface. +func (f RepositoryOrderField) String() string { + var str string + switch f.column { + case RepositoryOrderFieldCreatedAt.column: + str = "CREATED_AT" + case RepositoryOrderFieldLastModifiedAt.column: + str = "LAST_MODIFIED_AT" + } + return str +} + +// MarshalGQL implements graphql.Marshaler interface. +func (f RepositoryOrderField) MarshalGQL(w io.Writer) { + io.WriteString(w, strconv.Quote(f.String())) +} + +// UnmarshalGQL implements graphql.Unmarshaler interface. +func (f *RepositoryOrderField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("RepositoryOrderField %T must be a string", v) + } + switch str { + case "CREATED_AT": + *f = *RepositoryOrderFieldCreatedAt + case "LAST_MODIFIED_AT": + *f = *RepositoryOrderFieldLastModifiedAt + default: + return fmt.Errorf("%s is not a valid RepositoryOrderField", str) + } + return nil +} + +// RepositoryOrderField defines the ordering field of Repository. +type RepositoryOrderField struct { + // Value extracts the ordering value from the given Repository. + Value func(*Repository) (ent.Value, error) + column string // field or computed. + toTerm func(...sql.OrderTermOption) repository.OrderOption + toCursor func(*Repository) Cursor +} + +// RepositoryOrder defines the ordering of Repository. +type RepositoryOrder struct { + Direction OrderDirection `json:"direction"` + Field *RepositoryOrderField `json:"field"` +} + +// DefaultRepositoryOrder is the default ordering of Repository. +var DefaultRepositoryOrder = &RepositoryOrder{ + Direction: entgql.OrderDirectionAsc, + Field: &RepositoryOrderField{ + Value: func(r *Repository) (ent.Value, error) { + return r.ID, nil + }, + column: repository.FieldID, + toTerm: repository.ByID, + toCursor: func(r *Repository) Cursor { + return Cursor{ID: r.ID} + }, + }, +} + +// ToEdge converts Repository into RepositoryEdge. +func (r *Repository) ToEdge(order *RepositoryOrder) *RepositoryEdge { + if order == nil { + order = DefaultRepositoryOrder + } + return &RepositoryEdge{ + Node: r, + Cursor: order.Field.toCursor(r), + } +} + // TagEdge is the edge representation of Tag. type TagEdge struct { Node *Tag `json:"node"` diff --git a/tavern/internal/ent/gql_where_input.go b/tavern/internal/ent/gql_where_input.go index 37e7846d1..6d3134e9e 100644 --- a/tavern/internal/ent/gql_where_input.go +++ b/tavern/internal/ent/gql_where_input.go @@ -17,6 +17,7 @@ import ( "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/predicate" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -3479,6 +3480,350 @@ func (i *QuestWhereInput) P() (predicate.Quest, error) { } } +// RepositoryWhereInput represents a where input for filtering Repository queries. +type RepositoryWhereInput struct { + Predicates []predicate.Repository `json:"-"` + Not *RepositoryWhereInput `json:"not,omitempty"` + Or []*RepositoryWhereInput `json:"or,omitempty"` + And []*RepositoryWhereInput `json:"and,omitempty"` + + // "id" field predicates. + ID *int `json:"id,omitempty"` + IDNEQ *int `json:"idNEQ,omitempty"` + IDIn []int `json:"idIn,omitempty"` + IDNotIn []int `json:"idNotIn,omitempty"` + IDGT *int `json:"idGT,omitempty"` + IDGTE *int `json:"idGTE,omitempty"` + IDLT *int `json:"idLT,omitempty"` + IDLTE *int `json:"idLTE,omitempty"` + + // "created_at" field predicates. + CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` + CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` + CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` + CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` + CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` + CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` + CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` + + // "last_modified_at" field predicates. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAtNEQ *time.Time `json:"lastModifiedAtNEQ,omitempty"` + LastModifiedAtIn []time.Time `json:"lastModifiedAtIn,omitempty"` + LastModifiedAtNotIn []time.Time `json:"lastModifiedAtNotIn,omitempty"` + LastModifiedAtGT *time.Time `json:"lastModifiedAtGT,omitempty"` + LastModifiedAtGTE *time.Time `json:"lastModifiedAtGTE,omitempty"` + LastModifiedAtLT *time.Time `json:"lastModifiedAtLT,omitempty"` + LastModifiedAtLTE *time.Time `json:"lastModifiedAtLTE,omitempty"` + + // "url" field predicates. + URL *string `json:"url,omitempty"` + URLNEQ *string `json:"urlNEQ,omitempty"` + URLIn []string `json:"urlIn,omitempty"` + URLNotIn []string `json:"urlNotIn,omitempty"` + URLGT *string `json:"urlGT,omitempty"` + URLGTE *string `json:"urlGTE,omitempty"` + URLLT *string `json:"urlLT,omitempty"` + URLLTE *string `json:"urlLTE,omitempty"` + URLContains *string `json:"urlContains,omitempty"` + URLHasPrefix *string `json:"urlHasPrefix,omitempty"` + URLHasSuffix *string `json:"urlHasSuffix,omitempty"` + URLEqualFold *string `json:"urlEqualFold,omitempty"` + URLContainsFold *string `json:"urlContainsFold,omitempty"` + + // "public_key" field predicates. + PublicKey *string `json:"publicKey,omitempty"` + PublicKeyNEQ *string `json:"publicKeyNEQ,omitempty"` + PublicKeyIn []string `json:"publicKeyIn,omitempty"` + PublicKeyNotIn []string `json:"publicKeyNotIn,omitempty"` + PublicKeyGT *string `json:"publicKeyGT,omitempty"` + PublicKeyGTE *string `json:"publicKeyGTE,omitempty"` + PublicKeyLT *string `json:"publicKeyLT,omitempty"` + PublicKeyLTE *string `json:"publicKeyLTE,omitempty"` + PublicKeyContains *string `json:"publicKeyContains,omitempty"` + PublicKeyHasPrefix *string `json:"publicKeyHasPrefix,omitempty"` + PublicKeyHasSuffix *string `json:"publicKeyHasSuffix,omitempty"` + PublicKeyEqualFold *string `json:"publicKeyEqualFold,omitempty"` + PublicKeyContainsFold *string `json:"publicKeyContainsFold,omitempty"` + + // "tomes" edge predicates. + HasTomes *bool `json:"hasTomes,omitempty"` + HasTomesWith []*TomeWhereInput `json:"hasTomesWith,omitempty"` + + // "owner" edge predicates. + HasOwner *bool `json:"hasOwner,omitempty"` + HasOwnerWith []*UserWhereInput `json:"hasOwnerWith,omitempty"` +} + +// AddPredicates adds custom predicates to the where input to be used during the filtering phase. +func (i *RepositoryWhereInput) AddPredicates(predicates ...predicate.Repository) { + i.Predicates = append(i.Predicates, predicates...) +} + +// Filter applies the RepositoryWhereInput filter on the RepositoryQuery builder. +func (i *RepositoryWhereInput) Filter(q *RepositoryQuery) (*RepositoryQuery, error) { + if i == nil { + return q, nil + } + p, err := i.P() + if err != nil { + if err == ErrEmptyRepositoryWhereInput { + return q, nil + } + return nil, err + } + return q.Where(p), nil +} + +// ErrEmptyRepositoryWhereInput is returned in case the RepositoryWhereInput is empty. +var ErrEmptyRepositoryWhereInput = errors.New("ent: empty predicate RepositoryWhereInput") + +// P returns a predicate for filtering repositories. +// An error is returned if the input is empty or invalid. +func (i *RepositoryWhereInput) P() (predicate.Repository, error) { + var predicates []predicate.Repository + if i.Not != nil { + p, err := i.Not.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'not'", err) + } + predicates = append(predicates, repository.Not(p)) + } + switch n := len(i.Or); { + case n == 1: + p, err := i.Or[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + predicates = append(predicates, p) + case n > 1: + or := make([]predicate.Repository, 0, n) + for _, w := range i.Or { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'or'", err) + } + or = append(or, p) + } + predicates = append(predicates, repository.Or(or...)) + } + switch n := len(i.And); { + case n == 1: + p, err := i.And[0].P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + predicates = append(predicates, p) + case n > 1: + and := make([]predicate.Repository, 0, n) + for _, w := range i.And { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'and'", err) + } + and = append(and, p) + } + predicates = append(predicates, repository.And(and...)) + } + predicates = append(predicates, i.Predicates...) + if i.ID != nil { + predicates = append(predicates, repository.IDEQ(*i.ID)) + } + if i.IDNEQ != nil { + predicates = append(predicates, repository.IDNEQ(*i.IDNEQ)) + } + if len(i.IDIn) > 0 { + predicates = append(predicates, repository.IDIn(i.IDIn...)) + } + if len(i.IDNotIn) > 0 { + predicates = append(predicates, repository.IDNotIn(i.IDNotIn...)) + } + if i.IDGT != nil { + predicates = append(predicates, repository.IDGT(*i.IDGT)) + } + if i.IDGTE != nil { + predicates = append(predicates, repository.IDGTE(*i.IDGTE)) + } + if i.IDLT != nil { + predicates = append(predicates, repository.IDLT(*i.IDLT)) + } + if i.IDLTE != nil { + predicates = append(predicates, repository.IDLTE(*i.IDLTE)) + } + if i.CreatedAt != nil { + predicates = append(predicates, repository.CreatedAtEQ(*i.CreatedAt)) + } + if i.CreatedAtNEQ != nil { + predicates = append(predicates, repository.CreatedAtNEQ(*i.CreatedAtNEQ)) + } + if len(i.CreatedAtIn) > 0 { + predicates = append(predicates, repository.CreatedAtIn(i.CreatedAtIn...)) + } + if len(i.CreatedAtNotIn) > 0 { + predicates = append(predicates, repository.CreatedAtNotIn(i.CreatedAtNotIn...)) + } + if i.CreatedAtGT != nil { + predicates = append(predicates, repository.CreatedAtGT(*i.CreatedAtGT)) + } + if i.CreatedAtGTE != nil { + predicates = append(predicates, repository.CreatedAtGTE(*i.CreatedAtGTE)) + } + if i.CreatedAtLT != nil { + predicates = append(predicates, repository.CreatedAtLT(*i.CreatedAtLT)) + } + if i.CreatedAtLTE != nil { + predicates = append(predicates, repository.CreatedAtLTE(*i.CreatedAtLTE)) + } + if i.LastModifiedAt != nil { + predicates = append(predicates, repository.LastModifiedAtEQ(*i.LastModifiedAt)) + } + if i.LastModifiedAtNEQ != nil { + predicates = append(predicates, repository.LastModifiedAtNEQ(*i.LastModifiedAtNEQ)) + } + if len(i.LastModifiedAtIn) > 0 { + predicates = append(predicates, repository.LastModifiedAtIn(i.LastModifiedAtIn...)) + } + if len(i.LastModifiedAtNotIn) > 0 { + predicates = append(predicates, repository.LastModifiedAtNotIn(i.LastModifiedAtNotIn...)) + } + if i.LastModifiedAtGT != nil { + predicates = append(predicates, repository.LastModifiedAtGT(*i.LastModifiedAtGT)) + } + if i.LastModifiedAtGTE != nil { + predicates = append(predicates, repository.LastModifiedAtGTE(*i.LastModifiedAtGTE)) + } + if i.LastModifiedAtLT != nil { + predicates = append(predicates, repository.LastModifiedAtLT(*i.LastModifiedAtLT)) + } + if i.LastModifiedAtLTE != nil { + predicates = append(predicates, repository.LastModifiedAtLTE(*i.LastModifiedAtLTE)) + } + if i.URL != nil { + predicates = append(predicates, repository.URLEQ(*i.URL)) + } + if i.URLNEQ != nil { + predicates = append(predicates, repository.URLNEQ(*i.URLNEQ)) + } + if len(i.URLIn) > 0 { + predicates = append(predicates, repository.URLIn(i.URLIn...)) + } + if len(i.URLNotIn) > 0 { + predicates = append(predicates, repository.URLNotIn(i.URLNotIn...)) + } + if i.URLGT != nil { + predicates = append(predicates, repository.URLGT(*i.URLGT)) + } + if i.URLGTE != nil { + predicates = append(predicates, repository.URLGTE(*i.URLGTE)) + } + if i.URLLT != nil { + predicates = append(predicates, repository.URLLT(*i.URLLT)) + } + if i.URLLTE != nil { + predicates = append(predicates, repository.URLLTE(*i.URLLTE)) + } + if i.URLContains != nil { + predicates = append(predicates, repository.URLContains(*i.URLContains)) + } + if i.URLHasPrefix != nil { + predicates = append(predicates, repository.URLHasPrefix(*i.URLHasPrefix)) + } + if i.URLHasSuffix != nil { + predicates = append(predicates, repository.URLHasSuffix(*i.URLHasSuffix)) + } + if i.URLEqualFold != nil { + predicates = append(predicates, repository.URLEqualFold(*i.URLEqualFold)) + } + if i.URLContainsFold != nil { + predicates = append(predicates, repository.URLContainsFold(*i.URLContainsFold)) + } + if i.PublicKey != nil { + predicates = append(predicates, repository.PublicKeyEQ(*i.PublicKey)) + } + if i.PublicKeyNEQ != nil { + predicates = append(predicates, repository.PublicKeyNEQ(*i.PublicKeyNEQ)) + } + if len(i.PublicKeyIn) > 0 { + predicates = append(predicates, repository.PublicKeyIn(i.PublicKeyIn...)) + } + if len(i.PublicKeyNotIn) > 0 { + predicates = append(predicates, repository.PublicKeyNotIn(i.PublicKeyNotIn...)) + } + if i.PublicKeyGT != nil { + predicates = append(predicates, repository.PublicKeyGT(*i.PublicKeyGT)) + } + if i.PublicKeyGTE != nil { + predicates = append(predicates, repository.PublicKeyGTE(*i.PublicKeyGTE)) + } + if i.PublicKeyLT != nil { + predicates = append(predicates, repository.PublicKeyLT(*i.PublicKeyLT)) + } + if i.PublicKeyLTE != nil { + predicates = append(predicates, repository.PublicKeyLTE(*i.PublicKeyLTE)) + } + if i.PublicKeyContains != nil { + predicates = append(predicates, repository.PublicKeyContains(*i.PublicKeyContains)) + } + if i.PublicKeyHasPrefix != nil { + predicates = append(predicates, repository.PublicKeyHasPrefix(*i.PublicKeyHasPrefix)) + } + if i.PublicKeyHasSuffix != nil { + predicates = append(predicates, repository.PublicKeyHasSuffix(*i.PublicKeyHasSuffix)) + } + if i.PublicKeyEqualFold != nil { + predicates = append(predicates, repository.PublicKeyEqualFold(*i.PublicKeyEqualFold)) + } + if i.PublicKeyContainsFold != nil { + predicates = append(predicates, repository.PublicKeyContainsFold(*i.PublicKeyContainsFold)) + } + + if i.HasTomes != nil { + p := repository.HasTomes() + if !*i.HasTomes { + p = repository.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasTomesWith) > 0 { + with := make([]predicate.Tome, 0, len(i.HasTomesWith)) + for _, w := range i.HasTomesWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasTomesWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, repository.HasTomesWith(with...)) + } + if i.HasOwner != nil { + p := repository.HasOwner() + if !*i.HasOwner { + p = repository.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasOwnerWith) > 0 { + with := make([]predicate.User, 0, len(i.HasOwnerWith)) + for _, w := range i.HasOwnerWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasOwnerWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, repository.HasOwnerWith(with...)) + } + switch len(predicates) { + case 0: + return nil, ErrEmptyRepositoryWhereInput + case 1: + return predicates[0], nil + default: + return repository.And(predicates...), nil + } +} + // TagWhereInput represents a where input for filtering Tag queries. type TagWhereInput struct { Predicates []predicate.Tag `json:"-"` @@ -4416,6 +4761,10 @@ type TomeWhereInput struct { // "uploader" edge predicates. HasUploader *bool `json:"hasUploader,omitempty"` HasUploaderWith []*UserWhereInput `json:"hasUploaderWith,omitempty"` + + // "repository" edge predicates. + HasRepository *bool `json:"hasRepository,omitempty"` + HasRepositoryWith []*RepositoryWhereInput `json:"hasRepositoryWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -4823,6 +5172,24 @@ func (i *TomeWhereInput) P() (predicate.Tome, error) { } predicates = append(predicates, tome.HasUploaderWith(with...)) } + if i.HasRepository != nil { + p := tome.HasRepository() + if !*i.HasRepository { + p = tome.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasRepositoryWith) > 0 { + with := make([]predicate.Repository, 0, len(i.HasRepositoryWith)) + for _, w := range i.HasRepositoryWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasRepositoryWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, tome.HasRepositoryWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyTomeWhereInput diff --git a/tavern/internal/ent/hook/hook.go b/tavern/internal/ent/hook/hook.go index 750143dc8..fe4e45e5f 100644 --- a/tavern/internal/ent/hook/hook.go +++ b/tavern/internal/ent/hook/hook.go @@ -93,6 +93,18 @@ func (f QuestFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.QuestMutation", m) } +// The RepositoryFunc type is an adapter to allow the use of ordinary +// function as Repository mutator. +type RepositoryFunc func(context.Context, *ent.RepositoryMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f RepositoryFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.RepositoryMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.RepositoryMutation", m) +} + // The TagFunc type is an adapter to allow the use of ordinary // function as Tag mutator. type TagFunc func(context.Context, *ent.TagMutation) (ent.Value, error) diff --git a/tavern/internal/ent/migrate/schema.go b/tavern/internal/ent/migrate/schema.go index e9255d501..1858e7442 100644 --- a/tavern/internal/ent/migrate/schema.go +++ b/tavern/internal/ent/migrate/schema.go @@ -3,6 +3,7 @@ package migrate import ( + "entgo.io/ent/dialect/entsql" "entgo.io/ent/dialect/sql/schema" "entgo.io/ent/schema/field" ) @@ -222,6 +223,30 @@ var ( }, }, } + // RepositoriesColumns holds the columns for the "repositories" table. + RepositoriesColumns = []*schema.Column{ + {Name: "id", Type: field.TypeInt, Increment: true}, + {Name: "created_at", Type: field.TypeTime}, + {Name: "last_modified_at", Type: field.TypeTime}, + {Name: "url", Type: field.TypeString, Unique: true}, + {Name: "public_key", Type: field.TypeString}, + {Name: "private_key", Type: field.TypeString}, + {Name: "repository_owner", Type: field.TypeInt, Nullable: true}, + } + // RepositoriesTable holds the schema information for the "repositories" table. + RepositoriesTable = &schema.Table{ + Name: "repositories", + Columns: RepositoriesColumns, + PrimaryKey: []*schema.Column{RepositoriesColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "repositories_users_owner", + Columns: []*schema.Column{RepositoriesColumns[6]}, + RefColumns: []*schema.Column{UsersColumns[0]}, + OnDelete: schema.SetNull, + }, + }, + } // TagsColumns holds the columns for the "tags" table. TagsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -282,6 +307,7 @@ var ( {Name: "hash", Type: field.TypeString, Size: 100}, {Name: "eldritch", Type: field.TypeString, SchemaType: map[string]string{"mysql": "LONGTEXT"}}, {Name: "tome_uploader", Type: field.TypeInt, Nullable: true}, + {Name: "tome_repository", Type: field.TypeInt, Nullable: true}, } // TomesTable holds the schema information for the "tomes" table. TomesTable = &schema.Table{ @@ -295,6 +321,12 @@ var ( RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, + { + Symbol: "tomes_repositories_repository", + Columns: []*schema.Column{TomesColumns[12]}, + RefColumns: []*schema.Column{RepositoriesColumns[0]}, + OnDelete: schema.SetNull, + }, }, } // UsersColumns holds the columns for the "users" table. @@ -373,6 +405,7 @@ var ( HostFilesTable, HostProcessesTable, QuestsTable, + RepositoriesTable, TagsTable, TasksTable, TomesTable, @@ -395,9 +428,14 @@ func init() { QuestsTable.ForeignKeys[0].RefTable = TomesTable QuestsTable.ForeignKeys[1].RefTable = FilesTable QuestsTable.ForeignKeys[2].RefTable = UsersTable + RepositoriesTable.ForeignKeys[0].RefTable = UsersTable + RepositoriesTable.Annotation = &entsql.Annotation{ + Table: "repositories", + } TasksTable.ForeignKeys[0].RefTable = QuestsTable TasksTable.ForeignKeys[1].RefTable = BeaconsTable TomesTable.ForeignKeys[0].RefTable = UsersTable + TomesTable.ForeignKeys[1].RefTable = RepositoriesTable HostTagsTable.ForeignKeys[0].RefTable = HostsTable HostTagsTable.ForeignKeys[1].RefTable = TagsTable TomeFilesTable.ForeignKeys[0].RefTable = TomesTable diff --git a/tavern/internal/ent/mutation.go b/tavern/internal/ent/mutation.go index 36cd03ab6..d03c02172 100644 --- a/tavern/internal/ent/mutation.go +++ b/tavern/internal/ent/mutation.go @@ -21,6 +21,7 @@ import ( "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/predicate" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" "realm.pub/tavern/internal/ent/tome" @@ -43,6 +44,7 @@ const ( TypeHostFile = "HostFile" TypeHostProcess = "HostProcess" TypeQuest = "Quest" + TypeRepository = "Repository" TypeTag = "Tag" TypeTask = "Task" TypeTome = "Tome" @@ -6487,6 +6489,700 @@ func (m *QuestMutation) ResetEdge(name string) error { return fmt.Errorf("unknown Quest edge %s", name) } +// RepositoryMutation represents an operation that mutates the Repository nodes in the graph. +type RepositoryMutation struct { + config + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + url *string + public_key *string + private_key *string + clearedFields map[string]struct{} + tomes map[int]struct{} + removedtomes map[int]struct{} + clearedtomes bool + owner *int + clearedowner bool + done bool + oldValue func(context.Context) (*Repository, error) + predicates []predicate.Repository +} + +var _ ent.Mutation = (*RepositoryMutation)(nil) + +// repositoryOption allows management of the mutation configuration using functional options. +type repositoryOption func(*RepositoryMutation) + +// newRepositoryMutation creates new mutation for the Repository entity. +func newRepositoryMutation(c config, op Op, opts ...repositoryOption) *RepositoryMutation { + m := &RepositoryMutation{ + config: c, + op: op, + typ: TypeRepository, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withRepositoryID sets the ID field of the mutation. +func withRepositoryID(id int) repositoryOption { + return func(m *RepositoryMutation) { + var ( + err error + once sync.Once + value *Repository + ) + m.oldValue = func(ctx context.Context) (*Repository, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Repository.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withRepository sets the old Repository of the mutation. +func withRepository(node *Repository) repositoryOption { + return func(m *RepositoryMutation) { + m.oldValue = func(context.Context) (*Repository, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m RepositoryMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m RepositoryMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *RepositoryMutation) ID() (id int, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *RepositoryMutation) IDs(ctx context.Context) ([]int, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []int{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().Repository.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetCreatedAt sets the "created_at" field. +func (m *RepositoryMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *RepositoryMutation) CreatedAt() (r time.Time, exists bool) { + v := m.created_at + if v == nil { + return + } + return *v, true +} + +// OldCreatedAt returns the old "created_at" field's value of the Repository entity. +// If the Repository object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *RepositoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + } + return oldValue.CreatedAt, nil +} + +// ResetCreatedAt resets all changes to the "created_at" field. +func (m *RepositoryMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (m *RepositoryMutation) SetLastModifiedAt(t time.Time) { + m.last_modified_at = &t +} + +// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. +func (m *RepositoryMutation) LastModifiedAt() (r time.Time, exists bool) { + v := m.last_modified_at + if v == nil { + return + } + return *v, true +} + +// OldLastModifiedAt returns the old "last_modified_at" field's value of the Repository entity. +// If the Repository object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *RepositoryMutation) OldLastModifiedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLastModifiedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLastModifiedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLastModifiedAt: %w", err) + } + return oldValue.LastModifiedAt, nil +} + +// ResetLastModifiedAt resets all changes to the "last_modified_at" field. +func (m *RepositoryMutation) ResetLastModifiedAt() { + m.last_modified_at = nil +} + +// SetURL sets the "url" field. +func (m *RepositoryMutation) SetURL(s string) { + m.url = &s +} + +// URL returns the value of the "url" field in the mutation. +func (m *RepositoryMutation) URL() (r string, exists bool) { + v := m.url + if v == nil { + return + } + return *v, true +} + +// OldURL returns the old "url" field's value of the Repository entity. +// If the Repository object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *RepositoryMutation) OldURL(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldURL is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldURL requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldURL: %w", err) + } + return oldValue.URL, nil +} + +// ResetURL resets all changes to the "url" field. +func (m *RepositoryMutation) ResetURL() { + m.url = nil +} + +// SetPublicKey sets the "public_key" field. +func (m *RepositoryMutation) SetPublicKey(s string) { + m.public_key = &s +} + +// PublicKey returns the value of the "public_key" field in the mutation. +func (m *RepositoryMutation) PublicKey() (r string, exists bool) { + v := m.public_key + if v == nil { + return + } + return *v, true +} + +// OldPublicKey returns the old "public_key" field's value of the Repository entity. +// If the Repository object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *RepositoryMutation) OldPublicKey(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPublicKey is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPublicKey requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPublicKey: %w", err) + } + return oldValue.PublicKey, nil +} + +// ResetPublicKey resets all changes to the "public_key" field. +func (m *RepositoryMutation) ResetPublicKey() { + m.public_key = nil +} + +// SetPrivateKey sets the "private_key" field. +func (m *RepositoryMutation) SetPrivateKey(s string) { + m.private_key = &s +} + +// PrivateKey returns the value of the "private_key" field in the mutation. +func (m *RepositoryMutation) PrivateKey() (r string, exists bool) { + v := m.private_key + if v == nil { + return + } + return *v, true +} + +// OldPrivateKey returns the old "private_key" field's value of the Repository entity. +// If the Repository object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *RepositoryMutation) OldPrivateKey(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPrivateKey is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPrivateKey requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPrivateKey: %w", err) + } + return oldValue.PrivateKey, nil +} + +// ResetPrivateKey resets all changes to the "private_key" field. +func (m *RepositoryMutation) ResetPrivateKey() { + m.private_key = nil +} + +// AddTomeIDs adds the "tomes" edge to the Tome entity by ids. +func (m *RepositoryMutation) AddTomeIDs(ids ...int) { + if m.tomes == nil { + m.tomes = make(map[int]struct{}) + } + for i := range ids { + m.tomes[ids[i]] = struct{}{} + } +} + +// ClearTomes clears the "tomes" edge to the Tome entity. +func (m *RepositoryMutation) ClearTomes() { + m.clearedtomes = true +} + +// TomesCleared reports if the "tomes" edge to the Tome entity was cleared. +func (m *RepositoryMutation) TomesCleared() bool { + return m.clearedtomes +} + +// RemoveTomeIDs removes the "tomes" edge to the Tome entity by IDs. +func (m *RepositoryMutation) RemoveTomeIDs(ids ...int) { + if m.removedtomes == nil { + m.removedtomes = make(map[int]struct{}) + } + for i := range ids { + delete(m.tomes, ids[i]) + m.removedtomes[ids[i]] = struct{}{} + } +} + +// RemovedTomes returns the removed IDs of the "tomes" edge to the Tome entity. +func (m *RepositoryMutation) RemovedTomesIDs() (ids []int) { + for id := range m.removedtomes { + ids = append(ids, id) + } + return +} + +// TomesIDs returns the "tomes" edge IDs in the mutation. +func (m *RepositoryMutation) TomesIDs() (ids []int) { + for id := range m.tomes { + ids = append(ids, id) + } + return +} + +// ResetTomes resets all changes to the "tomes" edge. +func (m *RepositoryMutation) ResetTomes() { + m.tomes = nil + m.clearedtomes = false + m.removedtomes = nil +} + +// SetOwnerID sets the "owner" edge to the User entity by id. +func (m *RepositoryMutation) SetOwnerID(id int) { + m.owner = &id +} + +// ClearOwner clears the "owner" edge to the User entity. +func (m *RepositoryMutation) ClearOwner() { + m.clearedowner = true +} + +// OwnerCleared reports if the "owner" edge to the User entity was cleared. +func (m *RepositoryMutation) OwnerCleared() bool { + return m.clearedowner +} + +// OwnerID returns the "owner" edge ID in the mutation. +func (m *RepositoryMutation) OwnerID() (id int, exists bool) { + if m.owner != nil { + return *m.owner, true + } + return +} + +// OwnerIDs returns the "owner" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// OwnerID instead. It exists only for internal usage by the builders. +func (m *RepositoryMutation) OwnerIDs() (ids []int) { + if id := m.owner; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetOwner resets all changes to the "owner" edge. +func (m *RepositoryMutation) ResetOwner() { + m.owner = nil + m.clearedowner = false +} + +// Where appends a list predicates to the RepositoryMutation builder. +func (m *RepositoryMutation) Where(ps ...predicate.Repository) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the RepositoryMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *RepositoryMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Repository, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *RepositoryMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *RepositoryMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (Repository). +func (m *RepositoryMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *RepositoryMutation) Fields() []string { + fields := make([]string, 0, 5) + if m.created_at != nil { + fields = append(fields, repository.FieldCreatedAt) + } + if m.last_modified_at != nil { + fields = append(fields, repository.FieldLastModifiedAt) + } + if m.url != nil { + fields = append(fields, repository.FieldURL) + } + if m.public_key != nil { + fields = append(fields, repository.FieldPublicKey) + } + if m.private_key != nil { + fields = append(fields, repository.FieldPrivateKey) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *RepositoryMutation) Field(name string) (ent.Value, bool) { + switch name { + case repository.FieldCreatedAt: + return m.CreatedAt() + case repository.FieldLastModifiedAt: + return m.LastModifiedAt() + case repository.FieldURL: + return m.URL() + case repository.FieldPublicKey: + return m.PublicKey() + case repository.FieldPrivateKey: + return m.PrivateKey() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *RepositoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case repository.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case repository.FieldLastModifiedAt: + return m.OldLastModifiedAt(ctx) + case repository.FieldURL: + return m.OldURL(ctx) + case repository.FieldPublicKey: + return m.OldPublicKey(ctx) + case repository.FieldPrivateKey: + return m.OldPrivateKey(ctx) + } + return nil, fmt.Errorf("unknown Repository field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *RepositoryMutation) SetField(name string, value ent.Value) error { + switch name { + case repository.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case repository.FieldLastModifiedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLastModifiedAt(v) + return nil + case repository.FieldURL: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetURL(v) + return nil + case repository.FieldPublicKey: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPublicKey(v) + return nil + case repository.FieldPrivateKey: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPrivateKey(v) + return nil + } + return fmt.Errorf("unknown Repository field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *RepositoryMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *RepositoryMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *RepositoryMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown Repository numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *RepositoryMutation) ClearedFields() []string { + return nil +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *RepositoryMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *RepositoryMutation) ClearField(name string) error { + return fmt.Errorf("unknown Repository nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *RepositoryMutation) ResetField(name string) error { + switch name { + case repository.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case repository.FieldLastModifiedAt: + m.ResetLastModifiedAt() + return nil + case repository.FieldURL: + m.ResetURL() + return nil + case repository.FieldPublicKey: + m.ResetPublicKey() + return nil + case repository.FieldPrivateKey: + m.ResetPrivateKey() + return nil + } + return fmt.Errorf("unknown Repository field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *RepositoryMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.tomes != nil { + edges = append(edges, repository.EdgeTomes) + } + if m.owner != nil { + edges = append(edges, repository.EdgeOwner) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *RepositoryMutation) AddedIDs(name string) []ent.Value { + switch name { + case repository.EdgeTomes: + ids := make([]ent.Value, 0, len(m.tomes)) + for id := range m.tomes { + ids = append(ids, id) + } + return ids + case repository.EdgeOwner: + if id := m.owner; id != nil { + return []ent.Value{*id} + } + } + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *RepositoryMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + if m.removedtomes != nil { + edges = append(edges, repository.EdgeTomes) + } + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *RepositoryMutation) RemovedIDs(name string) []ent.Value { + switch name { + case repository.EdgeTomes: + ids := make([]ent.Value, 0, len(m.removedtomes)) + for id := range m.removedtomes { + ids = append(ids, id) + } + return ids + } + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *RepositoryMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedtomes { + edges = append(edges, repository.EdgeTomes) + } + if m.clearedowner { + edges = append(edges, repository.EdgeOwner) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *RepositoryMutation) EdgeCleared(name string) bool { + switch name { + case repository.EdgeTomes: + return m.clearedtomes + case repository.EdgeOwner: + return m.clearedowner + } + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *RepositoryMutation) ClearEdge(name string) error { + switch name { + case repository.EdgeOwner: + m.ClearOwner() + return nil + } + return fmt.Errorf("unknown Repository unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *RepositoryMutation) ResetEdge(name string) error { + switch name { + case repository.EdgeTomes: + m.ResetTomes() + return nil + case repository.EdgeOwner: + m.ResetOwner() + return nil + } + return fmt.Errorf("unknown Repository edge %s", name) +} + // TagMutation represents an operation that mutates the Tag nodes in the graph. type TagMutation struct { config @@ -8178,28 +8874,30 @@ func (m *TaskMutation) ResetEdge(name string) error { // TomeMutation represents an operation that mutates the Tome nodes in the graph. type TomeMutation struct { config - op Op - typ string - id *int - created_at *time.Time - last_modified_at *time.Time - name *string - description *string - author *string - support_model *tome.SupportModel - tactic *tome.Tactic - param_defs *string - hash *string - eldritch *string - clearedFields map[string]struct{} - files map[int]struct{} - removedfiles map[int]struct{} - clearedfiles bool - uploader *int - cleareduploader bool - done bool - oldValue func(context.Context) (*Tome, error) - predicates []predicate.Tome + op Op + typ string + id *int + created_at *time.Time + last_modified_at *time.Time + name *string + description *string + author *string + support_model *tome.SupportModel + tactic *tome.Tactic + param_defs *string + hash *string + eldritch *string + clearedFields map[string]struct{} + files map[int]struct{} + removedfiles map[int]struct{} + clearedfiles bool + uploader *int + cleareduploader bool + repository *int + clearedrepository bool + done bool + oldValue func(context.Context) (*Tome, error) + predicates []predicate.Tome } var _ ent.Mutation = (*TomeMutation)(nil) @@ -8766,6 +9464,45 @@ func (m *TomeMutation) ResetUploader() { m.cleareduploader = false } +// SetRepositoryID sets the "repository" edge to the Repository entity by id. +func (m *TomeMutation) SetRepositoryID(id int) { + m.repository = &id +} + +// ClearRepository clears the "repository" edge to the Repository entity. +func (m *TomeMutation) ClearRepository() { + m.clearedrepository = true +} + +// RepositoryCleared reports if the "repository" edge to the Repository entity was cleared. +func (m *TomeMutation) RepositoryCleared() bool { + return m.clearedrepository +} + +// RepositoryID returns the "repository" edge ID in the mutation. +func (m *TomeMutation) RepositoryID() (id int, exists bool) { + if m.repository != nil { + return *m.repository, true + } + return +} + +// RepositoryIDs returns the "repository" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// RepositoryID instead. It exists only for internal usage by the builders. +func (m *TomeMutation) RepositoryIDs() (ids []int) { + if id := m.repository; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetRepository resets all changes to the "repository" edge. +func (m *TomeMutation) ResetRepository() { + m.repository = nil + m.clearedrepository = false +} + // Where appends a list predicates to the TomeMutation builder. func (m *TomeMutation) Where(ps ...predicate.Tome) { m.predicates = append(m.predicates, ps...) @@ -9061,13 +9798,16 @@ func (m *TomeMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *TomeMutation) AddedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.files != nil { edges = append(edges, tome.EdgeFiles) } if m.uploader != nil { edges = append(edges, tome.EdgeUploader) } + if m.repository != nil { + edges = append(edges, tome.EdgeRepository) + } return edges } @@ -9085,13 +9825,17 @@ func (m *TomeMutation) AddedIDs(name string) []ent.Value { if id := m.uploader; id != nil { return []ent.Value{*id} } + case tome.EdgeRepository: + if id := m.repository; id != nil { + return []ent.Value{*id} + } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *TomeMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.removedfiles != nil { edges = append(edges, tome.EdgeFiles) } @@ -9114,13 +9858,16 @@ func (m *TomeMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this mutation. func (m *TomeMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.clearedfiles { edges = append(edges, tome.EdgeFiles) } if m.cleareduploader { edges = append(edges, tome.EdgeUploader) } + if m.clearedrepository { + edges = append(edges, tome.EdgeRepository) + } return edges } @@ -9132,6 +9879,8 @@ func (m *TomeMutation) EdgeCleared(name string) bool { return m.clearedfiles case tome.EdgeUploader: return m.cleareduploader + case tome.EdgeRepository: + return m.clearedrepository } return false } @@ -9143,6 +9892,9 @@ func (m *TomeMutation) ClearEdge(name string) error { case tome.EdgeUploader: m.ClearUploader() return nil + case tome.EdgeRepository: + m.ClearRepository() + return nil } return fmt.Errorf("unknown Tome unique edge %s", name) } @@ -9157,6 +9909,9 @@ func (m *TomeMutation) ResetEdge(name string) error { case tome.EdgeUploader: m.ResetUploader() return nil + case tome.EdgeRepository: + m.ResetRepository() + return nil } return fmt.Errorf("unknown Tome edge %s", name) } diff --git a/tavern/internal/ent/predicate/predicate.go b/tavern/internal/ent/predicate/predicate.go index 315d2f1e4..3774e65a4 100644 --- a/tavern/internal/ent/predicate/predicate.go +++ b/tavern/internal/ent/predicate/predicate.go @@ -27,6 +27,9 @@ type HostProcess func(*sql.Selector) // Quest is the predicate function for quest builders. type Quest func(*sql.Selector) +// Repository is the predicate function for repository builders. +type Repository func(*sql.Selector) + // Tag is the predicate function for tag builders. type Tag func(*sql.Selector) diff --git a/tavern/internal/ent/privacy/privacy.go b/tavern/internal/ent/privacy/privacy.go index 58165136e..54cd2549c 100644 --- a/tavern/internal/ent/privacy/privacy.go +++ b/tavern/internal/ent/privacy/privacy.go @@ -278,6 +278,30 @@ func (f QuestMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.QuestMutation", m) } +// The RepositoryQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type RepositoryQueryRuleFunc func(context.Context, *ent.RepositoryQuery) error + +// EvalQuery return f(ctx, q). +func (f RepositoryQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.RepositoryQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.RepositoryQuery", q) +} + +// The RepositoryMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type RepositoryMutationRuleFunc func(context.Context, *ent.RepositoryMutation) error + +// EvalMutation calls f(ctx, m). +func (f RepositoryMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.RepositoryMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.RepositoryMutation", m) +} + // The TagQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type TagQueryRuleFunc func(context.Context, *ent.TagQuery) error diff --git a/tavern/internal/ent/repository.go b/tavern/internal/ent/repository.go new file mode 100644 index 000000000..1d1d3547d --- /dev/null +++ b/tavern/internal/ent/repository.go @@ -0,0 +1,234 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "fmt" + "strings" + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "realm.pub/tavern/internal/ent/repository" + "realm.pub/tavern/internal/ent/user" +) + +// Repository is the model entity for the Repository schema. +type Repository struct { + config `json:"-"` + // ID of the ent. + ID int `json:"id,omitempty"` + // Timestamp of when this ent was created + CreatedAt time.Time `json:"created_at,omitempty"` + // Timestamp of when this ent was last updated + LastModifiedAt time.Time `json:"last_modified_at,omitempty"` + // URL of the repository + URL string `json:"url,omitempty"` + // Public key associated with this repositories private key + PublicKey string `json:"public_key,omitempty"` + // Private key used for authentication. + PrivateKey string `json:"-"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the RepositoryQuery when eager-loading is set. + Edges RepositoryEdges `json:"edges"` + repository_owner *int + selectValues sql.SelectValues +} + +// RepositoryEdges holds the relations/edges for other nodes in the graph. +type RepositoryEdges struct { + // Tomes imported using this repository. + Tomes []*Tome `json:"tomes,omitempty"` + // User that created this repository. + Owner *User `json:"owner,omitempty"` + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool + // totalCount holds the count of the edges above. + totalCount [2]map[string]int + + namedTomes map[string][]*Tome +} + +// TomesOrErr returns the Tomes value or an error if the edge +// was not loaded in eager-loading. +func (e RepositoryEdges) TomesOrErr() ([]*Tome, error) { + if e.loadedTypes[0] { + return e.Tomes, nil + } + return nil, &NotLoadedError{edge: "tomes"} +} + +// OwnerOrErr returns the Owner value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e RepositoryEdges) OwnerOrErr() (*User, error) { + if e.loadedTypes[1] { + if e.Owner == nil { + // Edge was loaded but was not found. + return nil, &NotFoundError{label: user.Label} + } + return e.Owner, nil + } + return nil, &NotLoadedError{edge: "owner"} +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*Repository) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case repository.FieldID: + values[i] = new(sql.NullInt64) + case repository.FieldURL, repository.FieldPublicKey, repository.FieldPrivateKey: + values[i] = new(sql.NullString) + case repository.FieldCreatedAt, repository.FieldLastModifiedAt: + values[i] = new(sql.NullTime) + case repository.ForeignKeys[0]: // repository_owner + values[i] = new(sql.NullInt64) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the Repository fields. +func (r *Repository) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case repository.FieldID: + value, ok := values[i].(*sql.NullInt64) + if !ok { + return fmt.Errorf("unexpected type %T for field id", value) + } + r.ID = int(value.Int64) + case repository.FieldCreatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field created_at", values[i]) + } else if value.Valid { + r.CreatedAt = value.Time + } + case repository.FieldLastModifiedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field last_modified_at", values[i]) + } else if value.Valid { + r.LastModifiedAt = value.Time + } + case repository.FieldURL: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field url", values[i]) + } else if value.Valid { + r.URL = value.String + } + case repository.FieldPublicKey: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field public_key", values[i]) + } else if value.Valid { + r.PublicKey = value.String + } + case repository.FieldPrivateKey: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field private_key", values[i]) + } else if value.Valid { + r.PrivateKey = value.String + } + case repository.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field repository_owner", value) + } else if value.Valid { + r.repository_owner = new(int) + *r.repository_owner = int(value.Int64) + } + default: + r.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the Repository. +// This includes values selected through modifiers, order, etc. +func (r *Repository) Value(name string) (ent.Value, error) { + return r.selectValues.Get(name) +} + +// QueryTomes queries the "tomes" edge of the Repository entity. +func (r *Repository) QueryTomes() *TomeQuery { + return NewRepositoryClient(r.config).QueryTomes(r) +} + +// QueryOwner queries the "owner" edge of the Repository entity. +func (r *Repository) QueryOwner() *UserQuery { + return NewRepositoryClient(r.config).QueryOwner(r) +} + +// Update returns a builder for updating this Repository. +// Note that you need to call Repository.Unwrap() before calling this method if this Repository +// was returned from a transaction, and the transaction was committed or rolled back. +func (r *Repository) Update() *RepositoryUpdateOne { + return NewRepositoryClient(r.config).UpdateOne(r) +} + +// Unwrap unwraps the Repository entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (r *Repository) Unwrap() *Repository { + _tx, ok := r.config.driver.(*txDriver) + if !ok { + panic("ent: Repository is not a transactional entity") + } + r.config.driver = _tx.drv + return r +} + +// String implements the fmt.Stringer. +func (r *Repository) String() string { + var builder strings.Builder + builder.WriteString("Repository(") + builder.WriteString(fmt.Sprintf("id=%v, ", r.ID)) + builder.WriteString("created_at=") + builder.WriteString(r.CreatedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("last_modified_at=") + builder.WriteString(r.LastModifiedAt.Format(time.ANSIC)) + builder.WriteString(", ") + builder.WriteString("url=") + builder.WriteString(r.URL) + builder.WriteString(", ") + builder.WriteString("public_key=") + builder.WriteString(r.PublicKey) + builder.WriteString(", ") + builder.WriteString("private_key=") + builder.WriteByte(')') + return builder.String() +} + +// NamedTomes returns the Tomes named value or an error if the edge was not +// loaded in eager-loading with this name. +func (r *Repository) NamedTomes(name string) ([]*Tome, error) { + if r.Edges.namedTomes == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := r.Edges.namedTomes[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (r *Repository) appendNamedTomes(name string, edges ...*Tome) { + if r.Edges.namedTomes == nil { + r.Edges.namedTomes = make(map[string][]*Tome) + } + if len(edges) == 0 { + r.Edges.namedTomes[name] = []*Tome{} + } else { + r.Edges.namedTomes[name] = append(r.Edges.namedTomes[name], edges...) + } +} + +// Repositories is a parsable slice of Repository. +type Repositories []*Repository diff --git a/tavern/internal/ent/repository/repository.go b/tavern/internal/ent/repository/repository.go new file mode 100644 index 000000000..89f06bb08 --- /dev/null +++ b/tavern/internal/ent/repository/repository.go @@ -0,0 +1,168 @@ +// Code generated by ent, DO NOT EDIT. + +package repository + +import ( + "time" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" +) + +const ( + // Label holds the string label denoting the repository type in the database. + Label = "repository" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldCreatedAt holds the string denoting the created_at field in the database. + FieldCreatedAt = "created_at" + // FieldLastModifiedAt holds the string denoting the last_modified_at field in the database. + FieldLastModifiedAt = "last_modified_at" + // FieldURL holds the string denoting the url field in the database. + FieldURL = "url" + // FieldPublicKey holds the string denoting the public_key field in the database. + FieldPublicKey = "public_key" + // FieldPrivateKey holds the string denoting the private_key field in the database. + FieldPrivateKey = "private_key" + // EdgeTomes holds the string denoting the tomes edge name in mutations. + EdgeTomes = "tomes" + // EdgeOwner holds the string denoting the owner edge name in mutations. + EdgeOwner = "owner" + // Table holds the table name of the repository in the database. + Table = "repositories" + // TomesTable is the table that holds the tomes relation/edge. + TomesTable = "tomes" + // TomesInverseTable is the table name for the Tome entity. + // It exists in this package in order to avoid circular dependency with the "tome" package. + TomesInverseTable = "tomes" + // TomesColumn is the table column denoting the tomes relation/edge. + TomesColumn = "tome_repository" + // OwnerTable is the table that holds the owner relation/edge. + OwnerTable = "repositories" + // OwnerInverseTable is the table name for the User entity. + // It exists in this package in order to avoid circular dependency with the "user" package. + OwnerInverseTable = "users" + // OwnerColumn is the table column denoting the owner relation/edge. + OwnerColumn = "repository_owner" +) + +// Columns holds all SQL columns for repository fields. +var Columns = []string{ + FieldID, + FieldCreatedAt, + FieldLastModifiedAt, + FieldURL, + FieldPublicKey, + FieldPrivateKey, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "repositories" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "repository_owner", +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + for i := range ForeignKeys { + if column == ForeignKeys[i] { + return true + } + } + return false +} + +// Note that the variables below are initialized by the runtime +// package on the initialization of the application. Therefore, +// it should be imported in the main as follows: +// +// import _ "realm.pub/tavern/internal/ent/runtime" +var ( + Hooks [1]ent.Hook + // DefaultCreatedAt holds the default value on creation for the "created_at" field. + DefaultCreatedAt func() time.Time + // DefaultLastModifiedAt holds the default value on creation for the "last_modified_at" field. + DefaultLastModifiedAt func() time.Time + // UpdateDefaultLastModifiedAt holds the default value on update for the "last_modified_at" field. + UpdateDefaultLastModifiedAt func() time.Time + // URLValidator is a validator for the "url" field. It is called by the builders before save. + URLValidator func(string) error + // PublicKeyValidator is a validator for the "public_key" field. It is called by the builders before save. + PublicKeyValidator func(string) error + // PrivateKeyValidator is a validator for the "private_key" field. It is called by the builders before save. + PrivateKeyValidator func(string) error +) + +// OrderOption defines the ordering options for the Repository queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByCreatedAt orders the results by the created_at field. +func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() +} + +// ByLastModifiedAt orders the results by the last_modified_at field. +func ByLastModifiedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLastModifiedAt, opts...).ToFunc() +} + +// ByURL orders the results by the url field. +func ByURL(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldURL, opts...).ToFunc() +} + +// ByPublicKey orders the results by the public_key field. +func ByPublicKey(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldPublicKey, opts...).ToFunc() +} + +// ByPrivateKey orders the results by the private_key field. +func ByPrivateKey(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldPrivateKey, opts...).ToFunc() +} + +// ByTomesCount orders the results by tomes count. +func ByTomesCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newTomesStep(), opts...) + } +} + +// ByTomes orders the results by tomes terms. +func ByTomes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newTomesStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByOwnerField orders the results by owner field. +func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) + } +} +func newTomesStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(TomesInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, TomesTable, TomesColumn), + ) +} +func newOwnerStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(OwnerInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, OwnerTable, OwnerColumn), + ) +} diff --git a/tavern/internal/ent/repository/where.go b/tavern/internal/ent/repository/where.go new file mode 100644 index 000000000..6dbe0d724 --- /dev/null +++ b/tavern/internal/ent/repository/where.go @@ -0,0 +1,417 @@ +// Code generated by ent, DO NOT EDIT. + +package repository + +import ( + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "realm.pub/tavern/internal/ent/predicate" +) + +// ID filters vertices based on their ID field. +func ID(id int) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldID, id)) +} + +// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. +func CreatedAt(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldCreatedAt, v)) +} + +// LastModifiedAt applies equality check predicate on the "last_modified_at" field. It's identical to LastModifiedAtEQ. +func LastModifiedAt(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// URL applies equality check predicate on the "url" field. It's identical to URLEQ. +func URL(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldURL, v)) +} + +// PublicKey applies equality check predicate on the "public_key" field. It's identical to PublicKeyEQ. +func PublicKey(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldPublicKey, v)) +} + +// PrivateKey applies equality check predicate on the "private_key" field. It's identical to PrivateKeyEQ. +func PrivateKey(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldPrivateKey, v)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldCreatedAt, v)) +} + +// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. +func LastModifiedAtEQ(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. +func LastModifiedAtNEQ(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldLastModifiedAt, v)) +} + +// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. +func LastModifiedAtIn(vs ...time.Time) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. +func LastModifiedAtNotIn(vs ...time.Time) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldLastModifiedAt, vs...)) +} + +// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. +func LastModifiedAtGT(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. +func LastModifiedAtGTE(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. +func LastModifiedAtLT(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldLastModifiedAt, v)) +} + +// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. +func LastModifiedAtLTE(v time.Time) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldLastModifiedAt, v)) +} + +// URLEQ applies the EQ predicate on the "url" field. +func URLEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldURL, v)) +} + +// URLNEQ applies the NEQ predicate on the "url" field. +func URLNEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldURL, v)) +} + +// URLIn applies the In predicate on the "url" field. +func URLIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldURL, vs...)) +} + +// URLNotIn applies the NotIn predicate on the "url" field. +func URLNotIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldURL, vs...)) +} + +// URLGT applies the GT predicate on the "url" field. +func URLGT(v string) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldURL, v)) +} + +// URLGTE applies the GTE predicate on the "url" field. +func URLGTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldURL, v)) +} + +// URLLT applies the LT predicate on the "url" field. +func URLLT(v string) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldURL, v)) +} + +// URLLTE applies the LTE predicate on the "url" field. +func URLLTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldURL, v)) +} + +// URLContains applies the Contains predicate on the "url" field. +func URLContains(v string) predicate.Repository { + return predicate.Repository(sql.FieldContains(FieldURL, v)) +} + +// URLHasPrefix applies the HasPrefix predicate on the "url" field. +func URLHasPrefix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasPrefix(FieldURL, v)) +} + +// URLHasSuffix applies the HasSuffix predicate on the "url" field. +func URLHasSuffix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasSuffix(FieldURL, v)) +} + +// URLEqualFold applies the EqualFold predicate on the "url" field. +func URLEqualFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldEqualFold(FieldURL, v)) +} + +// URLContainsFold applies the ContainsFold predicate on the "url" field. +func URLContainsFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldContainsFold(FieldURL, v)) +} + +// PublicKeyEQ applies the EQ predicate on the "public_key" field. +func PublicKeyEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldPublicKey, v)) +} + +// PublicKeyNEQ applies the NEQ predicate on the "public_key" field. +func PublicKeyNEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldPublicKey, v)) +} + +// PublicKeyIn applies the In predicate on the "public_key" field. +func PublicKeyIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldPublicKey, vs...)) +} + +// PublicKeyNotIn applies the NotIn predicate on the "public_key" field. +func PublicKeyNotIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldPublicKey, vs...)) +} + +// PublicKeyGT applies the GT predicate on the "public_key" field. +func PublicKeyGT(v string) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldPublicKey, v)) +} + +// PublicKeyGTE applies the GTE predicate on the "public_key" field. +func PublicKeyGTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldPublicKey, v)) +} + +// PublicKeyLT applies the LT predicate on the "public_key" field. +func PublicKeyLT(v string) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldPublicKey, v)) +} + +// PublicKeyLTE applies the LTE predicate on the "public_key" field. +func PublicKeyLTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldPublicKey, v)) +} + +// PublicKeyContains applies the Contains predicate on the "public_key" field. +func PublicKeyContains(v string) predicate.Repository { + return predicate.Repository(sql.FieldContains(FieldPublicKey, v)) +} + +// PublicKeyHasPrefix applies the HasPrefix predicate on the "public_key" field. +func PublicKeyHasPrefix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasPrefix(FieldPublicKey, v)) +} + +// PublicKeyHasSuffix applies the HasSuffix predicate on the "public_key" field. +func PublicKeyHasSuffix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasSuffix(FieldPublicKey, v)) +} + +// PublicKeyEqualFold applies the EqualFold predicate on the "public_key" field. +func PublicKeyEqualFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldEqualFold(FieldPublicKey, v)) +} + +// PublicKeyContainsFold applies the ContainsFold predicate on the "public_key" field. +func PublicKeyContainsFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldContainsFold(FieldPublicKey, v)) +} + +// PrivateKeyEQ applies the EQ predicate on the "private_key" field. +func PrivateKeyEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldEQ(FieldPrivateKey, v)) +} + +// PrivateKeyNEQ applies the NEQ predicate on the "private_key" field. +func PrivateKeyNEQ(v string) predicate.Repository { + return predicate.Repository(sql.FieldNEQ(FieldPrivateKey, v)) +} + +// PrivateKeyIn applies the In predicate on the "private_key" field. +func PrivateKeyIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldIn(FieldPrivateKey, vs...)) +} + +// PrivateKeyNotIn applies the NotIn predicate on the "private_key" field. +func PrivateKeyNotIn(vs ...string) predicate.Repository { + return predicate.Repository(sql.FieldNotIn(FieldPrivateKey, vs...)) +} + +// PrivateKeyGT applies the GT predicate on the "private_key" field. +func PrivateKeyGT(v string) predicate.Repository { + return predicate.Repository(sql.FieldGT(FieldPrivateKey, v)) +} + +// PrivateKeyGTE applies the GTE predicate on the "private_key" field. +func PrivateKeyGTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldGTE(FieldPrivateKey, v)) +} + +// PrivateKeyLT applies the LT predicate on the "private_key" field. +func PrivateKeyLT(v string) predicate.Repository { + return predicate.Repository(sql.FieldLT(FieldPrivateKey, v)) +} + +// PrivateKeyLTE applies the LTE predicate on the "private_key" field. +func PrivateKeyLTE(v string) predicate.Repository { + return predicate.Repository(sql.FieldLTE(FieldPrivateKey, v)) +} + +// PrivateKeyContains applies the Contains predicate on the "private_key" field. +func PrivateKeyContains(v string) predicate.Repository { + return predicate.Repository(sql.FieldContains(FieldPrivateKey, v)) +} + +// PrivateKeyHasPrefix applies the HasPrefix predicate on the "private_key" field. +func PrivateKeyHasPrefix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasPrefix(FieldPrivateKey, v)) +} + +// PrivateKeyHasSuffix applies the HasSuffix predicate on the "private_key" field. +func PrivateKeyHasSuffix(v string) predicate.Repository { + return predicate.Repository(sql.FieldHasSuffix(FieldPrivateKey, v)) +} + +// PrivateKeyEqualFold applies the EqualFold predicate on the "private_key" field. +func PrivateKeyEqualFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldEqualFold(FieldPrivateKey, v)) +} + +// PrivateKeyContainsFold applies the ContainsFold predicate on the "private_key" field. +func PrivateKeyContainsFold(v string) predicate.Repository { + return predicate.Repository(sql.FieldContainsFold(FieldPrivateKey, v)) +} + +// HasTomes applies the HasEdge predicate on the "tomes" edge. +func HasTomes() predicate.Repository { + return predicate.Repository(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, TomesTable, TomesColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasTomesWith applies the HasEdge predicate on the "tomes" edge with a given conditions (other predicates). +func HasTomesWith(preds ...predicate.Tome) predicate.Repository { + return predicate.Repository(func(s *sql.Selector) { + step := newTomesStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasOwner applies the HasEdge predicate on the "owner" edge. +func HasOwner() predicate.Repository { + return predicate.Repository(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, OwnerTable, OwnerColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates). +func HasOwnerWith(preds ...predicate.User) predicate.Repository { + return predicate.Repository(func(s *sql.Selector) { + step := newOwnerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.Repository) predicate.Repository { + return predicate.Repository(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.Repository) predicate.Repository { + return predicate.Repository(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.Repository) predicate.Repository { + return predicate.Repository(sql.NotPredicates(p)) +} diff --git a/tavern/internal/ent/repository_create.go b/tavern/internal/ent/repository_create.go new file mode 100644 index 000000000..7ac520ee4 --- /dev/null +++ b/tavern/internal/ent/repository_create.go @@ -0,0 +1,762 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/repository" + "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" +) + +// RepositoryCreate is the builder for creating a Repository entity. +type RepositoryCreate struct { + config + mutation *RepositoryMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetCreatedAt sets the "created_at" field. +func (rc *RepositoryCreate) SetCreatedAt(t time.Time) *RepositoryCreate { + rc.mutation.SetCreatedAt(t) + return rc +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (rc *RepositoryCreate) SetNillableCreatedAt(t *time.Time) *RepositoryCreate { + if t != nil { + rc.SetCreatedAt(*t) + } + return rc +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (rc *RepositoryCreate) SetLastModifiedAt(t time.Time) *RepositoryCreate { + rc.mutation.SetLastModifiedAt(t) + return rc +} + +// SetNillableLastModifiedAt sets the "last_modified_at" field if the given value is not nil. +func (rc *RepositoryCreate) SetNillableLastModifiedAt(t *time.Time) *RepositoryCreate { + if t != nil { + rc.SetLastModifiedAt(*t) + } + return rc +} + +// SetURL sets the "url" field. +func (rc *RepositoryCreate) SetURL(s string) *RepositoryCreate { + rc.mutation.SetURL(s) + return rc +} + +// SetPublicKey sets the "public_key" field. +func (rc *RepositoryCreate) SetPublicKey(s string) *RepositoryCreate { + rc.mutation.SetPublicKey(s) + return rc +} + +// SetPrivateKey sets the "private_key" field. +func (rc *RepositoryCreate) SetPrivateKey(s string) *RepositoryCreate { + rc.mutation.SetPrivateKey(s) + return rc +} + +// AddTomeIDs adds the "tomes" edge to the Tome entity by IDs. +func (rc *RepositoryCreate) AddTomeIDs(ids ...int) *RepositoryCreate { + rc.mutation.AddTomeIDs(ids...) + return rc +} + +// AddTomes adds the "tomes" edges to the Tome entity. +func (rc *RepositoryCreate) AddTomes(t ...*Tome) *RepositoryCreate { + ids := make([]int, len(t)) + for i := range t { + ids[i] = t[i].ID + } + return rc.AddTomeIDs(ids...) +} + +// SetOwnerID sets the "owner" edge to the User entity by ID. +func (rc *RepositoryCreate) SetOwnerID(id int) *RepositoryCreate { + rc.mutation.SetOwnerID(id) + return rc +} + +// SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil. +func (rc *RepositoryCreate) SetNillableOwnerID(id *int) *RepositoryCreate { + if id != nil { + rc = rc.SetOwnerID(*id) + } + return rc +} + +// SetOwner sets the "owner" edge to the User entity. +func (rc *RepositoryCreate) SetOwner(u *User) *RepositoryCreate { + return rc.SetOwnerID(u.ID) +} + +// Mutation returns the RepositoryMutation object of the builder. +func (rc *RepositoryCreate) Mutation() *RepositoryMutation { + return rc.mutation +} + +// Save creates the Repository in the database. +func (rc *RepositoryCreate) Save(ctx context.Context) (*Repository, error) { + if err := rc.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, rc.sqlSave, rc.mutation, rc.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (rc *RepositoryCreate) SaveX(ctx context.Context) *Repository { + v, err := rc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (rc *RepositoryCreate) Exec(ctx context.Context) error { + _, err := rc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (rc *RepositoryCreate) ExecX(ctx context.Context) { + if err := rc.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (rc *RepositoryCreate) defaults() error { + if _, ok := rc.mutation.CreatedAt(); !ok { + if repository.DefaultCreatedAt == nil { + return fmt.Errorf("ent: uninitialized repository.DefaultCreatedAt (forgotten import ent/runtime?)") + } + v := repository.DefaultCreatedAt() + rc.mutation.SetCreatedAt(v) + } + if _, ok := rc.mutation.LastModifiedAt(); !ok { + if repository.DefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized repository.DefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := repository.DefaultLastModifiedAt() + rc.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (rc *RepositoryCreate) check() error { + if _, ok := rc.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Repository.created_at"`)} + } + if _, ok := rc.mutation.LastModifiedAt(); !ok { + return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "Repository.last_modified_at"`)} + } + if _, ok := rc.mutation.URL(); !ok { + return &ValidationError{Name: "url", err: errors.New(`ent: missing required field "Repository.url"`)} + } + if v, ok := rc.mutation.URL(); ok { + if err := repository.URLValidator(v); err != nil { + return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Repository.url": %w`, err)} + } + } + if _, ok := rc.mutation.PublicKey(); !ok { + return &ValidationError{Name: "public_key", err: errors.New(`ent: missing required field "Repository.public_key"`)} + } + if v, ok := rc.mutation.PublicKey(); ok { + if err := repository.PublicKeyValidator(v); err != nil { + return &ValidationError{Name: "public_key", err: fmt.Errorf(`ent: validator failed for field "Repository.public_key": %w`, err)} + } + } + if _, ok := rc.mutation.PrivateKey(); !ok { + return &ValidationError{Name: "private_key", err: errors.New(`ent: missing required field "Repository.private_key"`)} + } + if v, ok := rc.mutation.PrivateKey(); ok { + if err := repository.PrivateKeyValidator(v); err != nil { + return &ValidationError{Name: "private_key", err: fmt.Errorf(`ent: validator failed for field "Repository.private_key": %w`, err)} + } + } + return nil +} + +func (rc *RepositoryCreate) sqlSave(ctx context.Context) (*Repository, error) { + if err := rc.check(); err != nil { + return nil, err + } + _node, _spec := rc.createSpec() + if err := sqlgraph.CreateNode(ctx, rc.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + id := _spec.ID.Value.(int64) + _node.ID = int(id) + rc.mutation.id = &_node.ID + rc.mutation.done = true + return _node, nil +} + +func (rc *RepositoryCreate) createSpec() (*Repository, *sqlgraph.CreateSpec) { + var ( + _node = &Repository{config: rc.config} + _spec = sqlgraph.NewCreateSpec(repository.Table, sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt)) + ) + _spec.OnConflict = rc.conflict + if value, ok := rc.mutation.CreatedAt(); ok { + _spec.SetField(repository.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := rc.mutation.LastModifiedAt(); ok { + _spec.SetField(repository.FieldLastModifiedAt, field.TypeTime, value) + _node.LastModifiedAt = value + } + if value, ok := rc.mutation.URL(); ok { + _spec.SetField(repository.FieldURL, field.TypeString, value) + _node.URL = value + } + if value, ok := rc.mutation.PublicKey(); ok { + _spec.SetField(repository.FieldPublicKey, field.TypeString, value) + _node.PublicKey = value + } + if value, ok := rc.mutation.PrivateKey(); ok { + _spec.SetField(repository.FieldPrivateKey, field.TypeString, value) + _node.PrivateKey = value + } + if nodes := rc.mutation.TomesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := rc.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: repository.OwnerTable, + Columns: []string{repository.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.repository_owner = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.Repository.Create(). +// SetCreatedAt(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.RepositoryUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (rc *RepositoryCreate) OnConflict(opts ...sql.ConflictOption) *RepositoryUpsertOne { + rc.conflict = opts + return &RepositoryUpsertOne{ + create: rc, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (rc *RepositoryCreate) OnConflictColumns(columns ...string) *RepositoryUpsertOne { + rc.conflict = append(rc.conflict, sql.ConflictColumns(columns...)) + return &RepositoryUpsertOne{ + create: rc, + } +} + +type ( + // RepositoryUpsertOne is the builder for "upsert"-ing + // one Repository node. + RepositoryUpsertOne struct { + create *RepositoryCreate + } + + // RepositoryUpsert is the "OnConflict" setter. + RepositoryUpsert struct { + *sql.UpdateSet + } +) + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *RepositoryUpsert) SetLastModifiedAt(v time.Time) *RepositoryUpsert { + u.Set(repository.FieldLastModifiedAt, v) + return u +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *RepositoryUpsert) UpdateLastModifiedAt() *RepositoryUpsert { + u.SetExcluded(repository.FieldLastModifiedAt) + return u +} + +// SetURL sets the "url" field. +func (u *RepositoryUpsert) SetURL(v string) *RepositoryUpsert { + u.Set(repository.FieldURL, v) + return u +} + +// UpdateURL sets the "url" field to the value that was provided on create. +func (u *RepositoryUpsert) UpdateURL() *RepositoryUpsert { + u.SetExcluded(repository.FieldURL) + return u +} + +// SetPublicKey sets the "public_key" field. +func (u *RepositoryUpsert) SetPublicKey(v string) *RepositoryUpsert { + u.Set(repository.FieldPublicKey, v) + return u +} + +// UpdatePublicKey sets the "public_key" field to the value that was provided on create. +func (u *RepositoryUpsert) UpdatePublicKey() *RepositoryUpsert { + u.SetExcluded(repository.FieldPublicKey) + return u +} + +// SetPrivateKey sets the "private_key" field. +func (u *RepositoryUpsert) SetPrivateKey(v string) *RepositoryUpsert { + u.Set(repository.FieldPrivateKey, v) + return u +} + +// UpdatePrivateKey sets the "private_key" field to the value that was provided on create. +func (u *RepositoryUpsert) UpdatePrivateKey() *RepositoryUpsert { + u.SetExcluded(repository.FieldPrivateKey) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create. +// Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *RepositoryUpsertOne) UpdateNewValues() *RepositoryUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(repository.FieldCreatedAt) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *RepositoryUpsertOne) Ignore() *RepositoryUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *RepositoryUpsertOne) DoNothing() *RepositoryUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the RepositoryCreate.OnConflict +// documentation for more info. +func (u *RepositoryUpsertOne) Update(set func(*RepositoryUpsert)) *RepositoryUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&RepositoryUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *RepositoryUpsertOne) SetLastModifiedAt(v time.Time) *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *RepositoryUpsertOne) UpdateLastModifiedAt() *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetURL sets the "url" field. +func (u *RepositoryUpsertOne) SetURL(v string) *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.SetURL(v) + }) +} + +// UpdateURL sets the "url" field to the value that was provided on create. +func (u *RepositoryUpsertOne) UpdateURL() *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.UpdateURL() + }) +} + +// SetPublicKey sets the "public_key" field. +func (u *RepositoryUpsertOne) SetPublicKey(v string) *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.SetPublicKey(v) + }) +} + +// UpdatePublicKey sets the "public_key" field to the value that was provided on create. +func (u *RepositoryUpsertOne) UpdatePublicKey() *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.UpdatePublicKey() + }) +} + +// SetPrivateKey sets the "private_key" field. +func (u *RepositoryUpsertOne) SetPrivateKey(v string) *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.SetPrivateKey(v) + }) +} + +// UpdatePrivateKey sets the "private_key" field to the value that was provided on create. +func (u *RepositoryUpsertOne) UpdatePrivateKey() *RepositoryUpsertOne { + return u.Update(func(s *RepositoryUpsert) { + s.UpdatePrivateKey() + }) +} + +// Exec executes the query. +func (u *RepositoryUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for RepositoryCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *RepositoryUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *RepositoryUpsertOne) ID(ctx context.Context) (id int, err error) { + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *RepositoryUpsertOne) IDX(ctx context.Context) int { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// RepositoryCreateBulk is the builder for creating many Repository entities in bulk. +type RepositoryCreateBulk struct { + config + err error + builders []*RepositoryCreate + conflict []sql.ConflictOption +} + +// Save creates the Repository entities in the database. +func (rcb *RepositoryCreateBulk) Save(ctx context.Context) ([]*Repository, error) { + if rcb.err != nil { + return nil, rcb.err + } + specs := make([]*sqlgraph.CreateSpec, len(rcb.builders)) + nodes := make([]*Repository, len(rcb.builders)) + mutators := make([]Mutator, len(rcb.builders)) + for i := range rcb.builders { + func(i int, root context.Context) { + builder := rcb.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*RepositoryMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = rcb.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + if specs[i].ID.Value != nil { + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + } + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (rcb *RepositoryCreateBulk) SaveX(ctx context.Context) []*Repository { + v, err := rcb.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (rcb *RepositoryCreateBulk) Exec(ctx context.Context) error { + _, err := rcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (rcb *RepositoryCreateBulk) ExecX(ctx context.Context) { + if err := rcb.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.Repository.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.RepositoryUpsert) { +// SetCreatedAt(v+v). +// }). +// Exec(ctx) +func (rcb *RepositoryCreateBulk) OnConflict(opts ...sql.ConflictOption) *RepositoryUpsertBulk { + rcb.conflict = opts + return &RepositoryUpsertBulk{ + create: rcb, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (rcb *RepositoryCreateBulk) OnConflictColumns(columns ...string) *RepositoryUpsertBulk { + rcb.conflict = append(rcb.conflict, sql.ConflictColumns(columns...)) + return &RepositoryUpsertBulk{ + create: rcb, + } +} + +// RepositoryUpsertBulk is the builder for "upsert"-ing +// a bulk of Repository nodes. +type RepositoryUpsertBulk struct { + create *RepositoryCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// ). +// Exec(ctx) +func (u *RepositoryUpsertBulk) UpdateNewValues() *RepositoryUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(repository.FieldCreatedAt) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.Repository.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *RepositoryUpsertBulk) Ignore() *RepositoryUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *RepositoryUpsertBulk) DoNothing() *RepositoryUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the RepositoryCreateBulk.OnConflict +// documentation for more info. +func (u *RepositoryUpsertBulk) Update(set func(*RepositoryUpsert)) *RepositoryUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&RepositoryUpsert{UpdateSet: update}) + })) + return u +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (u *RepositoryUpsertBulk) SetLastModifiedAt(v time.Time) *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.SetLastModifiedAt(v) + }) +} + +// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. +func (u *RepositoryUpsertBulk) UpdateLastModifiedAt() *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.UpdateLastModifiedAt() + }) +} + +// SetURL sets the "url" field. +func (u *RepositoryUpsertBulk) SetURL(v string) *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.SetURL(v) + }) +} + +// UpdateURL sets the "url" field to the value that was provided on create. +func (u *RepositoryUpsertBulk) UpdateURL() *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.UpdateURL() + }) +} + +// SetPublicKey sets the "public_key" field. +func (u *RepositoryUpsertBulk) SetPublicKey(v string) *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.SetPublicKey(v) + }) +} + +// UpdatePublicKey sets the "public_key" field to the value that was provided on create. +func (u *RepositoryUpsertBulk) UpdatePublicKey() *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.UpdatePublicKey() + }) +} + +// SetPrivateKey sets the "private_key" field. +func (u *RepositoryUpsertBulk) SetPrivateKey(v string) *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.SetPrivateKey(v) + }) +} + +// UpdatePrivateKey sets the "private_key" field to the value that was provided on create. +func (u *RepositoryUpsertBulk) UpdatePrivateKey() *RepositoryUpsertBulk { + return u.Update(func(s *RepositoryUpsert) { + s.UpdatePrivateKey() + }) +} + +// Exec executes the query. +func (u *RepositoryUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the RepositoryCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("ent: missing options for RepositoryCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *RepositoryUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/tavern/internal/ent/repository_delete.go b/tavern/internal/ent/repository_delete.go new file mode 100644 index 000000000..c03ea5459 --- /dev/null +++ b/tavern/internal/ent/repository_delete.go @@ -0,0 +1,88 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/repository" +) + +// RepositoryDelete is the builder for deleting a Repository entity. +type RepositoryDelete struct { + config + hooks []Hook + mutation *RepositoryMutation +} + +// Where appends a list predicates to the RepositoryDelete builder. +func (rd *RepositoryDelete) Where(ps ...predicate.Repository) *RepositoryDelete { + rd.mutation.Where(ps...) + return rd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (rd *RepositoryDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, rd.sqlExec, rd.mutation, rd.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (rd *RepositoryDelete) ExecX(ctx context.Context) int { + n, err := rd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (rd *RepositoryDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(repository.Table, sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt)) + if ps := rd.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, rd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + rd.mutation.done = true + return affected, err +} + +// RepositoryDeleteOne is the builder for deleting a single Repository entity. +type RepositoryDeleteOne struct { + rd *RepositoryDelete +} + +// Where appends a list predicates to the RepositoryDelete builder. +func (rdo *RepositoryDeleteOne) Where(ps ...predicate.Repository) *RepositoryDeleteOne { + rdo.rd.mutation.Where(ps...) + return rdo +} + +// Exec executes the deletion query. +func (rdo *RepositoryDeleteOne) Exec(ctx context.Context) error { + n, err := rdo.rd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{repository.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (rdo *RepositoryDeleteOne) ExecX(ctx context.Context) { + if err := rdo.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/tavern/internal/ent/repository_query.go b/tavern/internal/ent/repository_query.go new file mode 100644 index 000000000..75958a8e5 --- /dev/null +++ b/tavern/internal/ent/repository_query.go @@ -0,0 +1,724 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "database/sql/driver" + "fmt" + "math" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/repository" + "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" +) + +// RepositoryQuery is the builder for querying Repository entities. +type RepositoryQuery struct { + config + ctx *QueryContext + order []repository.OrderOption + inters []Interceptor + predicates []predicate.Repository + withTomes *TomeQuery + withOwner *UserQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*Repository) error + withNamedTomes map[string]*TomeQuery + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the RepositoryQuery builder. +func (rq *RepositoryQuery) Where(ps ...predicate.Repository) *RepositoryQuery { + rq.predicates = append(rq.predicates, ps...) + return rq +} + +// Limit the number of records to be returned by this query. +func (rq *RepositoryQuery) Limit(limit int) *RepositoryQuery { + rq.ctx.Limit = &limit + return rq +} + +// Offset to start from. +func (rq *RepositoryQuery) Offset(offset int) *RepositoryQuery { + rq.ctx.Offset = &offset + return rq +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (rq *RepositoryQuery) Unique(unique bool) *RepositoryQuery { + rq.ctx.Unique = &unique + return rq +} + +// Order specifies how the records should be ordered. +func (rq *RepositoryQuery) Order(o ...repository.OrderOption) *RepositoryQuery { + rq.order = append(rq.order, o...) + return rq +} + +// QueryTomes chains the current query on the "tomes" edge. +func (rq *RepositoryQuery) QueryTomes() *TomeQuery { + query := (&TomeClient{config: rq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := rq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := rq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(repository.Table, repository.FieldID, selector), + sqlgraph.To(tome.Table, tome.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, repository.TomesTable, repository.TomesColumn), + ) + fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryOwner chains the current query on the "owner" edge. +func (rq *RepositoryQuery) QueryOwner() *UserQuery { + query := (&UserClient{config: rq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := rq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := rq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(repository.Table, repository.FieldID, selector), + sqlgraph.To(user.Table, user.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, repository.OwnerTable, repository.OwnerColumn), + ) + fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first Repository entity from the query. +// Returns a *NotFoundError when no Repository was found. +func (rq *RepositoryQuery) First(ctx context.Context) (*Repository, error) { + nodes, err := rq.Limit(1).All(setContextOp(ctx, rq.ctx, "First")) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{repository.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (rq *RepositoryQuery) FirstX(ctx context.Context) *Repository { + node, err := rq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first Repository ID from the query. +// Returns a *NotFoundError when no Repository ID was found. +func (rq *RepositoryQuery) FirstID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = rq.Limit(1).IDs(setContextOp(ctx, rq.ctx, "FirstID")); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{repository.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (rq *RepositoryQuery) FirstIDX(ctx context.Context) int { + id, err := rq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single Repository entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one Repository entity is found. +// Returns a *NotFoundError when no Repository entities are found. +func (rq *RepositoryQuery) Only(ctx context.Context) (*Repository, error) { + nodes, err := rq.Limit(2).All(setContextOp(ctx, rq.ctx, "Only")) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{repository.Label} + default: + return nil, &NotSingularError{repository.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (rq *RepositoryQuery) OnlyX(ctx context.Context) *Repository { + node, err := rq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only Repository ID in the query. +// Returns a *NotSingularError when more than one Repository ID is found. +// Returns a *NotFoundError when no entities are found. +func (rq *RepositoryQuery) OnlyID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = rq.Limit(2).IDs(setContextOp(ctx, rq.ctx, "OnlyID")); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{repository.Label} + default: + err = &NotSingularError{repository.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (rq *RepositoryQuery) OnlyIDX(ctx context.Context) int { + id, err := rq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of Repositories. +func (rq *RepositoryQuery) All(ctx context.Context) ([]*Repository, error) { + ctx = setContextOp(ctx, rq.ctx, "All") + if err := rq.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*Repository, *RepositoryQuery]() + return withInterceptors[[]*Repository](ctx, rq, qr, rq.inters) +} + +// AllX is like All, but panics if an error occurs. +func (rq *RepositoryQuery) AllX(ctx context.Context) []*Repository { + nodes, err := rq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of Repository IDs. +func (rq *RepositoryQuery) IDs(ctx context.Context) (ids []int, err error) { + if rq.ctx.Unique == nil && rq.path != nil { + rq.Unique(true) + } + ctx = setContextOp(ctx, rq.ctx, "IDs") + if err = rq.Select(repository.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (rq *RepositoryQuery) IDsX(ctx context.Context) []int { + ids, err := rq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (rq *RepositoryQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, rq.ctx, "Count") + if err := rq.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, rq, querierCount[*RepositoryQuery](), rq.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (rq *RepositoryQuery) CountX(ctx context.Context) int { + count, err := rq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (rq *RepositoryQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, rq.ctx, "Exist") + switch _, err := rq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (rq *RepositoryQuery) ExistX(ctx context.Context) bool { + exist, err := rq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the RepositoryQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (rq *RepositoryQuery) Clone() *RepositoryQuery { + if rq == nil { + return nil + } + return &RepositoryQuery{ + config: rq.config, + ctx: rq.ctx.Clone(), + order: append([]repository.OrderOption{}, rq.order...), + inters: append([]Interceptor{}, rq.inters...), + predicates: append([]predicate.Repository{}, rq.predicates...), + withTomes: rq.withTomes.Clone(), + withOwner: rq.withOwner.Clone(), + // clone intermediate query. + sql: rq.sql.Clone(), + path: rq.path, + } +} + +// WithTomes tells the query-builder to eager-load the nodes that are connected to +// the "tomes" edge. The optional arguments are used to configure the query builder of the edge. +func (rq *RepositoryQuery) WithTomes(opts ...func(*TomeQuery)) *RepositoryQuery { + query := (&TomeClient{config: rq.config}).Query() + for _, opt := range opts { + opt(query) + } + rq.withTomes = query + return rq +} + +// WithOwner tells the query-builder to eager-load the nodes that are connected to +// the "owner" edge. The optional arguments are used to configure the query builder of the edge. +func (rq *RepositoryQuery) WithOwner(opts ...func(*UserQuery)) *RepositoryQuery { + query := (&UserClient{config: rq.config}).Query() + for _, opt := range opts { + opt(query) + } + rq.withOwner = query + return rq +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.Repository.Query(). +// GroupBy(repository.FieldCreatedAt). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (rq *RepositoryQuery) GroupBy(field string, fields ...string) *RepositoryGroupBy { + rq.ctx.Fields = append([]string{field}, fields...) + grbuild := &RepositoryGroupBy{build: rq} + grbuild.flds = &rq.ctx.Fields + grbuild.label = repository.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// CreatedAt time.Time `json:"created_at,omitempty"` +// } +// +// client.Repository.Query(). +// Select(repository.FieldCreatedAt). +// Scan(ctx, &v) +func (rq *RepositoryQuery) Select(fields ...string) *RepositorySelect { + rq.ctx.Fields = append(rq.ctx.Fields, fields...) + sbuild := &RepositorySelect{RepositoryQuery: rq} + sbuild.label = repository.Label + sbuild.flds, sbuild.scan = &rq.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a RepositorySelect configured with the given aggregations. +func (rq *RepositoryQuery) Aggregate(fns ...AggregateFunc) *RepositorySelect { + return rq.Select().Aggregate(fns...) +} + +func (rq *RepositoryQuery) prepareQuery(ctx context.Context) error { + for _, inter := range rq.inters { + if inter == nil { + return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, rq); err != nil { + return err + } + } + } + for _, f := range rq.ctx.Fields { + if !repository.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + } + if rq.path != nil { + prev, err := rq.path(ctx) + if err != nil { + return err + } + rq.sql = prev + } + return nil +} + +func (rq *RepositoryQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Repository, error) { + var ( + nodes = []*Repository{} + withFKs = rq.withFKs + _spec = rq.querySpec() + loadedTypes = [2]bool{ + rq.withTomes != nil, + rq.withOwner != nil, + } + ) + if rq.withOwner != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, repository.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*Repository).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &Repository{config: rq.config} + nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes + return node.assignValues(columns, values) + } + if len(rq.modifiers) > 0 { + _spec.Modifiers = rq.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, rq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + if query := rq.withTomes; query != nil { + if err := rq.loadTomes(ctx, query, nodes, + func(n *Repository) { n.Edges.Tomes = []*Tome{} }, + func(n *Repository, e *Tome) { n.Edges.Tomes = append(n.Edges.Tomes, e) }); err != nil { + return nil, err + } + } + if query := rq.withOwner; query != nil { + if err := rq.loadOwner(ctx, query, nodes, nil, + func(n *Repository, e *User) { n.Edges.Owner = e }); err != nil { + return nil, err + } + } + for name, query := range rq.withNamedTomes { + if err := rq.loadTomes(ctx, query, nodes, + func(n *Repository) { n.appendNamedTomes(name) }, + func(n *Repository, e *Tome) { n.appendNamedTomes(name, e) }); err != nil { + return nil, err + } + } + for i := range rq.loadTotal { + if err := rq.loadTotal[i](ctx, nodes); err != nil { + return nil, err + } + } + return nodes, nil +} + +func (rq *RepositoryQuery) loadTomes(ctx context.Context, query *TomeQuery, nodes []*Repository, init func(*Repository), assign func(*Repository, *Tome)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*Repository) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.Tome(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(repository.TomesColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.tome_repository + if fk == nil { + return fmt.Errorf(`foreign-key "tome_repository" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "tome_repository" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (rq *RepositoryQuery) loadOwner(ctx context.Context, query *UserQuery, nodes []*Repository, init func(*Repository), assign func(*Repository, *User)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Repository) + for i := range nodes { + if nodes[i].repository_owner == nil { + continue + } + fk := *nodes[i].repository_owner + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(user.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "repository_owner" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} + +func (rq *RepositoryQuery) sqlCount(ctx context.Context) (int, error) { + _spec := rq.querySpec() + if len(rq.modifiers) > 0 { + _spec.Modifiers = rq.modifiers + } + _spec.Node.Columns = rq.ctx.Fields + if len(rq.ctx.Fields) > 0 { + _spec.Unique = rq.ctx.Unique != nil && *rq.ctx.Unique + } + return sqlgraph.CountNodes(ctx, rq.driver, _spec) +} + +func (rq *RepositoryQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(repository.Table, repository.Columns, sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt)) + _spec.From = rq.sql + if unique := rq.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if rq.path != nil { + _spec.Unique = true + } + if fields := rq.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, repository.FieldID) + for i := range fields { + if fields[i] != repository.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := rq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := rq.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := rq.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := rq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (rq *RepositoryQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(rq.driver.Dialect()) + t1 := builder.Table(repository.Table) + columns := rq.ctx.Fields + if len(columns) == 0 { + columns = repository.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if rq.sql != nil { + selector = rq.sql + selector.Select(selector.Columns(columns...)...) + } + if rq.ctx.Unique != nil && *rq.ctx.Unique { + selector.Distinct() + } + for _, p := range rq.predicates { + p(selector) + } + for _, p := range rq.order { + p(selector) + } + if offset := rq.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := rq.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// WithNamedTomes tells the query-builder to eager-load the nodes that are connected to the "tomes" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (rq *RepositoryQuery) WithNamedTomes(name string, opts ...func(*TomeQuery)) *RepositoryQuery { + query := (&TomeClient{config: rq.config}).Query() + for _, opt := range opts { + opt(query) + } + if rq.withNamedTomes == nil { + rq.withNamedTomes = make(map[string]*TomeQuery) + } + rq.withNamedTomes[name] = query + return rq +} + +// RepositoryGroupBy is the group-by builder for Repository entities. +type RepositoryGroupBy struct { + selector + build *RepositoryQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (rgb *RepositoryGroupBy) Aggregate(fns ...AggregateFunc) *RepositoryGroupBy { + rgb.fns = append(rgb.fns, fns...) + return rgb +} + +// Scan applies the selector query and scans the result into the given value. +func (rgb *RepositoryGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, rgb.build.ctx, "GroupBy") + if err := rgb.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*RepositoryQuery, *RepositoryGroupBy](ctx, rgb.build, rgb, rgb.build.inters, v) +} + +func (rgb *RepositoryGroupBy) sqlScan(ctx context.Context, root *RepositoryQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(rgb.fns)) + for _, fn := range rgb.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*rgb.flds)+len(rgb.fns)) + for _, f := range *rgb.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*rgb.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := rgb.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// RepositorySelect is the builder for selecting fields of Repository entities. +type RepositorySelect struct { + *RepositoryQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (rs *RepositorySelect) Aggregate(fns ...AggregateFunc) *RepositorySelect { + rs.fns = append(rs.fns, fns...) + return rs +} + +// Scan applies the selector query and scans the result into the given value. +func (rs *RepositorySelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, rs.ctx, "Select") + if err := rs.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*RepositoryQuery, *RepositorySelect](ctx, rs.RepositoryQuery, rs, rs.inters, v) +} + +func (rs *RepositorySelect) sqlScan(ctx context.Context, root *RepositoryQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(rs.fns)) + for _, fn := range rs.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*rs.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := rs.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/tavern/internal/ent/repository_update.go b/tavern/internal/ent/repository_update.go new file mode 100644 index 000000000..e98c7182b --- /dev/null +++ b/tavern/internal/ent/repository_update.go @@ -0,0 +1,596 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/repository" + "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" +) + +// RepositoryUpdate is the builder for updating Repository entities. +type RepositoryUpdate struct { + config + hooks []Hook + mutation *RepositoryMutation +} + +// Where appends a list predicates to the RepositoryUpdate builder. +func (ru *RepositoryUpdate) Where(ps ...predicate.Repository) *RepositoryUpdate { + ru.mutation.Where(ps...) + return ru +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (ru *RepositoryUpdate) SetLastModifiedAt(t time.Time) *RepositoryUpdate { + ru.mutation.SetLastModifiedAt(t) + return ru +} + +// SetURL sets the "url" field. +func (ru *RepositoryUpdate) SetURL(s string) *RepositoryUpdate { + ru.mutation.SetURL(s) + return ru +} + +// SetPublicKey sets the "public_key" field. +func (ru *RepositoryUpdate) SetPublicKey(s string) *RepositoryUpdate { + ru.mutation.SetPublicKey(s) + return ru +} + +// SetPrivateKey sets the "private_key" field. +func (ru *RepositoryUpdate) SetPrivateKey(s string) *RepositoryUpdate { + ru.mutation.SetPrivateKey(s) + return ru +} + +// AddTomeIDs adds the "tomes" edge to the Tome entity by IDs. +func (ru *RepositoryUpdate) AddTomeIDs(ids ...int) *RepositoryUpdate { + ru.mutation.AddTomeIDs(ids...) + return ru +} + +// AddTomes adds the "tomes" edges to the Tome entity. +func (ru *RepositoryUpdate) AddTomes(t ...*Tome) *RepositoryUpdate { + ids := make([]int, len(t)) + for i := range t { + ids[i] = t[i].ID + } + return ru.AddTomeIDs(ids...) +} + +// SetOwnerID sets the "owner" edge to the User entity by ID. +func (ru *RepositoryUpdate) SetOwnerID(id int) *RepositoryUpdate { + ru.mutation.SetOwnerID(id) + return ru +} + +// SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil. +func (ru *RepositoryUpdate) SetNillableOwnerID(id *int) *RepositoryUpdate { + if id != nil { + ru = ru.SetOwnerID(*id) + } + return ru +} + +// SetOwner sets the "owner" edge to the User entity. +func (ru *RepositoryUpdate) SetOwner(u *User) *RepositoryUpdate { + return ru.SetOwnerID(u.ID) +} + +// Mutation returns the RepositoryMutation object of the builder. +func (ru *RepositoryUpdate) Mutation() *RepositoryMutation { + return ru.mutation +} + +// ClearTomes clears all "tomes" edges to the Tome entity. +func (ru *RepositoryUpdate) ClearTomes() *RepositoryUpdate { + ru.mutation.ClearTomes() + return ru +} + +// RemoveTomeIDs removes the "tomes" edge to Tome entities by IDs. +func (ru *RepositoryUpdate) RemoveTomeIDs(ids ...int) *RepositoryUpdate { + ru.mutation.RemoveTomeIDs(ids...) + return ru +} + +// RemoveTomes removes "tomes" edges to Tome entities. +func (ru *RepositoryUpdate) RemoveTomes(t ...*Tome) *RepositoryUpdate { + ids := make([]int, len(t)) + for i := range t { + ids[i] = t[i].ID + } + return ru.RemoveTomeIDs(ids...) +} + +// ClearOwner clears the "owner" edge to the User entity. +func (ru *RepositoryUpdate) ClearOwner() *RepositoryUpdate { + ru.mutation.ClearOwner() + return ru +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (ru *RepositoryUpdate) Save(ctx context.Context) (int, error) { + if err := ru.defaults(); err != nil { + return 0, err + } + return withHooks(ctx, ru.sqlSave, ru.mutation, ru.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (ru *RepositoryUpdate) SaveX(ctx context.Context) int { + affected, err := ru.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (ru *RepositoryUpdate) Exec(ctx context.Context) error { + _, err := ru.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (ru *RepositoryUpdate) ExecX(ctx context.Context) { + if err := ru.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (ru *RepositoryUpdate) defaults() error { + if _, ok := ru.mutation.LastModifiedAt(); !ok { + if repository.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized repository.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := repository.UpdateDefaultLastModifiedAt() + ru.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (ru *RepositoryUpdate) check() error { + if v, ok := ru.mutation.URL(); ok { + if err := repository.URLValidator(v); err != nil { + return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Repository.url": %w`, err)} + } + } + if v, ok := ru.mutation.PublicKey(); ok { + if err := repository.PublicKeyValidator(v); err != nil { + return &ValidationError{Name: "public_key", err: fmt.Errorf(`ent: validator failed for field "Repository.public_key": %w`, err)} + } + } + if v, ok := ru.mutation.PrivateKey(); ok { + if err := repository.PrivateKeyValidator(v); err != nil { + return &ValidationError{Name: "private_key", err: fmt.Errorf(`ent: validator failed for field "Repository.private_key": %w`, err)} + } + } + return nil +} + +func (ru *RepositoryUpdate) sqlSave(ctx context.Context) (n int, err error) { + if err := ru.check(); err != nil { + return n, err + } + _spec := sqlgraph.NewUpdateSpec(repository.Table, repository.Columns, sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt)) + if ps := ru.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := ru.mutation.LastModifiedAt(); ok { + _spec.SetField(repository.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := ru.mutation.URL(); ok { + _spec.SetField(repository.FieldURL, field.TypeString, value) + } + if value, ok := ru.mutation.PublicKey(); ok { + _spec.SetField(repository.FieldPublicKey, field.TypeString, value) + } + if value, ok := ru.mutation.PrivateKey(); ok { + _spec.SetField(repository.FieldPrivateKey, field.TypeString, value) + } + if ru.mutation.TomesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ru.mutation.RemovedTomesIDs(); len(nodes) > 0 && !ru.mutation.TomesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ru.mutation.TomesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if ru.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: repository.OwnerTable, + Columns: []string{repository.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ru.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: repository.OwnerTable, + Columns: []string{repository.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if n, err = sqlgraph.UpdateNodes(ctx, ru.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{repository.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + ru.mutation.done = true + return n, nil +} + +// RepositoryUpdateOne is the builder for updating a single Repository entity. +type RepositoryUpdateOne struct { + config + fields []string + hooks []Hook + mutation *RepositoryMutation +} + +// SetLastModifiedAt sets the "last_modified_at" field. +func (ruo *RepositoryUpdateOne) SetLastModifiedAt(t time.Time) *RepositoryUpdateOne { + ruo.mutation.SetLastModifiedAt(t) + return ruo +} + +// SetURL sets the "url" field. +func (ruo *RepositoryUpdateOne) SetURL(s string) *RepositoryUpdateOne { + ruo.mutation.SetURL(s) + return ruo +} + +// SetPublicKey sets the "public_key" field. +func (ruo *RepositoryUpdateOne) SetPublicKey(s string) *RepositoryUpdateOne { + ruo.mutation.SetPublicKey(s) + return ruo +} + +// SetPrivateKey sets the "private_key" field. +func (ruo *RepositoryUpdateOne) SetPrivateKey(s string) *RepositoryUpdateOne { + ruo.mutation.SetPrivateKey(s) + return ruo +} + +// AddTomeIDs adds the "tomes" edge to the Tome entity by IDs. +func (ruo *RepositoryUpdateOne) AddTomeIDs(ids ...int) *RepositoryUpdateOne { + ruo.mutation.AddTomeIDs(ids...) + return ruo +} + +// AddTomes adds the "tomes" edges to the Tome entity. +func (ruo *RepositoryUpdateOne) AddTomes(t ...*Tome) *RepositoryUpdateOne { + ids := make([]int, len(t)) + for i := range t { + ids[i] = t[i].ID + } + return ruo.AddTomeIDs(ids...) +} + +// SetOwnerID sets the "owner" edge to the User entity by ID. +func (ruo *RepositoryUpdateOne) SetOwnerID(id int) *RepositoryUpdateOne { + ruo.mutation.SetOwnerID(id) + return ruo +} + +// SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil. +func (ruo *RepositoryUpdateOne) SetNillableOwnerID(id *int) *RepositoryUpdateOne { + if id != nil { + ruo = ruo.SetOwnerID(*id) + } + return ruo +} + +// SetOwner sets the "owner" edge to the User entity. +func (ruo *RepositoryUpdateOne) SetOwner(u *User) *RepositoryUpdateOne { + return ruo.SetOwnerID(u.ID) +} + +// Mutation returns the RepositoryMutation object of the builder. +func (ruo *RepositoryUpdateOne) Mutation() *RepositoryMutation { + return ruo.mutation +} + +// ClearTomes clears all "tomes" edges to the Tome entity. +func (ruo *RepositoryUpdateOne) ClearTomes() *RepositoryUpdateOne { + ruo.mutation.ClearTomes() + return ruo +} + +// RemoveTomeIDs removes the "tomes" edge to Tome entities by IDs. +func (ruo *RepositoryUpdateOne) RemoveTomeIDs(ids ...int) *RepositoryUpdateOne { + ruo.mutation.RemoveTomeIDs(ids...) + return ruo +} + +// RemoveTomes removes "tomes" edges to Tome entities. +func (ruo *RepositoryUpdateOne) RemoveTomes(t ...*Tome) *RepositoryUpdateOne { + ids := make([]int, len(t)) + for i := range t { + ids[i] = t[i].ID + } + return ruo.RemoveTomeIDs(ids...) +} + +// ClearOwner clears the "owner" edge to the User entity. +func (ruo *RepositoryUpdateOne) ClearOwner() *RepositoryUpdateOne { + ruo.mutation.ClearOwner() + return ruo +} + +// Where appends a list predicates to the RepositoryUpdate builder. +func (ruo *RepositoryUpdateOne) Where(ps ...predicate.Repository) *RepositoryUpdateOne { + ruo.mutation.Where(ps...) + return ruo +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ruo *RepositoryUpdateOne) Select(field string, fields ...string) *RepositoryUpdateOne { + ruo.fields = append([]string{field}, fields...) + return ruo +} + +// Save executes the query and returns the updated Repository entity. +func (ruo *RepositoryUpdateOne) Save(ctx context.Context) (*Repository, error) { + if err := ruo.defaults(); err != nil { + return nil, err + } + return withHooks(ctx, ruo.sqlSave, ruo.mutation, ruo.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (ruo *RepositoryUpdateOne) SaveX(ctx context.Context) *Repository { + node, err := ruo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (ruo *RepositoryUpdateOne) Exec(ctx context.Context) error { + _, err := ruo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (ruo *RepositoryUpdateOne) ExecX(ctx context.Context) { + if err := ruo.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (ruo *RepositoryUpdateOne) defaults() error { + if _, ok := ruo.mutation.LastModifiedAt(); !ok { + if repository.UpdateDefaultLastModifiedAt == nil { + return fmt.Errorf("ent: uninitialized repository.UpdateDefaultLastModifiedAt (forgotten import ent/runtime?)") + } + v := repository.UpdateDefaultLastModifiedAt() + ruo.mutation.SetLastModifiedAt(v) + } + return nil +} + +// check runs all checks and user-defined validators on the builder. +func (ruo *RepositoryUpdateOne) check() error { + if v, ok := ruo.mutation.URL(); ok { + if err := repository.URLValidator(v); err != nil { + return &ValidationError{Name: "url", err: fmt.Errorf(`ent: validator failed for field "Repository.url": %w`, err)} + } + } + if v, ok := ruo.mutation.PublicKey(); ok { + if err := repository.PublicKeyValidator(v); err != nil { + return &ValidationError{Name: "public_key", err: fmt.Errorf(`ent: validator failed for field "Repository.public_key": %w`, err)} + } + } + if v, ok := ruo.mutation.PrivateKey(); ok { + if err := repository.PrivateKeyValidator(v); err != nil { + return &ValidationError{Name: "private_key", err: fmt.Errorf(`ent: validator failed for field "Repository.private_key": %w`, err)} + } + } + return nil +} + +func (ruo *RepositoryUpdateOne) sqlSave(ctx context.Context) (_node *Repository, err error) { + if err := ruo.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(repository.Table, repository.Columns, sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt)) + id, ok := ruo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Repository.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := ruo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, repository.FieldID) + for _, f := range fields { + if !repository.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != repository.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := ruo.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := ruo.mutation.LastModifiedAt(); ok { + _spec.SetField(repository.FieldLastModifiedAt, field.TypeTime, value) + } + if value, ok := ruo.mutation.URL(); ok { + _spec.SetField(repository.FieldURL, field.TypeString, value) + } + if value, ok := ruo.mutation.PublicKey(); ok { + _spec.SetField(repository.FieldPublicKey, field.TypeString, value) + } + if value, ok := ruo.mutation.PrivateKey(); ok { + _spec.SetField(repository.FieldPrivateKey, field.TypeString, value) + } + if ruo.mutation.TomesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ruo.mutation.RemovedTomesIDs(); len(nodes) > 0 && !ruo.mutation.TomesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ruo.mutation.TomesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: repository.TomesTable, + Columns: []string{repository.TomesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(tome.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if ruo.mutation.OwnerCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: repository.OwnerTable, + Columns: []string{repository.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ruo.mutation.OwnerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: repository.OwnerTable, + Columns: []string{repository.OwnerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &Repository{config: ruo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, ruo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{repository.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + ruo.mutation.done = true + return _node, nil +} diff --git a/tavern/internal/ent/runtime/runtime.go b/tavern/internal/ent/runtime/runtime.go index 4fdee078d..42209f60b 100644 --- a/tavern/internal/ent/runtime/runtime.go +++ b/tavern/internal/ent/runtime/runtime.go @@ -12,6 +12,7 @@ import ( "realm.pub/tavern/internal/ent/hostfile" "realm.pub/tavern/internal/ent/hostprocess" "realm.pub/tavern/internal/ent/quest" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/schema" "realm.pub/tavern/internal/ent/tag" "realm.pub/tavern/internal/ent/task" @@ -208,6 +209,35 @@ func init() { questDescParameters := questFields[1].Descriptor() // quest.ParametersValidator is a validator for the "parameters" field. It is called by the builders before save. quest.ParametersValidator = questDescParameters.Validators[0].(func(string) error) + repositoryMixin := schema.Repository{}.Mixin() + repositoryHooks := schema.Repository{}.Hooks() + repository.Hooks[0] = repositoryHooks[0] + repositoryMixinFields0 := repositoryMixin[0].Fields() + _ = repositoryMixinFields0 + repositoryFields := schema.Repository{}.Fields() + _ = repositoryFields + // repositoryDescCreatedAt is the schema descriptor for created_at field. + repositoryDescCreatedAt := repositoryMixinFields0[0].Descriptor() + // repository.DefaultCreatedAt holds the default value on creation for the created_at field. + repository.DefaultCreatedAt = repositoryDescCreatedAt.Default.(func() time.Time) + // repositoryDescLastModifiedAt is the schema descriptor for last_modified_at field. + repositoryDescLastModifiedAt := repositoryMixinFields0[1].Descriptor() + // repository.DefaultLastModifiedAt holds the default value on creation for the last_modified_at field. + repository.DefaultLastModifiedAt = repositoryDescLastModifiedAt.Default.(func() time.Time) + // repository.UpdateDefaultLastModifiedAt holds the default value on update for the last_modified_at field. + repository.UpdateDefaultLastModifiedAt = repositoryDescLastModifiedAt.UpdateDefault.(func() time.Time) + // repositoryDescURL is the schema descriptor for url field. + repositoryDescURL := repositoryFields[0].Descriptor() + // repository.URLValidator is a validator for the "url" field. It is called by the builders before save. + repository.URLValidator = repositoryDescURL.Validators[0].(func(string) error) + // repositoryDescPublicKey is the schema descriptor for public_key field. + repositoryDescPublicKey := repositoryFields[1].Descriptor() + // repository.PublicKeyValidator is a validator for the "public_key" field. It is called by the builders before save. + repository.PublicKeyValidator = repositoryDescPublicKey.Validators[0].(func(string) error) + // repositoryDescPrivateKey is the schema descriptor for private_key field. + repositoryDescPrivateKey := repositoryFields[2].Descriptor() + // repository.PrivateKeyValidator is a validator for the "private_key" field. It is called by the builders before save. + repository.PrivateKeyValidator = repositoryDescPrivateKey.Validators[0].(func(string) error) tagFields := schema.Tag{}.Fields() _ = tagFields // tagDescName is the schema descriptor for name field. diff --git a/tavern/internal/ent/schema/repository.go b/tavern/internal/ent/schema/repository.go new file mode 100644 index 000000000..230b732f2 --- /dev/null +++ b/tavern/internal/ent/schema/repository.go @@ -0,0 +1,144 @@ +package schema + +import ( + "context" + "crypto/ed25519" + "crypto/rand" + "encoding/pem" + "fmt" + "strings" + + "entgo.io/contrib/entgql" + "entgo.io/ent" + "entgo.io/ent/dialect/entsql" + "entgo.io/ent/schema" + "entgo.io/ent/schema/edge" + "entgo.io/ent/schema/field" + "golang.org/x/crypto/ssh" + "realm.pub/tavern/internal/ent/hook" +) + +// Repository holds the schema definition for the entity. +type Repository struct { + ent.Schema +} + +// Fields of the ent. +func (Repository) Fields() []ent.Field { + return []ent.Field{ + field.String("url"). + NotEmpty(). + Unique(). + Comment("URL of the repository"), + field.String("public_key"). + NotEmpty(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput | entgql.SkipMutationUpdateInput), + ). + Comment("Public key associated with this repositories private key"), + field.String("private_key"). + NotEmpty(). + Sensitive(). + Annotations( + entgql.Skip(entgql.SkipAll), + ). + Comment("Private key used for authentication."), + } +} + +// Edges of the ent. +func (Repository) Edges() []ent.Edge { + return []ent.Edge{ + edge.From("tomes", Tome.Type). + Ref("repository"). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + ). + Comment("Tomes imported using this repository."), + edge.To("owner", User.Type). + Unique(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + ). + Comment("User that created this repository."), + } +} + +// Annotations describes additional information for the ent. +func (Repository) Annotations() []schema.Annotation { + return []schema.Annotation{ + entgql.Mutations(entgql.MutationCreate()), + entgql.RelayConnection(), + entgql.MultiOrder(), + entsql.Annotation{Table: "repositories"}, + } +} + +// Mixin defines common shared properties for the ent. +func (Repository) Mixin() []ent.Mixin { + return []ent.Mixin{ + MixinHistory{}, // createdAt, lastModifiedAt + } +} + +// Hooks defines middleware for mutations for the ent. +func (Repository) Hooks() []ent.Hook { + return []ent.Hook{ + hook.On(HookCreateRepoPrivateKey(), ent.OpCreate), + } +} + +// HookCreateRepoPrivateKey will generate private key for the repository upon creation. +func HookCreateRepoPrivateKey() ent.Hook { + // Get the relevant methods from the Mutation + // See this example: https://github.com/ent/ent/blob/master/entc/integration/hooks/ent/schema/user.go#L98 + type tMutation interface { + URL() (string, bool) + SetURL(string) + PrivateKey() (string, bool) + SetPrivateKey(s string) + SetPublicKey(s string) + } + + return func(next ent.Mutator) ent.Mutator { + return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { + // Get the mutation + mut, ok := m.(tMutation) + if !ok { + return nil, fmt.Errorf("expected repository mutation in schema hook, got: %+v", m) + } + + // Prepend https schema if no schema specified + if u, ok := mut.URL(); ok && (!strings.HasPrefix(u, "http://") && !strings.HasPrefix(u, "ssh://")) { + mut.SetURL(fmt.Sprintf("https://%s", u)) + } + + // Skip if key already set + if key, ok := mut.PrivateKey(); ok && key != "" { + return next.Mutate(ctx, m) + } + + // Generate new key + _, privKey, err := ed25519.GenerateKey(rand.Reader) + if err != nil { + return nil, fmt.Errorf("failed to generate ed25519 private key: %w", err) + } + + // Marshal Keys + signer, err := ssh.NewSignerFromKey(privKey) + if err != nil { + return nil, fmt.Errorf("could not convert private key to ssh signer: %v", err) + } + + block, err := ssh.MarshalPrivateKey(privKey, "") + if err != nil || block == nil { + return nil, fmt.Errorf("failed to marshal ssh private key: %w", err) + } + + mut.SetPrivateKey(string(pem.EncodeToMemory(block))) + mut.SetPublicKey(string(ssh.MarshalAuthorizedKey(signer.PublicKey()))) + + return next.Mutate(ctx, m) + }) + } +} diff --git a/tavern/internal/ent/schema/tome.go b/tavern/internal/ent/schema/tome.go index 0b455950a..5cbb25237 100644 --- a/tavern/internal/ent/schema/tome.go +++ b/tavern/internal/ent/schema/tome.go @@ -90,6 +90,12 @@ func (Tome) Edges() []ent.Edge { entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), ). Comment("User who uploaded the tome (may be null)."), + edge.To("repository", Repository.Type). + Unique(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + ). + Comment("Repository from which this Tome was imported (may be null)."), } } diff --git a/tavern/internal/ent/tome.go b/tavern/internal/ent/tome.go index dfba08795..19b1eedff 100644 --- a/tavern/internal/ent/tome.go +++ b/tavern/internal/ent/tome.go @@ -9,6 +9,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" ) @@ -40,9 +41,10 @@ type Tome struct { Eldritch string `json:"eldritch,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TomeQuery when eager-loading is set. - Edges TomeEdges `json:"edges"` - tome_uploader *int - selectValues sql.SelectValues + Edges TomeEdges `json:"edges"` + tome_uploader *int + tome_repository *int + selectValues sql.SelectValues } // TomeEdges holds the relations/edges for other nodes in the graph. @@ -51,11 +53,13 @@ type TomeEdges struct { Files []*File `json:"files,omitempty"` // User who uploaded the tome (may be null). Uploader *User `json:"uploader,omitempty"` + // Repository from which this Tome was imported (may be null). + Repository *Repository `json:"repository,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool + loadedTypes [3]bool // totalCount holds the count of the edges above. - totalCount [2]map[string]int + totalCount [3]map[string]int namedFiles map[string][]*File } @@ -82,6 +86,19 @@ func (e TomeEdges) UploaderOrErr() (*User, error) { return nil, &NotLoadedError{edge: "uploader"} } +// RepositoryOrErr returns the Repository value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e TomeEdges) RepositoryOrErr() (*Repository, error) { + if e.loadedTypes[2] { + if e.Repository == nil { + // Edge was loaded but was not found. + return nil, &NotFoundError{label: repository.Label} + } + return e.Repository, nil + } + return nil, &NotLoadedError{edge: "repository"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Tome) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -95,6 +112,8 @@ func (*Tome) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullTime) case tome.ForeignKeys[0]: // tome_uploader values[i] = new(sql.NullInt64) + case tome.ForeignKeys[1]: // tome_repository + values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) } @@ -183,6 +202,13 @@ func (t *Tome) assignValues(columns []string, values []any) error { t.tome_uploader = new(int) *t.tome_uploader = int(value.Int64) } + case tome.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field tome_repository", value) + } else if value.Valid { + t.tome_repository = new(int) + *t.tome_repository = int(value.Int64) + } default: t.selectValues.Set(columns[i], values[i]) } @@ -206,6 +232,11 @@ func (t *Tome) QueryUploader() *UserQuery { return NewTomeClient(t.config).QueryUploader(t) } +// QueryRepository queries the "repository" edge of the Tome entity. +func (t *Tome) QueryRepository() *RepositoryQuery { + return NewTomeClient(t.config).QueryRepository(t) +} + // Update returns a builder for updating this Tome. // Note that you need to call Tome.Unwrap() before calling this method if this Tome // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/tavern/internal/ent/tome/tome.go b/tavern/internal/ent/tome/tome.go index c5029cb58..a35367e5a 100644 --- a/tavern/internal/ent/tome/tome.go +++ b/tavern/internal/ent/tome/tome.go @@ -42,6 +42,8 @@ const ( EdgeFiles = "files" // EdgeUploader holds the string denoting the uploader edge name in mutations. EdgeUploader = "uploader" + // EdgeRepository holds the string denoting the repository edge name in mutations. + EdgeRepository = "repository" // Table holds the table name of the tome in the database. Table = "tomes" // FilesTable is the table that holds the files relation/edge. The primary key declared below. @@ -56,6 +58,13 @@ const ( UploaderInverseTable = "users" // UploaderColumn is the table column denoting the uploader relation/edge. UploaderColumn = "tome_uploader" + // RepositoryTable is the table that holds the repository relation/edge. + RepositoryTable = "tomes" + // RepositoryInverseTable is the table name for the Repository entity. + // It exists in this package in order to avoid circular dependency with the "repository" package. + RepositoryInverseTable = "repositories" + // RepositoryColumn is the table column denoting the repository relation/edge. + RepositoryColumn = "tome_repository" ) // Columns holds all SQL columns for tome fields. @@ -77,6 +86,7 @@ var Columns = []string{ // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "tome_uploader", + "tome_repository", } var ( @@ -265,6 +275,13 @@ func ByUploaderField(field string, opts ...sql.OrderTermOption) OrderOption { sqlgraph.OrderByNeighborTerms(s, newUploaderStep(), sql.OrderByField(field, opts...)) } } + +// ByRepositoryField orders the results by repository field. +func ByRepositoryField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newRepositoryStep(), sql.OrderByField(field, opts...)) + } +} func newFilesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -279,6 +296,13 @@ func newUploaderStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2O, false, UploaderTable, UploaderColumn), ) } +func newRepositoryStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(RepositoryInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, RepositoryTable, RepositoryColumn), + ) +} // MarshalGQL implements graphql.Marshaler interface. func (e SupportModel) MarshalGQL(w io.Writer) { diff --git a/tavern/internal/ent/tome/where.go b/tavern/internal/ent/tome/where.go index bef67df1c..16e4c2217 100644 --- a/tavern/internal/ent/tome/where.go +++ b/tavern/internal/ent/tome/where.go @@ -661,6 +661,29 @@ func HasUploaderWith(preds ...predicate.User) predicate.Tome { }) } +// HasRepository applies the HasEdge predicate on the "repository" edge. +func HasRepository() predicate.Tome { + return predicate.Tome(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, RepositoryTable, RepositoryColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasRepositoryWith applies the HasEdge predicate on the "repository" edge with a given conditions (other predicates). +func HasRepositoryWith(preds ...predicate.Repository) predicate.Tome { + return predicate.Tome(func(s *sql.Selector) { + step := newRepositoryStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Tome) predicate.Tome { return predicate.Tome(sql.AndPredicates(predicates...)) diff --git a/tavern/internal/ent/tome_create.go b/tavern/internal/ent/tome_create.go index 01665df67..8bd826975 100644 --- a/tavern/internal/ent/tome_create.go +++ b/tavern/internal/ent/tome_create.go @@ -12,6 +12,7 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/file" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" ) @@ -158,6 +159,25 @@ func (tc *TomeCreate) SetUploader(u *User) *TomeCreate { return tc.SetUploaderID(u.ID) } +// SetRepositoryID sets the "repository" edge to the Repository entity by ID. +func (tc *TomeCreate) SetRepositoryID(id int) *TomeCreate { + tc.mutation.SetRepositoryID(id) + return tc +} + +// SetNillableRepositoryID sets the "repository" edge to the Repository entity by ID if the given value is not nil. +func (tc *TomeCreate) SetNillableRepositoryID(id *int) *TomeCreate { + if id != nil { + tc = tc.SetRepositoryID(*id) + } + return tc +} + +// SetRepository sets the "repository" edge to the Repository entity. +func (tc *TomeCreate) SetRepository(r *Repository) *TomeCreate { + return tc.SetRepositoryID(r.ID) +} + // Mutation returns the TomeMutation object of the builder. func (tc *TomeCreate) Mutation() *TomeMutation { return tc.mutation @@ -374,6 +394,23 @@ func (tc *TomeCreate) createSpec() (*Tome, *sqlgraph.CreateSpec) { _node.tome_uploader = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } + if nodes := tc.mutation.RepositoryIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: tome.RepositoryTable, + Columns: []string{tome.RepositoryColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.tome_repository = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/tavern/internal/ent/tome_query.go b/tavern/internal/ent/tome_query.go index 935452e7f..9d8d81e45 100644 --- a/tavern/internal/ent/tome_query.go +++ b/tavern/internal/ent/tome_query.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/file" "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" ) @@ -26,6 +27,7 @@ type TomeQuery struct { predicates []predicate.Tome withFiles *FileQuery withUploader *UserQuery + withRepository *RepositoryQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Tome) error @@ -110,6 +112,28 @@ func (tq *TomeQuery) QueryUploader() *UserQuery { return query } +// QueryRepository chains the current query on the "repository" edge. +func (tq *TomeQuery) QueryRepository() *RepositoryQuery { + query := (&RepositoryClient{config: tq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := tq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := tq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(tome.Table, tome.FieldID, selector), + sqlgraph.To(repository.Table, repository.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, tome.RepositoryTable, tome.RepositoryColumn), + ) + fromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Tome entity from the query. // Returns a *NotFoundError when no Tome was found. func (tq *TomeQuery) First(ctx context.Context) (*Tome, error) { @@ -297,13 +321,14 @@ func (tq *TomeQuery) Clone() *TomeQuery { return nil } return &TomeQuery{ - config: tq.config, - ctx: tq.ctx.Clone(), - order: append([]tome.OrderOption{}, tq.order...), - inters: append([]Interceptor{}, tq.inters...), - predicates: append([]predicate.Tome{}, tq.predicates...), - withFiles: tq.withFiles.Clone(), - withUploader: tq.withUploader.Clone(), + config: tq.config, + ctx: tq.ctx.Clone(), + order: append([]tome.OrderOption{}, tq.order...), + inters: append([]Interceptor{}, tq.inters...), + predicates: append([]predicate.Tome{}, tq.predicates...), + withFiles: tq.withFiles.Clone(), + withUploader: tq.withUploader.Clone(), + withRepository: tq.withRepository.Clone(), // clone intermediate query. sql: tq.sql.Clone(), path: tq.path, @@ -332,6 +357,17 @@ func (tq *TomeQuery) WithUploader(opts ...func(*UserQuery)) *TomeQuery { return tq } +// WithRepository tells the query-builder to eager-load the nodes that are connected to +// the "repository" edge. The optional arguments are used to configure the query builder of the edge. +func (tq *TomeQuery) WithRepository(opts ...func(*RepositoryQuery)) *TomeQuery { + query := (&RepositoryClient{config: tq.config}).Query() + for _, opt := range opts { + opt(query) + } + tq.withRepository = query + return tq +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -411,12 +447,13 @@ func (tq *TomeQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Tome, e nodes = []*Tome{} withFKs = tq.withFKs _spec = tq.querySpec() - loadedTypes = [2]bool{ + loadedTypes = [3]bool{ tq.withFiles != nil, tq.withUploader != nil, + tq.withRepository != nil, } ) - if tq.withUploader != nil { + if tq.withUploader != nil || tq.withRepository != nil { withFKs = true } if withFKs { @@ -456,6 +493,12 @@ func (tq *TomeQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Tome, e return nil, err } } + if query := tq.withRepository; query != nil { + if err := tq.loadRepository(ctx, query, nodes, nil, + func(n *Tome, e *Repository) { n.Edges.Repository = e }); err != nil { + return nil, err + } + } for name, query := range tq.withNamedFiles { if err := tq.loadFiles(ctx, query, nodes, func(n *Tome) { n.appendNamedFiles(name) }, @@ -564,6 +607,38 @@ func (tq *TomeQuery) loadUploader(ctx context.Context, query *UserQuery, nodes [ } return nil } +func (tq *TomeQuery) loadRepository(ctx context.Context, query *RepositoryQuery, nodes []*Tome, init func(*Tome), assign func(*Tome, *Repository)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Tome) + for i := range nodes { + if nodes[i].tome_repository == nil { + continue + } + fk := *nodes[i].tome_repository + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(repository.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "tome_repository" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (tq *TomeQuery) sqlCount(ctx context.Context) (int, error) { _spec := tq.querySpec() diff --git a/tavern/internal/ent/tome_update.go b/tavern/internal/ent/tome_update.go index b6bf03bb6..deded9ff5 100644 --- a/tavern/internal/ent/tome_update.go +++ b/tavern/internal/ent/tome_update.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/file" "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/repository" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" ) @@ -148,6 +149,25 @@ func (tu *TomeUpdate) SetUploader(u *User) *TomeUpdate { return tu.SetUploaderID(u.ID) } +// SetRepositoryID sets the "repository" edge to the Repository entity by ID. +func (tu *TomeUpdate) SetRepositoryID(id int) *TomeUpdate { + tu.mutation.SetRepositoryID(id) + return tu +} + +// SetNillableRepositoryID sets the "repository" edge to the Repository entity by ID if the given value is not nil. +func (tu *TomeUpdate) SetNillableRepositoryID(id *int) *TomeUpdate { + if id != nil { + tu = tu.SetRepositoryID(*id) + } + return tu +} + +// SetRepository sets the "repository" edge to the Repository entity. +func (tu *TomeUpdate) SetRepository(r *Repository) *TomeUpdate { + return tu.SetRepositoryID(r.ID) +} + // Mutation returns the TomeMutation object of the builder. func (tu *TomeUpdate) Mutation() *TomeMutation { return tu.mutation @@ -180,6 +200,12 @@ func (tu *TomeUpdate) ClearUploader() *TomeUpdate { return tu } +// ClearRepository clears the "repository" edge to the Repository entity. +func (tu *TomeUpdate) ClearRepository() *TomeUpdate { + tu.mutation.ClearRepository() + return tu +} + // Save executes the query and returns the number of nodes affected by the update operation. func (tu *TomeUpdate) Save(ctx context.Context) (int, error) { if err := tu.defaults(); err != nil { @@ -368,6 +394,35 @@ func (tu *TomeUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if tu.mutation.RepositoryCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: tome.RepositoryTable, + Columns: []string{tome.RepositoryColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := tu.mutation.RepositoryIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: tome.RepositoryTable, + Columns: []string{tome.RepositoryColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, tu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{tome.Label} @@ -506,6 +561,25 @@ func (tuo *TomeUpdateOne) SetUploader(u *User) *TomeUpdateOne { return tuo.SetUploaderID(u.ID) } +// SetRepositoryID sets the "repository" edge to the Repository entity by ID. +func (tuo *TomeUpdateOne) SetRepositoryID(id int) *TomeUpdateOne { + tuo.mutation.SetRepositoryID(id) + return tuo +} + +// SetNillableRepositoryID sets the "repository" edge to the Repository entity by ID if the given value is not nil. +func (tuo *TomeUpdateOne) SetNillableRepositoryID(id *int) *TomeUpdateOne { + if id != nil { + tuo = tuo.SetRepositoryID(*id) + } + return tuo +} + +// SetRepository sets the "repository" edge to the Repository entity. +func (tuo *TomeUpdateOne) SetRepository(r *Repository) *TomeUpdateOne { + return tuo.SetRepositoryID(r.ID) +} + // Mutation returns the TomeMutation object of the builder. func (tuo *TomeUpdateOne) Mutation() *TomeMutation { return tuo.mutation @@ -538,6 +612,12 @@ func (tuo *TomeUpdateOne) ClearUploader() *TomeUpdateOne { return tuo } +// ClearRepository clears the "repository" edge to the Repository entity. +func (tuo *TomeUpdateOne) ClearRepository() *TomeUpdateOne { + tuo.mutation.ClearRepository() + return tuo +} + // Where appends a list predicates to the TomeUpdate builder. func (tuo *TomeUpdateOne) Where(ps ...predicate.Tome) *TomeUpdateOne { tuo.mutation.Where(ps...) @@ -756,6 +836,35 @@ func (tuo *TomeUpdateOne) sqlSave(ctx context.Context) (_node *Tome, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if tuo.mutation.RepositoryCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: tome.RepositoryTable, + Columns: []string{tome.RepositoryColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := tuo.mutation.RepositoryIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: tome.RepositoryTable, + Columns: []string{tome.RepositoryColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(repository.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Tome{config: tuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/tavern/internal/ent/tx.go b/tavern/internal/ent/tx.go index cfb11d6a3..6f99c25d9 100644 --- a/tavern/internal/ent/tx.go +++ b/tavern/internal/ent/tx.go @@ -26,6 +26,8 @@ type Tx struct { HostProcess *HostProcessClient // Quest is the client for interacting with the Quest builders. Quest *QuestClient + // Repository is the client for interacting with the Repository builders. + Repository *RepositoryClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // Task is the client for interacting with the Task builders. @@ -172,6 +174,7 @@ func (tx *Tx) init() { tx.HostFile = NewHostFileClient(tx.config) tx.HostProcess = NewHostProcessClient(tx.config) tx.Quest = NewQuestClient(tx.config) + tx.Repository = NewRepositoryClient(tx.config) tx.Tag = NewTagClient(tx.config) tx.Task = NewTaskClient(tx.config) tx.Tome = NewTomeClient(tx.config) diff --git a/tavern/internal/graphql/api_test.go b/tavern/internal/graphql/api_test.go index 8377d3b68..75046c9e1 100644 --- a/tavern/internal/graphql/api_test.go +++ b/tavern/internal/graphql/api_test.go @@ -1,6 +1,7 @@ package graphql_test import ( + "context" "database/sql" "encoding/json" "net/http" @@ -11,7 +12,9 @@ import ( "time" "realm.pub/tavern/internal/auth" + "realm.pub/tavern/internal/ent" "realm.pub/tavern/internal/ent/enttest" + "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/graphql" tavernhttp "realm.pub/tavern/internal/http" @@ -34,6 +37,27 @@ type testCase struct { ExpectedError string `yaml:"expected_error"` } +type importerFake struct { + graph *ent.Client +} + +// Import fake imports a simple static tome for testing. +func (fake importerFake) Import(ctx context.Context, repo *ent.Repository, filters ...func(path string) bool) error { + _, err := fake.graph.Tome.Create(). + SetName("expected_tome"). + SetDescription("expected_description"). + SetAuthor("expected_author"). + SetParamDefs(""). + SetSupportModel(tome.SupportModelCOMMUNITY). + SetTactic(tome.TacticIMPACT). + SetEldritch(`print("expected")`). + SetRepository(repo). + OnConflict(). + UpdateNewValues(). + ID(ctx) + return err +} + func runTestCase(t *testing.T, path string) { t.Helper() @@ -70,7 +94,7 @@ func runTestCase(t *testing.T, path string) { // Server srv := tavernhttp.NewServer( tavernhttp.RouteMap{ - "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph)), + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, importerFake{graph})), }, tavernhttp.WithAuthentication(graph), ) diff --git a/tavern/internal/graphql/generated/ent.generated.go b/tavern/internal/graphql/generated/ent.generated.go index 4d6b771f4..0ecfbbac9 100644 --- a/tavern/internal/graphql/generated/ent.generated.go +++ b/tavern/internal/graphql/generated/ent.generated.go @@ -30,6 +30,7 @@ type QueryResolver interface { Files(ctx context.Context, where *ent.FileWhereInput) ([]*ent.File, error) Quests(ctx context.Context, where *ent.QuestWhereInput) ([]*ent.Quest, error) Tasks(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TaskOrder, where *ent.TaskWhereInput) (*ent.TaskConnection, error) + Repositories(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.RepositoryOrder, where *ent.RepositoryWhereInput) (*ent.RepositoryConnection, error) Beacons(ctx context.Context, where *ent.BeaconWhereInput) ([]*ent.Beacon, error) Hosts(ctx context.Context, where *ent.HostWhereInput) ([]*ent.Host, error) Tags(ctx context.Context, where *ent.TagWhereInput) ([]*ent.Tag, error) @@ -147,6 +148,66 @@ func (ec *executionContext) field_Query_quests_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_repositories_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *entgql.Cursor[int] + if tmp, ok := rawArgs["after"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + arg0, err = ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, tmp) + if err != nil { + return nil, err + } + } + args["after"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["first"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["first"] = arg1 + var arg2 *entgql.Cursor[int] + if tmp, ok := rawArgs["before"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) + arg2, err = ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, tmp) + if err != nil { + return nil, err + } + } + args["before"] = arg2 + var arg3 *int + if tmp, ok := rawArgs["last"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) + arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["last"] = arg3 + var arg4 []*ent.RepositoryOrder + if tmp, ok := rawArgs["orderBy"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) + arg4, err = ec.unmarshalORepositoryOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrderᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["orderBy"] = arg4 + var arg5 *ent.RepositoryWhereInput + if tmp, ok := rawArgs["where"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) + arg5, err = ec.unmarshalORepositoryWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["where"] = arg5 + return args, nil +} + func (ec *executionContext) field_Query_tags_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -1111,6 +1172,8 @@ func (ec *executionContext) fieldContext_File_tomes(ctx context.Context, field g return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, @@ -3932,6 +3995,93 @@ func (ec *executionContext) fieldContext_Query_tasks(ctx context.Context, field return fc, nil } +func (ec *executionContext) _Query_repositories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_repositories(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) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Repositories(rctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.RepositoryOrder), fc.Args["where"].(*ent.RepositoryWhereInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + return nil, err + } + if ec.directives.RequireRole == nil { + return nil, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*ent.RepositoryConnection); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *realm.pub/tavern/internal/ent.RepositoryConnection`, tmp) + }) + 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.(*ent.RepositoryConnection) + fc.Result = res + return ec.marshalNRepositoryConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_repositories(ctx 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 "edges": + return ec.fieldContext_RepositoryConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_RepositoryConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_RepositoryConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RepositoryConnection", 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_repositories_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_beacons(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_beacons(ctx, field) if err != nil { @@ -4318,6 +4468,8 @@ func (ec *executionContext) fieldContext_Query_tomes(ctx context.Context, field return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, @@ -4896,6 +5048,8 @@ func (ec *executionContext) fieldContext_Quest_tome(ctx context.Context, field g return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, @@ -5086,8 +5240,8 @@ func (ec *executionContext) fieldContext_Quest_creator(ctx context.Context, fiel return fc, nil } -func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tag_id(ctx, field) +func (ec *executionContext) _Repository_id(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_id(ctx, field) if err != nil { return graphql.Null } @@ -5117,9 +5271,9 @@ func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.Collected return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tag_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, @@ -5130,8 +5284,8 @@ func (ec *executionContext) fieldContext_Tag_id(ctx context.Context, field graph return fc, nil } -func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tag_name(ctx, field) +func (ec *executionContext) _Repository_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_createdAt(ctx, field) if err != nil { return graphql.Null } @@ -5144,7 +5298,7 @@ func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.Collect }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -5156,26 +5310,26 @@ func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.Collect } return graphql.Null } - res := resTmp.(string) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tag_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tag_kind(ctx, field) +func (ec *executionContext) _Repository_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_lastModifiedAt(ctx, field) if err != nil { return graphql.Null } @@ -5188,7 +5342,7 @@ func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.Collect }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind, nil + return obj.LastModifiedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -5200,26 +5354,26 @@ func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.Collect } return graphql.Null } - res := resTmp.(tag.Kind) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tag_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_lastModifiedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TagKind does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tag_hosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tag_hosts(ctx, field) +func (ec *executionContext) _Repository_url(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_url(ctx, field) if err != nil { return graphql.Null } @@ -5232,63 +5386,38 @@ func (ec *executionContext) _Tag_hosts(ctx context.Context, field graphql.Collec }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hosts(ctx) + return obj.URL, nil }) 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.([]*ent.Host) + res := resTmp.(string) fc.Result = res - return ec.marshalOHost2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tag_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_url(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tag", + Object: "Repository", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Host_id(ctx, field) - case "createdAt": - return ec.fieldContext_Host_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Host_lastModifiedAt(ctx, field) - case "identifier": - return ec.fieldContext_Host_identifier(ctx, field) - case "name": - return ec.fieldContext_Host_name(ctx, field) - case "primaryIP": - return ec.fieldContext_Host_primaryIP(ctx, field) - case "platform": - return ec.fieldContext_Host_platform(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Host_lastSeenAt(ctx, field) - case "tags": - return ec.fieldContext_Host_tags(ctx, field) - case "beacons": - return ec.fieldContext_Host_beacons(ctx, field) - case "files": - return ec.fieldContext_Host_files(ctx, field) - case "processes": - return ec.fieldContext_Host_processes(ctx, field) - case "credentials": - return ec.fieldContext_Host_credentials(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_id(ctx, field) +func (ec *executionContext) _Repository_publicKey(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_publicKey(ctx, field) if err != nil { return graphql.Null } @@ -5301,7 +5430,7 @@ func (ec *executionContext) _Task_id(ctx context.Context, field graphql.Collecte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.PublicKey, nil }) if err != nil { ec.Error(ctx, err) @@ -5313,26 +5442,26 @@ func (ec *executionContext) _Task_id(ctx context.Context, field graphql.Collecte } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNID2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_publicKey(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Repository", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_createdAt(ctx, field) +func (ec *executionContext) _Repository_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_tomes(ctx, field) if err != nil { return graphql.Null } @@ -5345,38 +5474,63 @@ func (ec *executionContext) _Task_createdAt(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return obj.Tomes(ctx) }) 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.(time.Time) + res := resTmp.([]*ent.Tome) fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalOTome2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Repository", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Tome_id(ctx, field) + case "createdAt": + return ec.fieldContext_Tome_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Tome_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Tome_name(ctx, field) + case "description": + return ec.fieldContext_Tome_description(ctx, field) + case "author": + return ec.fieldContext_Tome_author(ctx, field) + case "supportModel": + return ec.fieldContext_Tome_supportModel(ctx, field) + case "tactic": + return ec.fieldContext_Tome_tactic(ctx, field) + case "paramDefs": + return ec.fieldContext_Tome_paramDefs(ctx, field) + case "eldritch": + return ec.fieldContext_Tome_eldritch(ctx, field) + case "files": + return ec.fieldContext_Tome_files(ctx, field) + case "uploader": + return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_lastModifiedAt(ctx, field) +func (ec *executionContext) _Repository_owner(ctx context.Context, field graphql.CollectedField, obj *ent.Repository) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Repository_owner(ctx, field) if err != nil { return graphql.Null } @@ -5389,38 +5543,49 @@ func (ec *executionContext) _Task_lastModifiedAt(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LastModifiedAt, nil + return obj.Owner(ctx) }) 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.(time.Time) + res := resTmp.(*ent.User) fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Repository_owner(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Repository", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_claimedAt(ctx, field) +func (ec *executionContext) _RepositoryConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RepositoryConnection_edges(ctx, field) if err != nil { return graphql.Null } @@ -5433,7 +5598,7 @@ func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ClaimedAt, nil + return obj.Edges, nil }) if err != nil { ec.Error(ctx, err) @@ -5442,26 +5607,32 @@ func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.C if resTmp == nil { return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.([]*ent.RepositoryEdge) fc.Result = res - return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalORepositoryEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_claimedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_RepositoryEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_RepositoryEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RepositoryEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_execStartedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_execStartedAt(ctx, field) +func (ec *executionContext) _RepositoryConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RepositoryConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } @@ -5474,35 +5645,48 @@ func (ec *executionContext) _Task_execStartedAt(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ExecStartedAt, nil + return obj.PageInfo, nil }) 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.(time.Time) + res := resTmp.(entgql.PageInfo[int]) fc.Result = res - return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_execStartedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_execFinishedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_execFinishedAt(ctx, field) +func (ec *executionContext) _RepositoryConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RepositoryConnection_totalCount(ctx, field) if err != nil { return graphql.Null } @@ -5515,35 +5699,38 @@ func (ec *executionContext) _Task_execFinishedAt(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ExecFinishedAt, nil + return obj.TotalCount, nil }) 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.(time.Time) + res := resTmp.(int) fc.Result = res - return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_execFinishedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryConnection_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_output(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_output(ctx, field) +func (ec *executionContext) _RepositoryEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RepositoryEdge_node(ctx, field) if err != nil { return graphql.Null } @@ -5556,7 +5743,7 @@ func (ec *executionContext) _Task_output(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Output, nil + return obj.Node, nil }) if err != nil { ec.Error(ctx, err) @@ -5565,26 +5752,42 @@ func (ec *executionContext) _Task_output(ctx context.Context, field graphql.Coll if resTmp == nil { return graphql.Null } - res := resTmp.(string) + res := resTmp.(*ent.Repository) fc.Result = res - return ec.marshalOString2string(ctx, field.Selections, res) + return ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_output(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Repository_id(ctx, field) + case "createdAt": + return ec.fieldContext_Repository_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) }, } return fc, nil } -func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_outputSize(ctx, field) +func (ec *executionContext) _RepositoryEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.RepositoryEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RepositoryEdge_cursor(ctx, field) if err != nil { return graphql.Null } @@ -5597,7 +5800,7 @@ func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.OutputSize, nil + return obj.Cursor, nil }) if err != nil { ec.Error(ctx, err) @@ -5609,26 +5812,26 @@ func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(int) + res := resTmp.(entgql.Cursor[int]) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_outputSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RepositoryEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "RepositoryEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_error(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_error(ctx, field) +func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_id(ctx, field) if err != nil { return graphql.Null } @@ -5641,35 +5844,38 @@ func (ec *executionContext) _Task_error(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Error, nil + return obj.ID, nil }) 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.(string) + res := resTmp.(int) fc.Result = res - return ec.marshalOString2string(ctx, field.Selections, res) + return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_error(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Tag", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_quest(ctx, field) +func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_name(ctx, field) if err != nil { return graphql.Null } @@ -5682,7 +5888,7 @@ func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Quest(ctx) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -5694,46 +5900,26 @@ func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(*ent.Quest) + res := resTmp.(string) fc.Result = res - return ec.marshalNQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_quest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Tag", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Quest_id(ctx, field) - case "createdAt": - return ec.fieldContext_Quest_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Quest_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Quest_name(ctx, field) - case "parameters": - return ec.fieldContext_Quest_parameters(ctx, field) - case "tome": - return ec.fieldContext_Quest_tome(ctx, field) - case "bundle": - return ec.fieldContext_Quest_bundle(ctx, field) - case "tasks": - return ec.fieldContext_Quest_tasks(ctx, field) - case "creator": - return ec.fieldContext_Quest_creator(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_beacon(ctx, field) +func (ec *executionContext) _Tag_kind(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_kind(ctx, field) if err != nil { return graphql.Null } @@ -5746,7 +5932,7 @@ func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Beacon(ctx) + return obj.Kind, nil }) if err != nil { ec.Error(ctx, err) @@ -5758,50 +5944,26 @@ func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(*ent.Beacon) + res := resTmp.(tag.Kind) fc.Result = res - return ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon(ctx, field.Selections, res) + return ec.marshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_beacon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Tag", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Beacon_id(ctx, field) - case "createdAt": - return ec.fieldContext_Beacon_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Beacon_name(ctx, field) - case "principal": - return ec.fieldContext_Beacon_principal(ctx, field) - case "identifier": - return ec.fieldContext_Beacon_identifier(ctx, field) - case "agentIdentifier": - return ec.fieldContext_Beacon_agentIdentifier(ctx, field) - case "lastSeenAt": - return ec.fieldContext_Beacon_lastSeenAt(ctx, field) - case "interval": - return ec.fieldContext_Beacon_interval(ctx, field) - case "host": - return ec.fieldContext_Beacon_host(ctx, field) - case "tasks": - return ec.fieldContext_Beacon_tasks(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) + return nil, errors.New("field of type TagKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_reportedFiles(ctx, field) +func (ec *executionContext) _Tag_hosts(ctx context.Context, field graphql.CollectedField, obj *ent.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_hosts(ctx, field) if err != nil { return graphql.Null } @@ -5814,7 +5976,7 @@ func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ReportedFiles(ctx) + return obj.Hosts(ctx) }) if err != nil { ec.Error(ctx, err) @@ -5823,53 +5985,57 @@ func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.([]*ent.HostFile) + res := resTmp.([]*ent.Host) fc.Result = res - return ec.marshalOHostFile2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileᚄ(ctx, field.Selections, res) + return ec.marshalOHost2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_reportedFiles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tag_hosts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Task", + Object: "Tag", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_HostFile_id(ctx, field) + return ec.fieldContext_Host_id(ctx, field) case "createdAt": - return ec.fieldContext_HostFile_createdAt(ctx, field) + return ec.fieldContext_Host_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_HostFile_lastModifiedAt(ctx, field) - case "path": - return ec.fieldContext_HostFile_path(ctx, field) - case "owner": - return ec.fieldContext_HostFile_owner(ctx, field) - case "group": - return ec.fieldContext_HostFile_group(ctx, field) - case "permissions": - return ec.fieldContext_HostFile_permissions(ctx, field) - case "size": - return ec.fieldContext_HostFile_size(ctx, field) - case "hash": - return ec.fieldContext_HostFile_hash(ctx, field) - case "host": - return ec.fieldContext_HostFile_host(ctx, field) - case "task": - return ec.fieldContext_HostFile_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostFile", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _Task_reportedProcesses(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_reportedProcesses(ctx, field) - if err != nil { - return graphql.Null - } + return ec.fieldContext_Host_lastModifiedAt(ctx, field) + case "identifier": + return ec.fieldContext_Host_identifier(ctx, field) + case "name": + return ec.fieldContext_Host_name(ctx, field) + case "primaryIP": + return ec.fieldContext_Host_primaryIP(ctx, field) + case "platform": + return ec.fieldContext_Host_platform(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Host_lastSeenAt(ctx, field) + case "tags": + return ec.fieldContext_Host_tags(ctx, field) + case "beacons": + return ec.fieldContext_Host_beacons(ctx, field) + case "files": + return ec.fieldContext_Host_files(ctx, field) + case "processes": + return ec.fieldContext_Host_processes(ctx, field) + case "credentials": + return ec.fieldContext_Host_credentials(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Host", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Task_id(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_id(ctx, field) + if err != nil { + return graphql.Null + } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { @@ -5879,65 +6045,38 @@ func (ec *executionContext) _Task_reportedProcesses(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ReportedProcesses(ctx) + return obj.ID, nil }) 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.([]*ent.HostProcess) + res := resTmp.(int) fc.Result = res - return ec.marshalOHostProcess2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessᚄ(ctx, field.Selections, res) + return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_reportedProcesses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_HostProcess_id(ctx, field) - case "createdAt": - return ec.fieldContext_HostProcess_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_HostProcess_lastModifiedAt(ctx, field) - case "pid": - return ec.fieldContext_HostProcess_pid(ctx, field) - case "ppid": - return ec.fieldContext_HostProcess_ppid(ctx, field) - case "name": - return ec.fieldContext_HostProcess_name(ctx, field) - case "principal": - return ec.fieldContext_HostProcess_principal(ctx, field) - case "path": - return ec.fieldContext_HostProcess_path(ctx, field) - case "cmd": - return ec.fieldContext_HostProcess_cmd(ctx, field) - case "env": - return ec.fieldContext_HostProcess_env(ctx, field) - case "cwd": - return ec.fieldContext_HostProcess_cwd(ctx, field) - case "status": - return ec.fieldContext_HostProcess_status(ctx, field) - case "host": - return ec.fieldContext_HostProcess_host(ctx, field) - case "task": - return ec.fieldContext_HostProcess_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostProcess", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Task_reportedCredentials(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Task_reportedCredentials(ctx, field) +func (ec *executionContext) _Task_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_createdAt(ctx, field) if err != nil { return graphql.Null } @@ -5950,53 +6089,38 @@ func (ec *executionContext) _Task_reportedCredentials(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ReportedCredentials(ctx) + return obj.CreatedAt, nil }) 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.([]*ent.HostCredential) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalOHostCredential2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialᚄ(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Task_reportedCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Task", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_HostCredential_id(ctx, field) - case "createdAt": - return ec.fieldContext_HostCredential_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_HostCredential_lastModifiedAt(ctx, field) - case "principal": - return ec.fieldContext_HostCredential_principal(ctx, field) - case "secret": - return ec.fieldContext_HostCredential_secret(ctx, field) - case "kind": - return ec.fieldContext_HostCredential_kind(ctx, field) - case "host": - return ec.fieldContext_HostCredential_host(ctx, field) - case "task": - return ec.fieldContext_HostCredential_task(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type HostCredential", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_TaskConnection_edges(ctx, field) +func (ec *executionContext) _Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_lastModifiedAt(ctx, field) if err != nil { return graphql.Null } @@ -6009,41 +6133,38 @@ func (ec *executionContext) _TaskConnection_edges(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Edges, nil + return obj.LastModifiedAt, nil }) 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.([]*ent.TaskEdge) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalOTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskEdge(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TaskConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_lastModifiedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "node": - return ec.fieldContext_TaskEdge_node(ctx, field) - case "cursor": - return ec.fieldContext_TaskEdge_cursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TaskEdge", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_TaskConnection_pageInfo(ctx, field) +func (ec *executionContext) _Task_claimedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_claimedAt(ctx, field) if err != nil { return graphql.Null } @@ -6056,48 +6177,35 @@ func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PageInfo, nil + return obj.ClaimedAt, nil }) 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.(entgql.PageInfo[int]) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) + return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_claimedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "hasNextPage": - return ec.fieldContext_PageInfo_hasNextPage(ctx, field) - case "hasPreviousPage": - return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) - case "startCursor": - return ec.fieldContext_PageInfo_startCursor(ctx, field) - case "endCursor": - return ec.fieldContext_PageInfo_endCursor(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_TaskConnection_totalCount(ctx, field) +func (ec *executionContext) _Task_execStartedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_execStartedAt(ctx, field) if err != nil { return graphql.Null } @@ -6110,38 +6218,35 @@ func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil + return obj.ExecStartedAt, nil }) 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.(int) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_execStartedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskConnection", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_TaskEdge_node(ctx, field) +func (ec *executionContext) _Task_execFinishedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_execFinishedAt(ctx, field) if err != nil { return graphql.Null } @@ -6154,7 +6259,7 @@ func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Node, nil + return obj.ExecFinishedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -6163,56 +6268,26 @@ func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.Co if resTmp == nil { return graphql.Null } - res := resTmp.(*ent.Task) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask(ctx, field.Selections, res) + return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TaskEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_execFinishedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskEdge", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Task_id(ctx, field) - case "createdAt": - return ec.fieldContext_Task_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Task_lastModifiedAt(ctx, field) - case "claimedAt": - return ec.fieldContext_Task_claimedAt(ctx, field) - case "execStartedAt": - return ec.fieldContext_Task_execStartedAt(ctx, field) - case "execFinishedAt": - return ec.fieldContext_Task_execFinishedAt(ctx, field) - case "output": - return ec.fieldContext_Task_output(ctx, field) - case "outputSize": - return ec.fieldContext_Task_outputSize(ctx, field) - case "error": - return ec.fieldContext_Task_error(ctx, field) - case "quest": - return ec.fieldContext_Task_quest(ctx, field) - case "beacon": - return ec.fieldContext_Task_beacon(ctx, field) - case "reportedFiles": - return ec.fieldContext_Task_reportedFiles(ctx, field) - case "reportedProcesses": - return ec.fieldContext_Task_reportedProcesses(ctx, field) - case "reportedCredentials": - return ec.fieldContext_Task_reportedCredentials(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_TaskEdge_cursor(ctx, field) +func (ec *executionContext) _Task_output(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_output(ctx, field) if err != nil { return graphql.Null } @@ -6225,39 +6300,36 @@ func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Cursor, nil + return obj.Output, nil }) 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.(entgql.Cursor[int]) + res := resTmp.(string) fc.Result = res - return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TaskEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_output(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "TaskEdge", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Cursor does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_id(ctx, field) - if err != nil { +func (ec *executionContext) _Task_outputSize(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_outputSize(ctx, field) + if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) @@ -6269,7 +6341,7 @@ func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.Collecte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.OutputSize, nil }) if err != nil { ec.Error(ctx, err) @@ -6283,24 +6355,24 @@ func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.Collecte } res := resTmp.(int) fc.Result = res - return ec.marshalNID2int(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_outputSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_createdAt(ctx, field) +func (ec *executionContext) _Task_error(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_error(ctx, field) if err != nil { return graphql.Null } @@ -6313,38 +6385,35 @@ func (ec *executionContext) _Tome_createdAt(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return obj.Error, nil }) 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.(time.Time) + res := resTmp.(string) fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_error(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_lastModifiedAt(ctx, field) +func (ec *executionContext) _Task_quest(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_quest(ctx, field) if err != nil { return graphql.Null } @@ -6357,7 +6426,7 @@ func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LastModifiedAt, nil + return obj.Quest(ctx) }) if err != nil { ec.Error(ctx, err) @@ -6369,26 +6438,46 @@ func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(*ent.Quest) fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalNQuest2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuest(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_quest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Quest_id(ctx, field) + case "createdAt": + return ec.fieldContext_Quest_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Quest_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Quest_name(ctx, field) + case "parameters": + return ec.fieldContext_Quest_parameters(ctx, field) + case "tome": + return ec.fieldContext_Quest_tome(ctx, field) + case "bundle": + return ec.fieldContext_Quest_bundle(ctx, field) + case "tasks": + return ec.fieldContext_Quest_tasks(ctx, field) + case "creator": + return ec.fieldContext_Quest_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Quest", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_name(ctx, field) +func (ec *executionContext) _Task_beacon(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_beacon(ctx, field) if err != nil { return graphql.Null } @@ -6401,7 +6490,7 @@ func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.Collec }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Beacon(ctx) }) if err != nil { ec.Error(ctx, err) @@ -6413,26 +6502,50 @@ func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.Collec } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*ent.Beacon) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNBeacon2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeacon(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_beacon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Beacon_id(ctx, field) + case "createdAt": + return ec.fieldContext_Beacon_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Beacon_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Beacon_name(ctx, field) + case "principal": + return ec.fieldContext_Beacon_principal(ctx, field) + case "identifier": + return ec.fieldContext_Beacon_identifier(ctx, field) + case "agentIdentifier": + return ec.fieldContext_Beacon_agentIdentifier(ctx, field) + case "lastSeenAt": + return ec.fieldContext_Beacon_lastSeenAt(ctx, field) + case "interval": + return ec.fieldContext_Beacon_interval(ctx, field) + case "host": + return ec.fieldContext_Beacon_host(ctx, field) + case "tasks": + return ec.fieldContext_Beacon_tasks(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Beacon", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_description(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_description(ctx, field) +func (ec *executionContext) _Task_reportedFiles(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_reportedFiles(ctx, field) if err != nil { return graphql.Null } @@ -6445,38 +6558,59 @@ func (ec *executionContext) _Tome_description(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description, nil + return obj.ReportedFiles(ctx) }) 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.(string) + res := resTmp.([]*ent.HostFile) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOHostFile2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedFiles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_HostFile_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostFile_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostFile_lastModifiedAt(ctx, field) + case "path": + return ec.fieldContext_HostFile_path(ctx, field) + case "owner": + return ec.fieldContext_HostFile_owner(ctx, field) + case "group": + return ec.fieldContext_HostFile_group(ctx, field) + case "permissions": + return ec.fieldContext_HostFile_permissions(ctx, field) + case "size": + return ec.fieldContext_HostFile_size(ctx, field) + case "hash": + return ec.fieldContext_HostFile_hash(ctx, field) + case "host": + return ec.fieldContext_HostFile_host(ctx, field) + case "task": + return ec.fieldContext_HostFile_task(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostFile", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_author(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_author(ctx, field) +func (ec *executionContext) _Task_reportedProcesses(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_reportedProcesses(ctx, field) if err != nil { return graphql.Null } @@ -6489,38 +6623,65 @@ func (ec *executionContext) _Tome_author(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Author, nil + return obj.ReportedProcesses(ctx) }) 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.(string) + res := resTmp.([]*ent.HostProcess) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOHostProcess2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_author(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedProcesses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_HostProcess_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostProcess_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostProcess_lastModifiedAt(ctx, field) + case "pid": + return ec.fieldContext_HostProcess_pid(ctx, field) + case "ppid": + return ec.fieldContext_HostProcess_ppid(ctx, field) + case "name": + return ec.fieldContext_HostProcess_name(ctx, field) + case "principal": + return ec.fieldContext_HostProcess_principal(ctx, field) + case "path": + return ec.fieldContext_HostProcess_path(ctx, field) + case "cmd": + return ec.fieldContext_HostProcess_cmd(ctx, field) + case "env": + return ec.fieldContext_HostProcess_env(ctx, field) + case "cwd": + return ec.fieldContext_HostProcess_cwd(ctx, field) + case "status": + return ec.fieldContext_HostProcess_status(ctx, field) + case "host": + return ec.fieldContext_HostProcess_host(ctx, field) + case "task": + return ec.fieldContext_HostProcess_task(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostProcess", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_supportModel(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_supportModel(ctx, field) +func (ec *executionContext) _Task_reportedCredentials(ctx context.Context, field graphql.CollectedField, obj *ent.Task) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Task_reportedCredentials(ctx, field) if err != nil { return graphql.Null } @@ -6533,38 +6694,53 @@ func (ec *executionContext) _Tome_supportModel(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SupportModel, nil + return obj.ReportedCredentials(ctx) }) 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.(tome.SupportModel) + res := resTmp.([]*ent.HostCredential) fc.Result = res - return ec.marshalNTomeSupportModel2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel(ctx, field.Selections, res) + return ec.marshalOHostCredential2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_supportModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Task_reportedCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "Task", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TomeSupportModel does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_HostCredential_id(ctx, field) + case "createdAt": + return ec.fieldContext_HostCredential_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_HostCredential_lastModifiedAt(ctx, field) + case "principal": + return ec.fieldContext_HostCredential_principal(ctx, field) + case "secret": + return ec.fieldContext_HostCredential_secret(ctx, field) + case "kind": + return ec.fieldContext_HostCredential_kind(ctx, field) + case "host": + return ec.fieldContext_HostCredential_host(ctx, field) + case "task": + return ec.fieldContext_HostCredential_task(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type HostCredential", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_tactic(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_tactic(ctx, field) +func (ec *executionContext) _TaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TaskConnection_edges(ctx, field) if err != nil { return graphql.Null } @@ -6577,38 +6753,41 @@ func (ec *executionContext) _Tome_tactic(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Tactic, nil + return obj.Edges, nil }) 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.(tome.Tactic) + res := resTmp.([]*ent.TaskEdge) fc.Result = res - return ec.marshalNTomeTactic2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic(ctx, field.Selections, res) + return ec.marshalOTaskEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskEdge(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_tactic(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type TomeTactic does not have child fields") + switch field.Name { + case "node": + return ec.fieldContext_TaskEdge_node(ctx, field) + case "cursor": + return ec.fieldContext_TaskEdge_cursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TaskEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_paramDefs(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_paramDefs(ctx, field) +func (ec *executionContext) _TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TaskConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } @@ -6621,35 +6800,48 @@ func (ec *executionContext) _Tome_paramDefs(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ParamDefs, nil + return obj.PageInfo, nil }) 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.(string) + res := resTmp.(entgql.PageInfo[int]) fc.Result = res - return ec.marshalOString2string(ctx, field.Selections, res) + return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_paramDefs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_eldritch(ctx, field) +func (ec *executionContext) _TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.TaskConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TaskConnection_totalCount(ctx, field) if err != nil { return graphql.Null } @@ -6662,7 +6854,7 @@ func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Eldritch, nil + return obj.TotalCount, nil }) if err != nil { ec.Error(ctx, err) @@ -6674,26 +6866,26 @@ func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(string) + res := resTmp.(int) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_eldritch(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskConnection_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TaskConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Tome_files(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_files(ctx, field) +func (ec *executionContext) _TaskEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TaskEdge_node(ctx, field) if err != nil { return graphql.Null } @@ -6706,7 +6898,7 @@ func (ec *executionContext) _Tome_files(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Files(ctx) + return obj.Node, nil }) if err != nil { ec.Error(ctx, err) @@ -6715,42 +6907,56 @@ func (ec *executionContext) _Tome_files(ctx context.Context, field graphql.Colle if resTmp == nil { return graphql.Null } - res := resTmp.([]*ent.File) + res := resTmp.(*ent.Task) fc.Result = res - return ec.marshalOFile2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileᚄ(ctx, field.Selections, res) + return ec.marshalOTask2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTask(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_files(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TaskEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_File_id(ctx, field) + return ec.fieldContext_Task_id(ctx, field) case "createdAt": - return ec.fieldContext_File_createdAt(ctx, field) + return ec.fieldContext_Task_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_File_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_File_name(ctx, field) - case "size": - return ec.fieldContext_File_size(ctx, field) - case "hash": - return ec.fieldContext_File_hash(ctx, field) - case "tomes": - return ec.fieldContext_File_tomes(ctx, field) + return ec.fieldContext_Task_lastModifiedAt(ctx, field) + case "claimedAt": + return ec.fieldContext_Task_claimedAt(ctx, field) + case "execStartedAt": + return ec.fieldContext_Task_execStartedAt(ctx, field) + case "execFinishedAt": + return ec.fieldContext_Task_execFinishedAt(ctx, field) + case "output": + return ec.fieldContext_Task_output(ctx, field) + case "outputSize": + return ec.fieldContext_Task_outputSize(ctx, field) + case "error": + return ec.fieldContext_Task_error(ctx, field) + case "quest": + return ec.fieldContext_Task_quest(ctx, field) + case "beacon": + return ec.fieldContext_Task_beacon(ctx, field) + case "reportedFiles": + return ec.fieldContext_Task_reportedFiles(ctx, field) + case "reportedProcesses": + return ec.fieldContext_Task_reportedProcesses(ctx, field) + case "reportedCredentials": + return ec.fieldContext_Task_reportedCredentials(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type File", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Task", field.Name) }, } return fc, nil } -func (ec *executionContext) _Tome_uploader(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Tome_uploader(ctx, field) +func (ec *executionContext) _TaskEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.TaskEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TaskEdge_cursor(ctx, field) if err != nil { return graphql.Null } @@ -6763,49 +6969,38 @@ func (ec *executionContext) _Tome_uploader(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Uploader(ctx) + return obj.Cursor, nil }) 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.(*ent.User) + res := resTmp.(entgql.Cursor[int]) fc.Result = res - return ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser(ctx, field.Selections, res) + return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Tome_uploader(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TaskEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Tome", + Object: "TaskEdge", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "photoURL": - return ec.fieldContext_User_photoURL(ctx, field) - case "isActivated": - return ec.fieldContext_User_isActivated(ctx, field) - case "isAdmin": - return ec.fieldContext_User_isAdmin(ctx, field) - case "tomes": - return ec.fieldContext_User_tomes(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_id(ctx, field) +func (ec *executionContext) _Tome_id(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_id(ctx, field) if err != nil { return graphql.Null } @@ -6835,9 +7030,9 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, @@ -6848,8 +7043,8 @@ func (ec *executionContext) fieldContext_User_id(ctx context.Context, field grap return fc, nil } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_name(ctx, field) +func (ec *executionContext) _Tome_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_createdAt(ctx, field) if err != nil { return graphql.Null } @@ -6862,7 +7057,7 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -6874,26 +7069,26 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } return graphql.Null } - res := resTmp.(string) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_createdAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_photoURL(ctx, field) +func (ec *executionContext) _Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_lastModifiedAt(ctx, field) if err != nil { return graphql.Null } @@ -6906,7 +7101,7 @@ func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PhotoURL, nil + return obj.LastModifiedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -6918,26 +7113,26 @@ func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(string) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_photoURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_lastModifiedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_isActivated(ctx, field) +func (ec *executionContext) _Tome_name(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_name(ctx, field) if err != nil { return graphql.Null } @@ -6950,7 +7145,7 @@ func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsActivated, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -6962,26 +7157,26 @@ func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_isActivated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_isAdmin(ctx, field) +func (ec *executionContext) _Tome_description(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_description(ctx, field) if err != nil { return graphql.Null } @@ -6994,7 +7189,7 @@ func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsAdmin, nil + return obj.Description, nil }) if err != nil { ec.Error(ctx, err) @@ -7006,26 +7201,26 @@ func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_isAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, IsMethod: false, IsResolver: false, 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_tomes(ctx, field) +func (ec *executionContext) _Tome_author(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_author(ctx, field) if err != nil { return graphql.Null } @@ -7038,42 +7233,648 @@ func (ec *executionContext) _User_tomes(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Tomes(ctx) + return obj.Author, nil }) 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.([]*ent.Tome) + res := resTmp.(string) fc.Result = res - return ec.marshalOTome2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Tome_author(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "Tome", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Tome_id(ctx, field) - case "createdAt": - return ec.fieldContext_Tome_createdAt(ctx, field) - case "lastModifiedAt": - return ec.fieldContext_Tome_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Tome_name(ctx, field) - case "description": - return ec.fieldContext_Tome_description(ctx, field) - case "author": - return ec.fieldContext_Tome_author(ctx, field) - case "supportModel": - return ec.fieldContext_Tome_supportModel(ctx, field) + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_supportModel(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_supportModel(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 obj.SupportModel, nil + }) + 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.(tome.SupportModel) + fc.Result = res + return ec.marshalNTomeSupportModel2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_supportModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TomeSupportModel does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_tactic(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_tactic(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 obj.Tactic, nil + }) + 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.(tome.Tactic) + fc.Result = res + return ec.marshalNTomeTactic2realmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_tactic(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TomeTactic does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_paramDefs(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_paramDefs(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 obj.ParamDefs, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_paramDefs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_eldritch(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_eldritch(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 obj.Eldritch, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_eldritch(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_files(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_files(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 obj.Files(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*ent.File) + fc.Result = res + return ec.marshalOFile2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_files(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_File_id(ctx, field) + case "createdAt": + return ec.fieldContext_File_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_File_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_File_name(ctx, field) + case "size": + return ec.fieldContext_File_size(ctx, field) + case "hash": + return ec.fieldContext_File_hash(ctx, field) + case "tomes": + return ec.fieldContext_File_tomes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type File", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_uploader(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_uploader(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 obj.Uploader(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*ent.User) + fc.Result = res + return ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_uploader(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Tome_repository(ctx context.Context, field graphql.CollectedField, obj *ent.Tome) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tome_repository(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 obj.Repository(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*ent.Repository) + fc.Result = res + return ec.marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tome_repository(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tome", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Repository_id(ctx, field) + case "createdAt": + return ec.fieldContext_Repository_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_id(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 obj.ID, nil + }) + 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.(int) + fc.Result = res + return ec.marshalNID2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_name(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 obj.Name, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_photoURL(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 obj.PhotoURL, nil + }) + 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_photoURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_isActivated(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_isActivated(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 obj.IsActivated, nil + }) + 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_User_isActivated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + 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 +} + +func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_isAdmin(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 obj.IsAdmin, nil + }) + 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_User_isAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + 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 +} + +func (ec *executionContext) _User_tomes(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_tomes(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 obj.Tomes(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*ent.Tome) + fc.Result = res + return ec.marshalOTome2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_tomes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Tome_id(ctx, field) + case "createdAt": + return ec.fieldContext_Tome_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Tome_lastModifiedAt(ctx, field) + case "name": + return ec.fieldContext_Tome_name(ctx, field) + case "description": + return ec.fieldContext_Tome_description(ctx, field) + case "author": + return ec.fieldContext_Tome_author(ctx, field) + case "supportModel": + return ec.fieldContext_Tome_supportModel(ctx, field) case "tactic": return ec.fieldContext_Tome_tactic(ctx, field) case "paramDefs": @@ -7084,1230 +7885,1890 @@ func (ec *executionContext) fieldContext_User_tomes(ctx context.Context, field g return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputBeaconOrder(ctx context.Context, obj interface{}) (ent.BeaconOrder, error) { + var it ent.BeaconOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNBeaconOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBeaconWhereInput(ctx context.Context, obj interface{}) (ent.BeaconWhereInput, error) { + var it ent.BeaconWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalIsNil", "principalNotNil", "principalEqualFold", "principalContainsFold", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "agentIdentifier", "agentIdentifierNEQ", "agentIdentifierIn", "agentIdentifierNotIn", "agentIdentifierGT", "agentIdentifierGTE", "agentIdentifierLT", "agentIdentifierLTE", "agentIdentifierContains", "agentIdentifierHasPrefix", "agentIdentifierHasSuffix", "agentIdentifierIsNil", "agentIdentifierNotNil", "agentIdentifierEqualFold", "agentIdentifierContainsFold", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "interval", "intervalNEQ", "intervalIn", "intervalNotIn", "intervalGT", "intervalGTE", "intervalLT", "intervalLTE", "intervalIsNil", "intervalNotNil", "hasHost", "hasHostWith", "hasTasks", "hasTasksWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOBeaconWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + case "and": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "or": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDNEQ = data + case "idIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDIn = data + case "idNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.IDNotIn = data + case "idGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGT = data + case "idGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDGTE = data + case "idLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLT = data + case "idLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.IDLTE = data + case "createdAt": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAt = data + case "createdAtNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNEQ = data + case "createdAtIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtIn = data + case "createdAtNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtNotIn = data + case "createdAtGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGT = data + case "createdAtGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtGTE = data + case "createdAtLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLT = data + case "createdAtLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtLTE = data + case "lastModifiedAt": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAt = data + case "lastModifiedAtNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastModifiedAtLTE = data + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "nameNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameNEQ = data + case "nameIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameIn = data + case "nameNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.NameNotIn = data + case "nameGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGT = data + case "nameGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameGTE = data + case "nameLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLT = data + case "nameLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameLTE = data + case "nameContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContains = data + case "nameHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasPrefix = data + case "nameHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameHasSuffix = data + case "nameEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameEqualFold = data + case "nameContainsFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NameContainsFold = data + case "principal": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Principal = data + case "principalNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNEQ = data + case "principalIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.PrincipalIn = data + case "principalNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNotIn = data + case "principalGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalGT = data + case "principalGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalGTE = data + case "principalLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalLT = data + case "principalLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalLTE = data + case "principalContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalContains = data + case "principalHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalHasPrefix = data + case "principalHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err } - return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) - }, - } - return fc, nil -} + it.PrincipalHasSuffix = data + case "principalIsNil": + var err error -// endregion **************************** field.gotpl ***************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.PrincipalIsNil = data + case "principalNotNil": + var err error -// region **************************** input.gotpl ***************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.PrincipalNotNil = data + case "principalEqualFold": + var err error -func (ec *executionContext) unmarshalInputBeaconOrder(ctx context.Context, obj interface{}) (ent.BeaconOrder, error) { - var it ent.BeaconOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalEqualFold = data + case "principalContainsFold": + var err error - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PrincipalContainsFold = data + case "identifier": + var err error - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Identifier = data + case "identifierNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.IdentifierNEQ = data + case "identifierIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNBeaconOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Field = data - } - } + it.IdentifierIn = data + case "identifierNotIn": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.IdentifierNotIn = data + case "identifierGT": + var err error -func (ec *executionContext) unmarshalInputBeaconWhereInput(ctx context.Context, obj interface{}) (ent.BeaconWhereInput, error) { - var it ent.BeaconWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierGT = data + case "identifierGTE": + var err error - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalIsNil", "principalNotNil", "principalEqualFold", "principalContainsFold", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "agentIdentifier", "agentIdentifierNEQ", "agentIdentifierIn", "agentIdentifierNotIn", "agentIdentifierGT", "agentIdentifierGTE", "agentIdentifierLT", "agentIdentifierLTE", "agentIdentifierContains", "agentIdentifierHasPrefix", "agentIdentifierHasSuffix", "agentIdentifierIsNil", "agentIdentifierNotNil", "agentIdentifierEqualFold", "agentIdentifierContainsFold", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "interval", "intervalNEQ", "intervalIn", "intervalNotIn", "intervalGT", "intervalGTE", "intervalLT", "intervalLTE", "intervalIsNil", "intervalNotNil", "hasHost", "hasHostWith", "hasTasks", "hasTasksWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.IdentifierGTE = data + case "identifierLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOBeaconWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.IdentifierLT = data + case "identifierLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.IdentifierLTE = data + case "identifierContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.IdentifierContains = data + case "identifierHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.IdentifierHasPrefix = data + case "identifierHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.IdentifierHasSuffix = data + case "identifierEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.IdentifierEqualFold = data + case "identifierContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.IdentifierContainsFold = data + case "agentIdentifier": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.AgentIdentifier = data + case "agentIdentifierNEQ": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierNEQ = data + case "agentIdentifierIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierIn = data + case "agentIdentifierNotIn": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierNotIn = data + case "agentIdentifierGT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierGT = data + case "agentIdentifierGTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierGTE = data + case "agentIdentifierLT": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierLT = data + case "agentIdentifierLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AgentIdentifierLTE = data + case "agentIdentifierContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": + it.AgentIdentifierContains = data + case "agentIdentifierHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.AgentIdentifierHasPrefix = data + case "agentIdentifierHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.AgentIdentifierHasSuffix = data + case "agentIdentifierIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.AgentIdentifierIsNil = data + case "agentIdentifierNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.AgentIdentifierNotNil = data + case "agentIdentifierEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.AgentIdentifierEqualFold = data + case "agentIdentifierContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.AgentIdentifierContainsFold = data + case "lastSeenAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.LastSeenAt = data + case "lastSeenAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.LastSeenAtNEQ = data + case "lastSeenAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.LastSeenAtIn = data + case "lastSeenAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": + it.LastSeenAtNotIn = data + case "lastSeenAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": + it.LastSeenAtGT = data + case "lastSeenAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": + it.LastSeenAtGTE = data + case "lastSeenAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": + it.LastSeenAtLT = data + case "lastSeenAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": + it.LastSeenAtLTE = data + case "lastSeenAtIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": + it.LastSeenAtIsNil = data + case "lastSeenAtNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": + it.LastSeenAtNotNil = data + case "interval": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": + it.Interval = data + case "intervalNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNEQ")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "name": + it.IntervalNEQ = data + case "intervalIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.IntervalIn = data + case "intervalNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.IntervalNotIn = data + case "intervalGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.IntervalGT = data + case "intervalGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.IntervalGTE = data + case "intervalLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.IntervalLT = data + case "intervalLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.IntervalLTE = data + case "intervalIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.IntervalIsNil = data + case "intervalNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.IntervalNotNil = data + case "hasHost": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.HasHost = data + case "hasHostWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.HasHostWith = data + case "hasTasks": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.HasTasks = data + case "hasTasksWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.HasTasksWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCreateQuestInput(ctx context.Context, obj interface{}) (ent.CreateQuestInput, error) { + var it ent.CreateQuestInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "parameters", "tomeID"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "principal": + it.Name = data + case "parameters": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Principal = data - case "principalNEQ": + it.Parameters = data + case "tomeID": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tomeID")) + data, err := ec.unmarshalNID2int(ctx, v) if err != nil { return it, err } - it.PrincipalNEQ = data - case "principalIn": - var err error + it.TomeID = data + } + } - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.PrincipalIn = data - case "principalNotIn": - var err error + return it, nil +} - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.PrincipalNotIn = data - case "principalGT": +func (ec *executionContext) unmarshalInputCreateRepositoryInput(ctx context.Context, obj interface{}) (ent.CreateRepositoryInput, error) { + var it ent.CreateRepositoryInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"url"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "url": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalGT = data - case "principalGTE": + it.URL = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCreateTagInput(ctx context.Context, obj interface{}) (ent.CreateTagInput, error) { + var it ent.CreateTagInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "kind", "hostIDs"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalGTE = data - case "principalLT": + it.Name = data + case "kind": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind(ctx, v) if err != nil { return it, err } - it.PrincipalLT = data - case "principalLTE": + it.Kind = data + case "hostIDs": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hostIDs")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalLTE = data - case "principalContains": + it.HostIDs = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCreateTomeInput(ctx context.Context, obj interface{}) (ent.CreateTomeInput, error) { + var it ent.CreateTomeInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "description", "author", "supportModel", "tactic", "paramDefs", "eldritch", "fileIDs"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalContains = data - case "principalHasPrefix": + it.Name = data + case "description": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalHasPrefix = data - case "principalHasSuffix": + it.Description = data + case "author": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("author")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalHasSuffix = data - case "principalIsNil": + it.Author = data + case "supportModel": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("supportModel")) + data, err := ec.unmarshalOTomeSupportModel2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel(ctx, v) if err != nil { return it, err } - it.PrincipalIsNil = data - case "principalNotNil": + it.SupportModel = data + case "tactic": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tactic")) + data, err := ec.unmarshalOTomeTactic2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic(ctx, v) if err != nil { return it, err } - it.PrincipalNotNil = data - case "principalEqualFold": + it.Tactic = data + case "paramDefs": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paramDefs")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalEqualFold = data - case "principalContainsFold": + it.ParamDefs = data + case "eldritch": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eldritch")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.PrincipalContainsFold = data - case "identifier": + it.Eldritch = data + case "fileIDs": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fileIDs")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.Identifier = data - case "identifierNEQ": + it.FileIDs = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputFileOrder(ctx context.Context, obj interface{}) (ent.FileOrder, error) { + var it ent.FileOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.IdentifierNEQ = data - case "identifierIn": + it.Direction = data + case "field": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNFileOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileOrderField(ctx, v) if err != nil { return it, err } - it.IdentifierIn = data - case "identifierNotIn": + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, obj interface{}) (ent.FileWhereInput, error) { + var it ent.FileWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashEqualFold", "hashContainsFold", "hasTomes", "hasTomesWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOFileWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInput(ctx, v) if err != nil { return it, err } - it.IdentifierNotIn = data - case "identifierGT": + it.Not = data + case "and": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierGT = data - case "identifierGTE": + it.And = data + case "or": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierGTE = data - case "identifierLT": + it.Or = data + case "id": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierLT = data - case "identifierLTE": + it.ID = data + case "idNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierLTE = data - case "identifierContains": + it.IDNEQ = data + case "idIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierContains = data - case "identifierHasPrefix": + it.IDIn = data + case "idNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierHasPrefix = data - case "identifierHasSuffix": + it.IDNotIn = data + case "idGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierHasSuffix = data - case "identifierEqualFold": + it.IDGT = data + case "idGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierEqualFold = data - case "identifierContainsFold": + it.IDGTE = data + case "idLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierContainsFold = data - case "agentIdentifier": + it.IDLT = data + case "idLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifier")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.AgentIdentifier = data - case "agentIdentifierNEQ": + it.IDLTE = data + case "createdAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNEQ = data - case "agentIdentifierIn": + it.CreatedAt = data + case "createdAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierIn = data - case "agentIdentifierNotIn": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNotIn = data - case "agentIdentifierGT": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierGT = data - case "agentIdentifierGTE": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierGTE = data - case "agentIdentifierLT": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierLT = data - case "agentIdentifierLTE": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierLTE = data - case "agentIdentifierContains": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierContains = data - case "agentIdentifierHasPrefix": + it.CreatedAtLTE = data + case "lastModifiedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierHasPrefix = data - case "agentIdentifierHasSuffix": + it.LastModifiedAt = data + case "lastModifiedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierHasSuffix = data - case "agentIdentifierIsNil": + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierIsNil = data - case "agentIdentifierNotNil": + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.AgentIdentifierNotNil = data - case "agentIdentifierEqualFold": + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierEqualFold = data - case "agentIdentifierContainsFold": + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("agentIdentifierContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.AgentIdentifierContainsFold = data - case "lastSeenAt": + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastSeenAt = data - case "lastSeenAtNEQ": + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.LastSeenAtNEQ = data - case "lastSeenAtIn": + it.LastModifiedAtLTE = data + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtIn = data - case "lastSeenAtNotIn": + it.Name = data + case "nameNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtNotIn = data - case "lastSeenAtGT": + it.NameNEQ = data + case "nameIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastSeenAtGT = data - case "lastSeenAtGTE": + it.NameIn = data + case "nameNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastSeenAtGTE = data - case "lastSeenAtLT": + it.NameNotIn = data + case "nameGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtLT = data - case "lastSeenAtLTE": + it.NameGT = data + case "nameGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtLTE = data - case "lastSeenAtIsNil": + it.NameGTE = data + case "nameLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtIsNil = data - case "lastSeenAtNotNil": + it.NameLT = data + case "nameLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtNotNil = data - case "interval": + it.NameLTE = data + case "nameContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Interval = data - case "intervalNEQ": + it.NameContains = data + case "nameHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNEQ")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalNEQ = data - case "intervalIn": + it.NameHasPrefix = data + case "nameHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalIn = data - case "intervalNotIn": + it.NameHasSuffix = data + case "nameEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalNotIn = data - case "intervalGT": + it.NameEqualFold = data + case "nameContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IntervalGT = data - case "intervalGTE": + it.NameContainsFold = data + case "size": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalGTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IntervalGTE = data - case "intervalLT": + it.Size = data + case "sizeNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IntervalLT = data - case "intervalLTE": + it.SizeNEQ = data + case "sizeIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalLTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IntervalLTE = data - case "intervalIsNil": + it.SizeIn = data + case "sizeNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) + data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IntervalIsNil = data - case "intervalNotNil": + it.SizeNotIn = data + case "sizeGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("intervalNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.IntervalNotNil = data - case "hasHost": + it.SizeGT = data + case "sizeGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasHost = data - case "hasHostWith": + it.SizeGTE = data + case "sizeLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasHostWith = data - case "hasTasks": + it.SizeLT = data + case "sizeLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.HasTasks = data - case "hasTasksWith": + it.SizeLTE = data + case "hash": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTasksWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputCreateQuestInput(ctx context.Context, obj interface{}) (ent.CreateQuestInput, error) { - var it ent.CreateQuestInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "parameters", "tomeID"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": + it.Hash = data + case "hashNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "parameters": + it.HashNEQ = data + case "hashIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Parameters = data - case "tomeID": + it.HashIn = data + case "hashNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tomeID")) - data, err := ec.unmarshalNID2int(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.TomeID = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputCreateTagInput(ctx context.Context, obj interface{}) (ent.CreateTagInput, error) { - var it ent.CreateTagInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "kind", "hostIDs"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": + it.HashNotIn = data + case "hashGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "kind": + it.HashGT = data + case "hashGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalNTagKind2realmᚗpubᚋtavernᚋinternalᚋentᚋtagᚐKind(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Kind = data - case "hostIDs": + it.HashGTE = data + case "hashLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hostIDs")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HostIDs = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputCreateTomeInput(ctx context.Context, obj interface{}) (ent.CreateTomeInput, error) { - var it ent.CreateTomeInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "description", "author", "supportModel", "tactic", "paramDefs", "eldritch", "fileIDs"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": + it.HashLT = data + case "hashLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "description": + it.HashLTE = data + case "hashContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Description = data - case "author": + it.HashContains = data + case "hashHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("author")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err - } - it.Author = data - case "supportModel": + } + it.HashHasPrefix = data + case "hashHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("supportModel")) - data, err := ec.unmarshalOTomeSupportModel2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐSupportModel(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SupportModel = data - case "tactic": + it.HashHasSuffix = data + case "hashEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tactic")) - data, err := ec.unmarshalOTomeTactic2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚋtomeᚐTactic(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Tactic = data - case "paramDefs": + it.HashEqualFold = data + case "hashContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paramDefs")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParamDefs = data - case "eldritch": + it.HashContainsFold = data + case "hasTomes": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eldritch")) - data, err := ec.unmarshalNString2string(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomes")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Eldritch = data - case "fileIDs": + it.HasTomes = data + case "hasTomesWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fileIDs")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomesWith")) + data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.FileIDs = data + it.HasTomesWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputFileOrder(ctx context.Context, obj interface{}) (ent.FileOrder, error) { - var it ent.FileOrder +func (ec *executionContext) unmarshalInputHostCredentialOrder(ctx context.Context, obj interface{}) (ent.HostCredentialOrder, error) { + var it ent.HostCredentialOrder asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v @@ -8337,7 +9798,7 @@ func (ec *executionContext) unmarshalInputFileOrder(ctx context.Context, obj int var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNFileOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileOrderField(ctx, v) + data, err := ec.unmarshalNHostCredentialOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialOrderField(ctx, v) if err != nil { return it, err } @@ -8348,14 +9809,14 @@ func (ec *executionContext) unmarshalInputFileOrder(ctx context.Context, obj int return it, nil } -func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, obj interface{}) (ent.FileWhereInput, error) { - var it ent.FileWhereInput +func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.Context, obj interface{}) (ent.HostCredentialWhereInput, error) { + var it ent.HostCredentialWhereInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashEqualFold", "hashContainsFold", "hasTomes", "hasTomesWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalEqualFold", "principalContainsFold", "secret", "secretNEQ", "secretIn", "secretNotIn", "secretGT", "secretGTE", "secretLT", "secretLTE", "secretContains", "secretHasPrefix", "secretHasSuffix", "secretEqualFold", "secretContainsFold", "kind", "kindNEQ", "kindIn", "kindNotIn", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -8366,7 +9827,7 @@ func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, ob var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOFileWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInput(ctx, v) + data, err := ec.unmarshalOHostCredentialWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInput(ctx, v) if err != nil { return it, err } @@ -8375,7 +9836,7 @@ func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, ob var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -8384,7 +9845,7 @@ func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, ob var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -8605,338 +10066,320 @@ func (ec *executionContext) unmarshalInputFileWhereInput(ctx context.Context, ob return it, err } it.LastModifiedAtLTE = data - case "name": + case "principal": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.Principal = data + case "principalNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.PrincipalNEQ = data + case "principalIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.PrincipalIn = data + case "principalNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.PrincipalNotIn = data + case "principalGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.PrincipalGT = data + case "principalGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.PrincipalGTE = data + case "principalLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.PrincipalLT = data + case "principalLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.PrincipalLTE = data + case "principalContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.PrincipalContains = data + case "principalHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.PrincipalHasPrefix = data + case "principalHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.PrincipalHasSuffix = data + case "principalEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.PrincipalEqualFold = data + case "principalContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "size": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.Size = data - case "sizeNEQ": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.SizeNEQ = data - case "sizeIn": + it.PrincipalContainsFold = data + case "secret": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secret")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeIn = data - case "sizeNotIn": + it.Secret = data + case "secretNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) - data, err := ec.unmarshalOInt2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeNotIn = data - case "sizeGT": + it.SecretNEQ = data + case "secretIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SizeGT = data - case "sizeGTE": + it.SecretIn = data + case "secretNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SizeGTE = data - case "sizeLT": + it.SecretNotIn = data + case "secretGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeLT = data - case "sizeLTE": + it.SecretGT = data + case "secretGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SizeLTE = data - case "hash": + it.SecretGTE = data + case "secretLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Hash = data - case "hashNEQ": + it.SecretLT = data + case "secretLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashNEQ = data - case "hashIn": + it.SecretLTE = data + case "secretContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashIn = data - case "hashNotIn": + it.SecretContains = data + case "secretHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashNotIn = data - case "hashGT": + it.SecretHasPrefix = data + case "secretHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGT = data - case "hashGTE": + it.SecretHasSuffix = data + case "secretEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGTE = data - case "hashLT": + it.SecretEqualFold = data + case "secretContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashLT = data - case "hashLTE": + it.SecretContainsFold = data + case "kind": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalOHostCredentialKind2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind(ctx, v) if err != nil { return it, err - } - it.HashLTE = data - case "hashContains": + } + it.Kind = data + case "kindNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindNEQ")) + data, err := ec.unmarshalOHostCredentialKind2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind(ctx, v) if err != nil { return it, err } - it.HashContains = data - case "hashHasPrefix": + it.KindNEQ = data + case "kindIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindIn")) + data, err := ec.unmarshalOHostCredentialKind2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kindᚄ(ctx, v) if err != nil { return it, err } - it.HashHasPrefix = data - case "hashHasSuffix": + it.KindIn = data + case "kindNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindNotIn")) + data, err := ec.unmarshalOHostCredentialKind2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kindᚄ(ctx, v) if err != nil { return it, err } - it.HashHasSuffix = data - case "hashEqualFold": + it.KindNotIn = data + case "hasHost": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HashEqualFold = data - case "hashContainsFold": + it.HasHost = data + case "hasHostWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HashContainsFold = data - case "hasTomes": + it.HasHostWith = data + case "hasTask": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomes")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasTomes = data - case "hasTomesWith": + it.HasTask = data + case "hasTaskWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomesWith")) - data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasTomesWith = data + it.HasTaskWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputHostCredentialOrder(ctx context.Context, obj interface{}) (ent.HostCredentialOrder, error) { - var it ent.HostCredentialOrder +func (ec *executionContext) unmarshalInputHostFileOrder(ctx context.Context, obj interface{}) (ent.HostFileOrder, error) { + var it ent.HostFileOrder asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v @@ -8966,7 +10409,7 @@ func (ec *executionContext) unmarshalInputHostCredentialOrder(ctx context.Contex var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNHostCredentialOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialOrderField(ctx, v) + data, err := ec.unmarshalNHostFileOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileOrderField(ctx, v) if err != nil { return it, err } @@ -8977,14 +10420,14 @@ func (ec *executionContext) unmarshalInputHostCredentialOrder(ctx context.Contex return it, nil } -func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.Context, obj interface{}) (ent.HostCredentialWhereInput, error) { - var it ent.HostCredentialWhereInput +func (ec *executionContext) unmarshalInputHostFileWhereInput(ctx context.Context, obj interface{}) (ent.HostFileWhereInput, error) { + var it ent.HostFileWhereInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalEqualFold", "principalContainsFold", "secret", "secretNEQ", "secretIn", "secretNotIn", "secretGT", "secretGTE", "secretLT", "secretLTE", "secretContains", "secretHasPrefix", "secretHasSuffix", "secretEqualFold", "secretContainsFold", "kind", "kindNEQ", "kindIn", "kindNotIn", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "path", "pathNEQ", "pathIn", "pathNotIn", "pathGT", "pathGTE", "pathLT", "pathLTE", "pathContains", "pathHasPrefix", "pathHasSuffix", "pathEqualFold", "pathContainsFold", "owner", "ownerNEQ", "ownerIn", "ownerNotIn", "ownerGT", "ownerGTE", "ownerLT", "ownerLTE", "ownerContains", "ownerHasPrefix", "ownerHasSuffix", "ownerIsNil", "ownerNotNil", "ownerEqualFold", "ownerContainsFold", "group", "groupNEQ", "groupIn", "groupNotIn", "groupGT", "groupGTE", "groupLT", "groupLTE", "groupContains", "groupHasPrefix", "groupHasSuffix", "groupIsNil", "groupNotNil", "groupEqualFold", "groupContainsFold", "permissions", "permissionsNEQ", "permissionsIn", "permissionsNotIn", "permissionsGT", "permissionsGTE", "permissionsLT", "permissionsLTE", "permissionsContains", "permissionsHasPrefix", "permissionsHasSuffix", "permissionsIsNil", "permissionsNotNil", "permissionsEqualFold", "permissionsContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashIsNil", "hashNotNil", "hashEqualFold", "hashContainsFold", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -8995,7 +10438,7 @@ func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.C var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOHostCredentialWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInput(ctx, v) + data, err := ec.unmarshalOHostFileWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInput(ctx, v) if err != nil { return it, err } @@ -9004,7 +10447,7 @@ func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.C var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -9013,7 +10456,7 @@ func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.C var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -9234,3593 +10677,3611 @@ func (ec *executionContext) unmarshalInputHostCredentialWhereInput(ctx context.C return it, err } it.LastModifiedAtLTE = data - case "principal": + case "path": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Principal = data - case "principalNEQ": + it.Path = data + case "pathNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalNEQ = data - case "principalIn": + it.PathNEQ = data + case "pathIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalIn = data - case "principalNotIn": + it.PathIn = data + case "pathNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalNotIn = data - case "principalGT": + it.PathNotIn = data + case "pathGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalGT = data - case "principalGTE": + it.PathGT = data + case "pathGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalGTE = data - case "principalLT": + it.PathGTE = data + case "pathLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalLT = data - case "principalLTE": + it.PathLT = data + case "pathLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalLTE = data - case "principalContains": + it.PathLTE = data + case "pathContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalContains = data - case "principalHasPrefix": + it.PathContains = data + case "pathHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalHasPrefix = data - case "principalHasSuffix": + it.PathHasPrefix = data + case "pathHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalHasSuffix = data - case "principalEqualFold": + it.PathHasSuffix = data + case "pathEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalEqualFold = data - case "principalContainsFold": + it.PathEqualFold = data + case "pathContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalContainsFold = data - case "secret": + it.PathContainsFold = data + case "owner": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secret")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("owner")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Secret = data - case "secretNEQ": + it.Owner = data + case "ownerNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretNEQ = data - case "secretIn": + it.OwnerNEQ = data + case "ownerIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SecretIn = data - case "secretNotIn": + it.OwnerIn = data + case "ownerNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SecretNotIn = data - case "secretGT": + it.OwnerNotIn = data + case "ownerGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretGT = data - case "secretGTE": + it.OwnerGT = data + case "ownerGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretGTE = data - case "secretLT": + it.OwnerGTE = data + case "ownerLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretLT = data - case "secretLTE": + it.OwnerLT = data + case "ownerLTE": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.OwnerLTE = data + case "ownerContains": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.OwnerContains = data + case "ownerHasPrefix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.OwnerHasPrefix = data + case "ownerHasSuffix": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.OwnerHasSuffix = data + case "ownerIsNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.OwnerIsNil = data + case "ownerNotNil": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.OwnerNotNil = data + case "ownerEqualFold": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.OwnerEqualFold = data + case "ownerContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretLTE = data - case "secretContains": + it.OwnerContainsFold = data + case "group": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("group")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretContains = data - case "secretHasPrefix": + it.Group = data + case "groupNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretHasPrefix = data - case "secretHasSuffix": + it.GroupNEQ = data + case "groupIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SecretHasSuffix = data - case "secretEqualFold": + it.GroupIn = data + case "groupNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.SecretEqualFold = data - case "secretContainsFold": + it.GroupNotIn = data + case "groupGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.SecretContainsFold = data - case "kind": + it.GroupGT = data + case "groupGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalOHostCredentialKind2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Kind = data - case "kindNEQ": + it.GroupGTE = data + case "groupLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindNEQ")) - data, err := ec.unmarshalOHostCredentialKind2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kind(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.KindNEQ = data - case "kindIn": + it.GroupLT = data + case "groupLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindIn")) - data, err := ec.unmarshalOHostCredentialKind2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kindᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.KindIn = data - case "kindNotIn": + it.GroupLTE = data + case "groupContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kindNotIn")) - data, err := ec.unmarshalOHostCredentialKind2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐCredential_Kindᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.KindNotIn = data - case "hasHost": + it.GroupContains = data + case "groupHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHost = data - case "hasHostWith": + it.GroupHasPrefix = data + case "groupHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHostWith = data - case "hasTask": + it.GroupHasSuffix = data + case "groupIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.HasTask = data - case "hasTaskWith": + it.GroupIsNil = data + case "groupNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.HasTaskWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostFileOrder(ctx context.Context, obj interface{}) (ent.HostFileOrder, error) { - var it ent.HostFileOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": + it.GroupNotNil = data + case "groupEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.GroupEqualFold = data + case "groupContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNHostFileOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostFileWhereInput(ctx context.Context, obj interface{}) (ent.HostFileWhereInput, error) { - var it ent.HostFileWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "path", "pathNEQ", "pathIn", "pathNotIn", "pathGT", "pathGTE", "pathLT", "pathLTE", "pathContains", "pathHasPrefix", "pathHasSuffix", "pathEqualFold", "pathContainsFold", "owner", "ownerNEQ", "ownerIn", "ownerNotIn", "ownerGT", "ownerGTE", "ownerLT", "ownerLTE", "ownerContains", "ownerHasPrefix", "ownerHasSuffix", "ownerIsNil", "ownerNotNil", "ownerEqualFold", "ownerContainsFold", "group", "groupNEQ", "groupIn", "groupNotIn", "groupGT", "groupGTE", "groupLT", "groupLTE", "groupContains", "groupHasPrefix", "groupHasSuffix", "groupIsNil", "groupNotNil", "groupEqualFold", "groupContainsFold", "permissions", "permissionsNEQ", "permissionsIn", "permissionsNotIn", "permissionsGT", "permissionsGTE", "permissionsLT", "permissionsLTE", "permissionsContains", "permissionsHasPrefix", "permissionsHasSuffix", "permissionsIsNil", "permissionsNotNil", "permissionsEqualFold", "permissionsContainsFold", "size", "sizeNEQ", "sizeIn", "sizeNotIn", "sizeGT", "sizeGTE", "sizeLT", "sizeLTE", "hash", "hashNEQ", "hashIn", "hashNotIn", "hashGT", "hashGTE", "hashLT", "hashLTE", "hashContains", "hashHasPrefix", "hashHasSuffix", "hashIsNil", "hashNotNil", "hashEqualFold", "hashContainsFold", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + it.GroupContainsFold = data + case "permissions": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOHostFileWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissions")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.Permissions = data + case "permissionsNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.PermissionsNEQ = data + case "permissionsIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.PermissionsIn = data + case "permissionsNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.PermissionsNotIn = data + case "permissionsGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.PermissionsGT = data + case "permissionsGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.PermissionsGTE = data + case "permissionsLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.PermissionsLT = data + case "permissionsLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.PermissionsLTE = data + case "permissionsContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": + it.PermissionsContains = data + case "permissionsHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.PermissionsHasPrefix = data + case "permissionsHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.PermissionsHasSuffix = data + case "permissionsIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.PermissionsIsNil = data + case "permissionsNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.PermissionsNotNil = data + case "permissionsEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.PermissionsEqualFold = data + case "permissionsContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.PermissionsContainsFold = data + case "size": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.Size = data + case "sizeNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.SizeNEQ = data + case "sizeIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.SizeIn = data + case "sizeNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": + it.SizeNotIn = data + case "sizeGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": + it.SizeGT = data + case "sizeGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": + it.SizeGTE = data + case "sizeLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": + it.SizeLT = data + case "sizeLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": + it.SizeLTE = data + case "hash": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": + it.Hash = data + case "hashNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": + it.HashNEQ = data + case "hashIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": + it.HashIn = data + case "hashNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "path": + it.HashNotIn = data + case "hashGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Path = data - case "pathNEQ": + it.HashGT = data + case "hashGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathNEQ = data - case "pathIn": + it.HashGTE = data + case "hashLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathIn = data - case "pathNotIn": + it.HashLT = data + case "hashLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathNotIn = data - case "pathGT": + it.HashLTE = data + case "hashContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathGT = data - case "pathGTE": + it.HashContains = data + case "hashHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathGTE = data - case "pathLT": + it.HashHasPrefix = data + case "hashHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathLT = data - case "pathLTE": + it.HashHasSuffix = data + case "hashIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PathLTE = data - case "pathContains": + it.HashIsNil = data + case "hashNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PathContains = data - case "pathHasPrefix": + it.HashNotNil = data + case "hashEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathHasPrefix = data - case "pathHasSuffix": + it.HashEqualFold = data + case "hashContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PathHasSuffix = data - case "pathEqualFold": + it.HashContainsFold = data + case "hasHost": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.PathEqualFold = data - case "pathContainsFold": + it.HasHost = data + case "hasHostWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.PathContainsFold = data - case "owner": + it.HasHostWith = data + case "hasTask": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("owner")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Owner = data - case "ownerNEQ": + it.HasTask = data + case "hasTaskWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.OwnerNEQ = data - case "ownerIn": + it.HasTaskWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputHostOrder(ctx context.Context, obj interface{}) (ent.HostOrder, error) { + var it ent.HostOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.OwnerIn = data - case "ownerNotIn": + it.Direction = data + case "field": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNHostOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostOrderField(ctx, v) if err != nil { return it, err } - it.OwnerNotIn = data - case "ownerGT": - var err error + it.Field = data + } + } - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.OwnerGT = data - case "ownerGTE": - var err error + return it, nil +} - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.OwnerGTE = data - case "ownerLT": - var err error +func (ec *executionContext) unmarshalInputHostProcessOrder(ctx context.Context, obj interface{}) (ent.HostProcessOrder, error) { + var it ent.HostProcessOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.OwnerLT = data - case "ownerLTE": - var err error + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.OwnerLTE = data - case "ownerContains": + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.OwnerContains = data - case "ownerHasPrefix": + it.Direction = data + case "field": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNHostProcessOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessOrderField(ctx, v) if err != nil { return it, err } - it.OwnerHasPrefix = data - case "ownerHasSuffix": + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputHostProcessWhereInput(ctx context.Context, obj interface{}) (ent.HostProcessWhereInput, error) { + var it ent.HostProcessWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "pid", "pidNEQ", "pidIn", "pidNotIn", "pidGT", "pidGTE", "pidLT", "pidLTE", "ppid", "ppidNEQ", "ppidIn", "ppidNotIn", "ppidGT", "ppidGTE", "ppidLT", "ppidLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalEqualFold", "principalContainsFold", "path", "pathNEQ", "pathIn", "pathNotIn", "pathGT", "pathGTE", "pathLT", "pathLTE", "pathContains", "pathHasPrefix", "pathHasSuffix", "pathIsNil", "pathNotNil", "pathEqualFold", "pathContainsFold", "cmd", "cmdNEQ", "cmdIn", "cmdNotIn", "cmdGT", "cmdGTE", "cmdLT", "cmdLTE", "cmdContains", "cmdHasPrefix", "cmdHasSuffix", "cmdIsNil", "cmdNotNil", "cmdEqualFold", "cmdContainsFold", "env", "envNEQ", "envIn", "envNotIn", "envGT", "envGTE", "envLT", "envLTE", "envContains", "envHasPrefix", "envHasSuffix", "envIsNil", "envNotNil", "envEqualFold", "envContainsFold", "cwd", "cwdNEQ", "cwdIn", "cwdNotIn", "cwdGT", "cwdGTE", "cwdLT", "cwdLTE", "cwdContains", "cwdHasPrefix", "cwdHasSuffix", "cwdIsNil", "cwdNotNil", "cwdEqualFold", "cwdContainsFold", "status", "statusNEQ", "statusIn", "statusNotIn", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOHostProcessWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInput(ctx, v) if err != nil { return it, err } - it.OwnerHasSuffix = data - case "ownerIsNil": + it.Not = data + case "and": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.OwnerIsNil = data - case "ownerNotNil": + it.And = data + case "or": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.OwnerNotNil = data - case "ownerEqualFold": + it.Or = data + case "id": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.OwnerEqualFold = data - case "ownerContainsFold": + it.ID = data + case "idNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.OwnerContainsFold = data - case "group": + it.IDNEQ = data + case "idIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("group")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.Group = data - case "groupNEQ": + it.IDIn = data + case "idNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.GroupNEQ = data - case "groupIn": + it.IDNotIn = data + case "idGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.GroupIn = data - case "groupNotIn": + it.IDGT = data + case "idGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.GroupNotIn = data - case "groupGT": + it.IDGTE = data + case "idLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.GroupGT = data - case "groupGTE": + it.IDLT = data + case "idLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.GroupGTE = data - case "groupLT": + it.IDLTE = data + case "createdAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupLT = data - case "groupLTE": + it.CreatedAt = data + case "createdAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupLTE = data - case "groupContains": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.GroupContains = data - case "groupHasPrefix": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.GroupHasPrefix = data - case "groupHasSuffix": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupHasSuffix = data - case "groupIsNil": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupIsNil = data - case "groupNotNil": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupNotNil = data - case "groupEqualFold": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupEqualFold = data - case "groupContainsFold": + it.CreatedAtLTE = data + case "lastModifiedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groupContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.GroupContainsFold = data - case "permissions": + it.LastModifiedAt = data + case "lastModifiedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissions")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Permissions = data - case "permissionsNEQ": + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.PermissionsNEQ = data - case "permissionsIn": + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.PermissionsIn = data - case "permissionsNotIn": + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PermissionsNotIn = data - case "permissionsGT": + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PermissionsGT = data - case "permissionsGTE": + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PermissionsGTE = data - case "permissionsLT": + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PermissionsLT = data - case "permissionsLTE": + it.LastModifiedAtLTE = data + case "pid": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pid")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsLTE = data - case "permissionsContains": + it.Pid = data + case "pidNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidNEQ")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsContains = data - case "permissionsHasPrefix": + it.PidNEQ = data + case "pidIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.PermissionsHasPrefix = data - case "permissionsHasSuffix": + it.PidIn = data + case "pidNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidNotIn")) + data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.PermissionsHasSuffix = data - case "permissionsIsNil": + it.PidNotIn = data + case "pidGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidGT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsIsNil = data - case "permissionsNotNil": + it.PidGT = data + case "pidGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidGTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsNotNil = data - case "permissionsEqualFold": + it.PidGTE = data + case "pidLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidLT")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsEqualFold = data - case "permissionsContainsFold": + it.PidLT = data + case "pidLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissionsContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidLTE")) + data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.PermissionsContainsFold = data - case "size": + it.PidLTE = data + case "ppid": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppid")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.Size = data - case "sizeNEQ": + it.Ppid = data + case "ppidNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidNEQ")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.SizeNEQ = data - case "sizeIn": + it.PpidNEQ = data + case "ppidIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidIn")) data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.SizeIn = data - case "sizeNotIn": + it.PpidIn = data + case "ppidNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidNotIn")) data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) if err != nil { return it, err } - it.SizeNotIn = data - case "sizeGT": + it.PpidNotIn = data + case "ppidGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidGT")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.SizeGT = data - case "sizeGTE": + it.PpidGT = data + case "ppidGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidGTE")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.SizeGTE = data - case "sizeLT": + it.PpidGTE = data + case "ppidLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidLT")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.SizeLT = data - case "sizeLTE": + it.PpidLT = data + case "ppidLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sizeLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidLTE")) data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) if err != nil { return it, err } - it.SizeLTE = data - case "hash": + it.PpidLTE = data + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Hash = data - case "hashNEQ": + it.Name = data + case "nameNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashNEQ = data - case "hashIn": + it.NameNEQ = data + case "nameIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HashIn = data - case "hashNotIn": + it.NameIn = data + case "nameNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HashNotIn = data - case "hashGT": + it.NameNotIn = data + case "nameGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGT = data - case "hashGTE": + it.NameGT = data + case "nameGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashGTE = data - case "hashLT": + it.NameGTE = data + case "nameLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashLT = data - case "hashLTE": + it.NameLT = data + case "nameLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashLTE = data - case "hashContains": + it.NameLTE = data + case "nameContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashContains = data - case "hashHasPrefix": + it.NameContains = data + case "nameHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashHasPrefix = data - case "hashHasSuffix": + it.NameHasPrefix = data + case "nameHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashHasSuffix = data - case "hashIsNil": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.HashIsNil = data - case "hashNotNil": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.HashNotNil = data - case "hashEqualFold": + it.NameHasSuffix = data + case "nameEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashEqualFold = data - case "hashContainsFold": + it.NameEqualFold = data + case "nameContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hashContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HashContainsFold = data - case "hasHost": + it.NameContainsFold = data + case "principal": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHost = data - case "hasHostWith": + it.Principal = data + case "principalNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHostWith = data - case "hasTask": + it.PrincipalNEQ = data + case "principalIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HasTask = data - case "hasTaskWith": + it.PrincipalIn = data + case "principalNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.HasTaskWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostOrder(ctx context.Context, obj interface{}) (ent.HostOrder, error) { - var it ent.HostOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": + it.PrincipalNotIn = data + case "principalGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.PrincipalGT = data + case "principalGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNHostOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostProcessOrder(ctx context.Context, obj interface{}) (ent.HostProcessOrder, error) { - var it ent.HostProcessOrder - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - if _, present := asMap["direction"]; !present { - asMap["direction"] = "ASC" - } - - fieldsInOrder := [...]string{"direction", "field"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "direction": + it.PrincipalGTE = data + case "principalLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Direction = data - case "field": + it.PrincipalLT = data + case "principalLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNHostProcessOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessOrderField(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Field = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostProcessWhereInput(ctx context.Context, obj interface{}) (ent.HostProcessWhereInput, error) { - var it ent.HostProcessWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "pid", "pidNEQ", "pidIn", "pidNotIn", "pidGT", "pidGTE", "pidLT", "pidLTE", "ppid", "ppidNEQ", "ppidIn", "ppidNotIn", "ppidGT", "ppidGTE", "ppidLT", "ppidLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "principal", "principalNEQ", "principalIn", "principalNotIn", "principalGT", "principalGTE", "principalLT", "principalLTE", "principalContains", "principalHasPrefix", "principalHasSuffix", "principalEqualFold", "principalContainsFold", "path", "pathNEQ", "pathIn", "pathNotIn", "pathGT", "pathGTE", "pathLT", "pathLTE", "pathContains", "pathHasPrefix", "pathHasSuffix", "pathIsNil", "pathNotNil", "pathEqualFold", "pathContainsFold", "cmd", "cmdNEQ", "cmdIn", "cmdNotIn", "cmdGT", "cmdGTE", "cmdLT", "cmdLTE", "cmdContains", "cmdHasPrefix", "cmdHasSuffix", "cmdIsNil", "cmdNotNil", "cmdEqualFold", "cmdContainsFold", "env", "envNEQ", "envIn", "envNotIn", "envGT", "envGTE", "envLT", "envLTE", "envContains", "envHasPrefix", "envHasSuffix", "envIsNil", "envNotNil", "envEqualFold", "envContainsFold", "cwd", "cwdNEQ", "cwdIn", "cwdNotIn", "cwdGT", "cwdGTE", "cwdLT", "cwdLTE", "cwdContains", "cwdHasPrefix", "cwdHasSuffix", "cwdIsNil", "cwdNotNil", "cwdEqualFold", "cwdContainsFold", "status", "statusNEQ", "statusIn", "statusNotIn", "hasHost", "hasHostWith", "hasTask", "hasTaskWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + it.PrincipalLTE = data + case "principalContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOHostProcessWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.PrincipalContains = data + case "principalHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.PrincipalHasPrefix = data + case "principalHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.PrincipalHasSuffix = data + case "principalEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.PrincipalEqualFold = data + case "principalContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.PrincipalContainsFold = data + case "path": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.Path = data + case "pathNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.PathNEQ = data + case "pathIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.PathIn = data + case "pathNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.IDGTE = data - case "idLT": + it.PathNotIn = data + case "pathGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.PathGT = data + case "pathGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.PathGTE = data + case "pathLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.PathLT = data + case "pathLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.PathLTE = data + case "pathContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.PathContains = data + case "pathHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.PathHasPrefix = data + case "pathHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.PathHasSuffix = data + case "pathIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.PathIsNil = data + case "pathNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.PathNotNil = data + case "pathEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": + it.PathEqualFold = data + case "pathContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": + it.PathContainsFold = data + case "cmd": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmd")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": + it.Cmd = data + case "cmdNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": + it.CmdNEQ = data + case "cmdIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": + it.CmdIn = data + case "cmdNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": + it.CmdNotIn = data + case "cmdGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": + it.CmdGT = data + case "cmdGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": + it.CmdGTE = data + case "cmdLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "pid": + it.CmdLT = data + case "cmdLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pid")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Pid = data - case "pidNEQ": + it.CmdLTE = data + case "cmdContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidNEQ")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PidNEQ = data - case "pidIn": + it.CmdContains = data + case "cmdHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PidIn = data - case "pidNotIn": + it.CmdHasPrefix = data + case "cmdHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidNotIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PidNotIn = data - case "pidGT": + it.CmdHasSuffix = data + case "cmdIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidGT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PidGT = data - case "pidGTE": + it.CmdIsNil = data + case "cmdNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidGTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PidGTE = data - case "pidLT": + it.CmdNotNil = data + case "cmdEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidLT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PidLT = data - case "pidLTE": + it.CmdEqualFold = data + case "cmdContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pidLTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PidLTE = data - case "ppid": + it.CmdContainsFold = data + case "env": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppid")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("env")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Ppid = data - case "ppidNEQ": + it.Env = data + case "envNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidNEQ")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PpidNEQ = data - case "ppidIn": + it.EnvNEQ = data + case "envIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PpidIn = data - case "ppidNotIn": + it.EnvIn = data + case "envNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidNotIn")) - data, err := ec.unmarshalOUint642ᚕuint64ᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PpidNotIn = data - case "ppidGT": + it.EnvNotIn = data + case "envGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidGT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PpidGT = data - case "ppidGTE": + it.EnvGT = data + case "envGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidGTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PpidGTE = data - case "ppidLT": + it.EnvGTE = data + case "envLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidLT")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PpidLT = data - case "ppidLTE": + it.EnvLT = data + case "envLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ppidLTE")) - data, err := ec.unmarshalOUint642ᚖuint64(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PpidLTE = data - case "name": + it.EnvLTE = data + case "envContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.EnvContains = data + case "envHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.EnvHasPrefix = data + case "envHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.EnvHasSuffix = data + case "envIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.EnvIsNil = data + case "envNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.EnvNotNil = data + case "envEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.EnvEqualFold = data + case "envContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.EnvContainsFold = data + case "cwd": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwd")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.Cwd = data + case "cwdNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.CwdNEQ = data + case "cwdIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.CwdIn = data + case "cwdNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.CwdNotIn = data + case "cwdGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.CwdGT = data + case "cwdGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "principal": + it.CwdGTE = data + case "cwdLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principal")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Principal = data - case "principalNEQ": + it.CwdLT = data + case "cwdLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalNEQ = data - case "principalIn": + it.CwdLTE = data + case "cwdContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalIn = data - case "principalNotIn": + it.CwdContains = data + case "cwdHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalNotIn = data - case "principalGT": + it.CwdHasPrefix = data + case "cwdHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalGT = data - case "principalGTE": + it.CwdHasSuffix = data + case "cwdIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PrincipalGTE = data - case "principalLT": + it.CwdIsNil = data + case "cwdNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.PrincipalLT = data - case "principalLTE": + it.CwdNotNil = data + case "cwdEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalLTE = data - case "principalContains": + it.CwdEqualFold = data + case "cwdContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrincipalContains = data - case "principalHasPrefix": + it.CwdContainsFold = data + case "status": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) + data, err := ec.unmarshalOHostProcessStatus2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status(ctx, v) if err != nil { return it, err } - it.PrincipalHasPrefix = data - case "principalHasSuffix": + it.Status = data + case "statusNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusNEQ")) + data, err := ec.unmarshalOHostProcessStatus2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status(ctx, v) if err != nil { return it, err } - it.PrincipalHasSuffix = data - case "principalEqualFold": + it.StatusNEQ = data + case "statusIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusIn")) + data, err := ec.unmarshalOHostProcessStatus2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Statusᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalEqualFold = data - case "principalContainsFold": + it.StatusIn = data + case "statusNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("principalContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusNotIn")) + data, err := ec.unmarshalOHostProcessStatus2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Statusᚄ(ctx, v) if err != nil { return it, err } - it.PrincipalContainsFold = data - case "path": + it.StatusNotIn = data + case "hasHost": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Path = data - case "pathNEQ": + it.HasHost = data + case "hasHostWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.PathNEQ = data - case "pathIn": + it.HasHostWith = data + case "hasTask": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.PathIn = data - case "pathNotIn": + it.HasTask = data + case "hasTaskWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.PathNotIn = data - case "pathGT": + it.HasTaskWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputHostWhereInput(ctx context.Context, obj interface{}) (ent.HostWhereInput, error) { + var it ent.HostWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameIsNil", "nameNotNil", "nameEqualFold", "nameContainsFold", "primaryIP", "primaryIPNEQ", "primaryIPIn", "primaryIPNotIn", "primaryIPGT", "primaryIPGTE", "primaryIPLT", "primaryIPLTE", "primaryIPContains", "primaryIPHasPrefix", "primaryIPHasSuffix", "primaryIPIsNil", "primaryIPNotNil", "primaryIPEqualFold", "primaryIPContainsFold", "platform", "platformNEQ", "platformIn", "platformNotIn", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "hasTags", "hasTagsWith", "hasBeacons", "hasBeaconsWith", "hasFiles", "hasFilesWith", "hasProcesses", "hasProcessesWith", "hasCredentials", "hasCredentialsWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOHostWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInput(ctx, v) if err != nil { return it, err } - it.PathGT = data - case "pathGTE": + it.Not = data + case "and": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.PathGTE = data - case "pathLT": + it.And = data + case "or": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.PathLT = data - case "pathLTE": + it.Or = data + case "id": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathLTE = data - case "pathContains": + it.ID = data + case "idNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathContains = data - case "pathHasPrefix": + it.IDNEQ = data + case "idIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.PathHasPrefix = data - case "pathHasSuffix": + it.IDIn = data + case "idNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.PathHasSuffix = data - case "pathIsNil": + it.IDNotIn = data + case "idGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathIsNil = data - case "pathNotNil": + it.IDGT = data + case "idGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathNotNil = data - case "pathEqualFold": + it.IDGTE = data + case "idLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathEqualFold = data - case "pathContainsFold": + it.IDLT = data + case "idLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pathContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.PathContainsFold = data - case "cmd": + it.IDLTE = data + case "createdAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmd")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Cmd = data - case "cmdNEQ": + it.CreatedAt = data + case "createdAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdNEQ = data - case "cmdIn": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CmdIn = data - case "cmdNotIn": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CmdNotIn = data - case "cmdGT": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdGT = data - case "cmdGTE": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdGTE = data - case "cmdLT": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdLT = data - case "cmdLTE": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdLTE = data - case "cmdContains": + it.CreatedAtLTE = data + case "lastModifiedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdContains = data - case "cmdHasPrefix": + it.LastModifiedAt = data + case "lastModifiedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdHasPrefix = data - case "cmdHasSuffix": + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CmdHasSuffix = data - case "cmdIsNil": + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CmdIsNil = data - case "cmdNotNil": + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdNotNil = data - case "cmdEqualFold": + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdEqualFold = data - case "cmdContainsFold": + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cmdContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CmdContainsFold = data - case "env": + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("env")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Env = data - case "envNEQ": + it.LastModifiedAtLTE = data + case "identifier": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvNEQ = data - case "envIn": + it.Identifier = data + case "identifierNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvIn = data - case "envNotIn": + it.IdentifierNEQ = data + case "identifierIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvNotIn = data - case "envGT": + it.IdentifierIn = data + case "identifierNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvGT = data - case "envGTE": + it.IdentifierNotIn = data + case "identifierGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvGTE = data - case "envLT": + it.IdentifierGT = data + case "identifierGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvLT = data - case "envLTE": + it.IdentifierGTE = data + case "identifierLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvLTE = data - case "envContains": + it.IdentifierLT = data + case "identifierLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvContains = data - case "envHasPrefix": + it.IdentifierLTE = data + case "identifierContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvHasPrefix = data - case "envHasSuffix": + it.IdentifierContains = data + case "identifierHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvHasSuffix = data - case "envIsNil": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.EnvIsNil = data - case "envNotNil": + it.IdentifierHasPrefix = data + case "identifierHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvNotNil = data - case "envEqualFold": + it.IdentifierHasSuffix = data + case "identifierEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvEqualFold = data - case "envContainsFold": + it.IdentifierEqualFold = data + case "identifierContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.EnvContainsFold = data - case "cwd": + it.IdentifierContainsFold = data + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwd")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Cwd = data - case "cwdNEQ": + it.Name = data + case "nameNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdNEQ = data - case "cwdIn": + it.NameNEQ = data + case "nameIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CwdIn = data - case "cwdNotIn": + it.NameIn = data + case "nameNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.CwdNotIn = data - case "cwdGT": + it.NameNotIn = data + case "nameGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdGT = data - case "cwdGTE": + it.NameGT = data + case "nameGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdGTE = data - case "cwdLT": + it.NameGTE = data + case "nameLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdLT = data - case "cwdLTE": + it.NameLT = data + case "nameLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdLTE = data - case "cwdContains": + it.NameLTE = data + case "nameContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdContains = data - case "cwdHasPrefix": + it.NameContains = data + case "nameHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdHasPrefix = data - case "cwdHasSuffix": + it.NameHasPrefix = data + case "nameHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdHasSuffix = data - case "cwdIsNil": + it.NameHasSuffix = data + case "nameIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdIsNil")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CwdIsNil = data - case "cwdNotNil": + it.NameIsNil = data + case "nameNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdNotNil")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.CwdNotNil = data - case "cwdEqualFold": + it.NameNotNil = data + case "nameEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdEqualFold = data - case "cwdContainsFold": + it.NameEqualFold = data + case "nameContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cwdContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.CwdContainsFold = data - case "status": + it.NameContainsFold = data + case "primaryIP": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) - data, err := ec.unmarshalOHostProcessStatus2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIP")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Status = data - case "statusNEQ": + it.PrimaryIP = data + case "primaryIPNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusNEQ")) - data, err := ec.unmarshalOHostProcessStatus2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Status(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.StatusNEQ = data - case "statusIn": + it.PrimaryIPNEQ = data + case "primaryIPIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusIn")) - data, err := ec.unmarshalOHostProcessStatus2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Statusᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusIn = data - case "statusNotIn": + it.PrimaryIPIn = data + case "primaryIPNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("statusNotIn")) - data, err := ec.unmarshalOHostProcessStatus2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋepbᚐProcess_Statusᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.StatusNotIn = data - case "hasHost": + it.PrimaryIPNotIn = data + case "primaryIPGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHost")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHost = data - case "hasHostWith": + it.PrimaryIPGT = data + case "primaryIPGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasHostWith")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasHostWith = data - case "hasTask": + it.PrimaryIPGTE = data + case "primaryIPLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTask")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTask = data - case "hasTaskWith": + it.PrimaryIPLT = data + case "primaryIPLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTaskWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTaskWith = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputHostWhereInput(ctx context.Context, obj interface{}) (ent.HostWhereInput, error) { - var it ent.HostWhereInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "identifier", "identifierNEQ", "identifierIn", "identifierNotIn", "identifierGT", "identifierGTE", "identifierLT", "identifierLTE", "identifierContains", "identifierHasPrefix", "identifierHasSuffix", "identifierEqualFold", "identifierContainsFold", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameIsNil", "nameNotNil", "nameEqualFold", "nameContainsFold", "primaryIP", "primaryIPNEQ", "primaryIPIn", "primaryIPNotIn", "primaryIPGT", "primaryIPGTE", "primaryIPLT", "primaryIPLTE", "primaryIPContains", "primaryIPHasPrefix", "primaryIPHasSuffix", "primaryIPIsNil", "primaryIPNotNil", "primaryIPEqualFold", "primaryIPContainsFold", "platform", "platformNEQ", "platformIn", "platformNotIn", "lastSeenAt", "lastSeenAtNEQ", "lastSeenAtIn", "lastSeenAtNotIn", "lastSeenAtGT", "lastSeenAtGTE", "lastSeenAtLT", "lastSeenAtLTE", "lastSeenAtIsNil", "lastSeenAtNotNil", "hasTags", "hasTagsWith", "hasBeacons", "hasBeaconsWith", "hasFiles", "hasFilesWith", "hasProcesses", "hasProcessesWith", "hasCredentials", "hasCredentialsWith"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "not": + it.PrimaryIPLTE = data + case "primaryIPContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOHostWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Not = data - case "and": + it.PrimaryIPContains = data + case "primaryIPHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "or": + it.PrimaryIPHasPrefix = data + case "primaryIPHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOHostWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "id": + it.PrimaryIPHasSuffix = data + case "primaryIPIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.ID = data - case "idNEQ": + it.PrimaryIPIsNil = data + case "primaryIPNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.IDNEQ = data - case "idIn": + it.PrimaryIPNotNil = data + case "primaryIPEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDIn = data - case "idNotIn": + it.PrimaryIPEqualFold = data + case "primaryIPContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) - data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.IDNotIn = data - case "idGT": + it.PrimaryIPContainsFold = data + case "platform": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platform")) + data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) if err != nil { return it, err } - it.IDGT = data - case "idGTE": + it.Platform = data + case "platformNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformNEQ")) + data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) if err != nil { return it, err - } - it.IDGTE = data - case "idLT": + } + it.PlatformNEQ = data + case "platformIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformIn")) + data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) if err != nil { return it, err } - it.IDLT = data - case "idLTE": + it.PlatformIn = data + case "platformNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) - data, err := ec.unmarshalOID2ᚖint(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformNotIn")) + data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) if err != nil { return it, err } - it.IDLTE = data - case "createdAt": + it.PlatformNotIn = data + case "lastSeenAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAt = data - case "createdAtNEQ": + it.LastSeenAt = data + case "lastSeenAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtNEQ = data - case "createdAtIn": + it.LastSeenAtNEQ = data + case "lastSeenAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtIn = data - case "createdAtNotIn": + it.LastSeenAtIn = data + case "lastSeenAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.CreatedAtNotIn = data - case "createdAtGT": + it.LastSeenAtNotIn = data + case "lastSeenAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGT = data - case "createdAtGTE": + it.LastSeenAtGT = data + case "lastSeenAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtGTE = data - case "createdAtLT": + it.LastSeenAtGTE = data + case "lastSeenAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtLT = data - case "createdAtLTE": + it.LastSeenAtLT = data + case "lastSeenAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.CreatedAtLTE = data - case "lastModifiedAt": + it.LastSeenAtLTE = data + case "lastSeenAtIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAt = data - case "lastModifiedAtNEQ": + it.LastSeenAtIsNil = data + case "lastSeenAtNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNEQ = data - case "lastModifiedAtIn": + it.LastSeenAtNotNil = data + case "hasTags": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTags")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtIn = data - case "lastModifiedAtNotIn": + it.HasTags = data + case "hasTagsWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTagsWith")) + data, err := ec.unmarshalOTagWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtNotIn = data - case "lastModifiedAtGT": + it.HasTagsWith = data + case "hasBeacons": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBeacons")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGT = data - case "lastModifiedAtGTE": + it.HasBeacons = data + case "hasBeaconsWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBeaconsWith")) + data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtGTE = data - case "lastModifiedAtLT": + it.HasBeaconsWith = data + case "hasFiles": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFiles")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLT = data - case "lastModifiedAtLTE": + it.HasFiles = data + case "hasFilesWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFilesWith")) + data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.LastModifiedAtLTE = data - case "identifier": + it.HasFilesWith = data + case "hasProcesses": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifier")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasProcesses")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Identifier = data - case "identifierNEQ": + it.HasProcesses = data + case "hasProcessesWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasProcessesWith")) + data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierNEQ = data - case "identifierIn": + it.HasProcessesWith = data + case "hasCredentials": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCredentials")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.IdentifierIn = data - case "identifierNotIn": + it.HasCredentials = data + case "hasCredentialsWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCredentialsWith")) + data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierNotIn = data - case "identifierGT": + it.HasCredentialsWith = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputQuestOrder(ctx context.Context, obj interface{}) (ent.QuestOrder, error) { + var it ent.QuestOrder + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["direction"]; !present { + asMap["direction"] = "ASC" + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.IdentifierGT = data - case "identifierGTE": + it.Direction = data + case "field": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNQuestOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestOrderField(ctx, v) if err != nil { return it, err } - it.IdentifierGTE = data - case "identifierLT": + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, obj interface{}) (ent.QuestWhereInput, error) { + var it ent.QuestWhereInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "parameters", "parametersNEQ", "parametersIn", "parametersNotIn", "parametersGT", "parametersGTE", "parametersLT", "parametersLTE", "parametersContains", "parametersHasPrefix", "parametersHasSuffix", "parametersIsNil", "parametersNotNil", "parametersEqualFold", "parametersContainsFold", "hasTome", "hasTomeWith", "hasBundle", "hasBundleWith", "hasTasks", "hasTasksWith", "hasCreator", "hasCreatorWith"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "not": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) + data, err := ec.unmarshalOQuestWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInput(ctx, v) if err != nil { return it, err } - it.IdentifierLT = data - case "identifierLTE": + it.Not = data + case "and": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) + data, err := ec.unmarshalOQuestWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierLTE = data - case "identifierContains": + it.And = data + case "or": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) + data, err := ec.unmarshalOQuestWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "id": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "idNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierContains = data - case "identifierHasPrefix": + it.IDNEQ = data + case "idIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierHasPrefix = data - case "identifierHasSuffix": + it.IDIn = data + case "idNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) if err != nil { return it, err } - it.IdentifierHasSuffix = data - case "identifierEqualFold": + it.IDNotIn = data + case "idGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierEqualFold = data - case "identifierContainsFold": + it.IDGT = data + case "idGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("identifierContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.IdentifierContainsFold = data - case "name": + it.IDGTE = data + case "idLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.Name = data - case "nameNEQ": + it.IDLT = data + case "idLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) + data, err := ec.unmarshalOID2ᚖint(ctx, v) if err != nil { return it, err } - it.NameNEQ = data - case "nameIn": + it.IDLTE = data + case "createdAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameIn = data - case "nameNotIn": + it.CreatedAt = data + case "createdAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameNotIn = data - case "nameGT": + it.CreatedAtNEQ = data + case "createdAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameGT = data - case "nameGTE": + it.CreatedAtIn = data + case "createdAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameGTE = data - case "nameLT": + it.CreatedAtNotIn = data + case "createdAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.CreatedAtGT = data + case "createdAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.CreatedAtGTE = data + case "createdAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.CreatedAtLT = data + case "createdAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.CreatedAtLTE = data + case "lastModifiedAt": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameIsNil": + it.LastModifiedAt = data + case "lastModifiedAtNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameIsNil = data - case "nameNotNil": + it.LastModifiedAtNEQ = data + case "lastModifiedAtIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameNotNil = data - case "nameEqualFold": + it.LastModifiedAtIn = data + case "lastModifiedAtNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.LastModifiedAtNotIn = data + case "lastModifiedAtGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "primaryIP": + it.LastModifiedAtGT = data + case "lastModifiedAtGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIP")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PrimaryIP = data - case "primaryIPNEQ": + it.LastModifiedAtGTE = data + case "lastModifiedAtLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PrimaryIPNEQ = data - case "primaryIPIn": + it.LastModifiedAtLT = data + case "lastModifiedAtLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastModifiedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.PrimaryIPIn = data - case "primaryIPNotIn": + it.LastModifiedAtLTE = data + case "name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPNotIn = data - case "primaryIPGT": + it.Name = data + case "nameNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPGT = data - case "primaryIPGTE": + it.NameNEQ = data + case "nameIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrimaryIPGTE = data - case "primaryIPLT": + it.NameIn = data + case "nameNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PrimaryIPLT = data - case "primaryIPLTE": + it.NameNotIn = data + case "nameGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPLTE = data - case "primaryIPContains": + it.NameGT = data + case "nameGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPContains")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPContains = data - case "primaryIPHasPrefix": + it.NameGTE = data + case "nameLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPHasPrefix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPHasPrefix = data - case "primaryIPHasSuffix": + it.NameLT = data + case "nameLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPHasSuffix = data - case "primaryIPIsNil": + it.NameLTE = data + case "nameContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPIsNil = data - case "primaryIPNotNil": + it.NameContains = data + case "nameHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPNotNil = data - case "primaryIPEqualFold": + it.NameHasPrefix = data + case "nameHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPEqualFold = data - case "primaryIPContainsFold": + it.NameHasSuffix = data + case "nameEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("primaryIPContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PrimaryIPContainsFold = data - case "platform": + it.NameEqualFold = data + case "nameContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platform")) - data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Platform = data - case "platformNEQ": + it.NameContainsFold = data + case "parameters": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformNEQ")) - data, err := ec.unmarshalOHostPlatform2ᚖrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platform(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PlatformNEQ = data - case "platformIn": + it.Parameters = data + case "parametersNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformIn")) - data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.PlatformIn = data - case "platformNotIn": + it.ParametersNEQ = data + case "parametersIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("platformNotIn")) - data, err := ec.unmarshalOHostPlatform2ᚕrealmᚗpubᚋtavernᚋinternalᚋc2ᚋc2pbᚐHost_Platformᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.PlatformNotIn = data - case "lastSeenAt": + it.ParametersIn = data + case "parametersNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAt")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.LastSeenAt = data - case "lastSeenAtNEQ": + it.ParametersNotIn = data + case "parametersGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNEQ")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtNEQ = data - case "lastSeenAtIn": + it.ParametersGT = data + case "parametersGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtIn = data - case "lastSeenAtNotIn": + it.ParametersGTE = data + case "parametersLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotIn")) - data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtNotIn = data - case "lastSeenAtGT": + it.ParametersLT = data + case "parametersLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtGT = data - case "lastSeenAtGTE": + it.ParametersLTE = data + case "parametersContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtGTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtGTE = data - case "lastSeenAtLT": + it.ParametersContains = data + case "parametersHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLT")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtLT = data - case "lastSeenAtLTE": + it.ParametersHasPrefix = data + case "parametersHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtLTE")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.LastSeenAtLTE = data - case "lastSeenAtIsNil": + it.ParametersHasSuffix = data + case "parametersIsNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtIsNil")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastSeenAtIsNil = data - case "lastSeenAtNotNil": + it.ParametersIsNil = data + case "parametersNotNil": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSeenAtNotNil")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.LastSeenAtNotNil = data - case "hasTags": + it.ParametersNotNil = data + case "parametersEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTags")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTags = data - case "hasTagsWith": + it.ParametersEqualFold = data + case "parametersContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTagsWith")) - data, err := ec.unmarshalOTagWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTagsWith = data - case "hasBeacons": + it.ParametersContainsFold = data + case "hasTome": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBeacons")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTome")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasBeacons = data - case "hasBeaconsWith": + it.HasTome = data + case "hasTomeWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBeaconsWith")) - data, err := ec.unmarshalOBeaconWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐBeaconWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomeWith")) + data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasBeaconsWith = data - case "hasFiles": + it.HasTomeWith = data + case "hasBundle": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFiles")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBundle")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasFiles = data - case "hasFilesWith": + it.HasBundle = data + case "hasBundleWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFilesWith")) - data, err := ec.unmarshalOHostFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostFileWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBundleWith")) + data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasFilesWith = data - case "hasProcesses": + it.HasBundleWith = data + case "hasTasks": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasProcesses")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasProcesses = data - case "hasProcessesWith": + it.HasTasks = data + case "hasTasksWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasProcessesWith")) - data, err := ec.unmarshalOHostProcessWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostProcessWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) + data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasProcessesWith = data - case "hasCredentials": + it.HasTasksWith = data + case "hasCreator": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCredentials")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreator")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasCredentials = data - case "hasCredentialsWith": + it.HasCreator = data + case "hasCreatorWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCredentialsWith")) - data, err := ec.unmarshalOHostCredentialWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐHostCredentialWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreatorWith")) + data, err := ec.unmarshalOUserWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasCredentialsWith = data + it.HasCreatorWith = data } } return it, nil } -func (ec *executionContext) unmarshalInputQuestOrder(ctx context.Context, obj interface{}) (ent.QuestOrder, error) { - var it ent.QuestOrder +func (ec *executionContext) unmarshalInputRepositoryOrder(ctx context.Context, obj interface{}) (ent.RepositoryOrder, error) { + var it ent.RepositoryOrder asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v @@ -12850,7 +14311,7 @@ func (ec *executionContext) unmarshalInputQuestOrder(ctx context.Context, obj in var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNQuestOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestOrderField(ctx, v) + data, err := ec.unmarshalNRepositoryOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrderField(ctx, v) if err != nil { return it, err } @@ -12861,14 +14322,14 @@ func (ec *executionContext) unmarshalInputQuestOrder(ctx context.Context, obj in return it, nil } -func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, obj interface{}) (ent.QuestWhereInput, error) { - var it ent.QuestWhereInput +func (ec *executionContext) unmarshalInputRepositoryWhereInput(ctx context.Context, obj interface{}) (ent.RepositoryWhereInput, error) { + var it ent.RepositoryWhereInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "parameters", "parametersNEQ", "parametersIn", "parametersNotIn", "parametersGT", "parametersGTE", "parametersLT", "parametersLTE", "parametersContains", "parametersHasPrefix", "parametersHasSuffix", "parametersIsNil", "parametersNotNil", "parametersEqualFold", "parametersContainsFold", "hasTome", "hasTomeWith", "hasBundle", "hasBundleWith", "hasTasks", "hasTasksWith", "hasCreator", "hasCreatorWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "url", "urlNEQ", "urlIn", "urlNotIn", "urlGT", "urlGTE", "urlLT", "urlLTE", "urlContains", "urlHasPrefix", "urlHasSuffix", "urlEqualFold", "urlContainsFold", "publicKey", "publicKeyNEQ", "publicKeyIn", "publicKeyNotIn", "publicKeyGT", "publicKeyGTE", "publicKeyLT", "publicKeyLTE", "publicKeyContains", "publicKeyHasPrefix", "publicKeyHasSuffix", "publicKeyEqualFold", "publicKeyContainsFold", "hasTomes", "hasTomesWith", "hasOwner", "hasOwnerWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -12879,7 +14340,7 @@ func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, o var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOQuestWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInput(ctx, v) + data, err := ec.unmarshalORepositoryWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInput(ctx, v) if err != nil { return it, err } @@ -12888,7 +14349,7 @@ func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, o var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOQuestWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInputᚄ(ctx, v) + data, err := ec.unmarshalORepositoryWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -12897,7 +14358,7 @@ func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, o var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOQuestWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐQuestWhereInputᚄ(ctx, v) + data, err := ec.unmarshalORepositoryWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -13118,330 +14579,276 @@ func (ec *executionContext) unmarshalInputQuestWhereInput(ctx context.Context, o return it, err } it.LastModifiedAtLTE = data - case "name": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "nameNEQ": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameNEQ = data - case "nameIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NameIn = data - case "nameNotIn": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.NameNotIn = data - case "nameGT": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameGT = data - case "nameGTE": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.NameGTE = data - case "nameLT": + case "url": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLT = data - case "nameLTE": + it.URL = data + case "urlNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameLTE = data - case "nameContains": + it.URLNEQ = data + case "urlIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameContains = data - case "nameHasPrefix": + it.URLIn = data + case "urlNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.NameHasPrefix = data - case "nameHasSuffix": + it.URLNotIn = data + case "urlGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameHasSuffix = data - case "nameEqualFold": + it.URLGT = data + case "urlGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameEqualFold = data - case "nameContainsFold": + it.URLGTE = data + case "urlLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.NameContainsFold = data - case "parameters": + it.URLLT = data + case "urlLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Parameters = data - case "parametersNEQ": + it.URLLTE = data + case "urlContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNEQ")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersNEQ = data - case "parametersIn": + it.URLContains = data + case "urlHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersIn = data - case "parametersNotIn": + it.URLHasPrefix = data + case "urlHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersNotIn = data - case "parametersGT": + it.URLHasSuffix = data + case "urlEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersGT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersGT = data - case "parametersGTE": + it.URLEqualFold = data + case "urlContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersGTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("urlContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersGTE = data - case "parametersLT": + it.URLContainsFold = data + case "publicKey": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersLT")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKey")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersLT = data - case "parametersLTE": + it.PublicKey = data + case "publicKeyNEQ": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersLTE")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersLTE = data - case "parametersContains": + it.PublicKeyNEQ = data + case "publicKeyIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ParametersContains = data - case "parametersHasPrefix": + it.PublicKeyIn = data + case "publicKeyNotIn": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.ParametersHasPrefix = data - case "parametersHasSuffix": + it.PublicKeyNotIn = data + case "publicKeyGT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersHasSuffix")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersHasSuffix = data - case "parametersIsNil": + it.PublicKeyGT = data + case "publicKeyGTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersIsNil = data - case "parametersNotNil": + it.PublicKeyGTE = data + case "publicKeyLT": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersNotNil = data - case "parametersEqualFold": + it.PublicKeyLT = data + case "publicKeyLTE": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersEqualFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersEqualFold = data - case "parametersContainsFold": + it.PublicKeyLTE = data + case "publicKeyContains": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parametersContainsFold")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.ParametersContainsFold = data - case "hasTome": + it.PublicKeyContains = data + case "publicKeyHasPrefix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTome")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTome = data - case "hasTomeWith": + it.PublicKeyHasPrefix = data + case "publicKeyHasSuffix": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomeWith")) - data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasTomeWith = data - case "hasBundle": + it.PublicKeyHasSuffix = data + case "publicKeyEqualFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBundle")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasBundle = data - case "hasBundleWith": + it.PublicKeyEqualFold = data + case "publicKeyContainsFold": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasBundleWith")) - data, err := ec.unmarshalOFileWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐFileWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicKeyContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.HasBundleWith = data - case "hasTasks": + it.PublicKeyContainsFold = data + case "hasTomes": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasks")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomes")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasTasks = data - case "hasTasksWith": + it.HasTomes = data + case "hasTomesWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTasksWith")) - data, err := ec.unmarshalOTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTaskWhereInputᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTomesWith")) + data, err := ec.unmarshalOTomeWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasTasksWith = data - case "hasCreator": + it.HasTomesWith = data + case "hasOwner": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreator")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwner")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasCreator = data - case "hasCreatorWith": + it.HasOwner = data + case "hasOwnerWith": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreatorWith")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasOwnerWith")) data, err := ec.unmarshalOUserWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasCreatorWith = data + it.HasOwnerWith = data } } @@ -14836,7 +16243,7 @@ func (ec *executionContext) unmarshalInputTomeWhereInput(ctx context.Context, ob asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "author", "authorNEQ", "authorIn", "authorNotIn", "authorGT", "authorGTE", "authorLT", "authorLTE", "authorContains", "authorHasPrefix", "authorHasSuffix", "authorEqualFold", "authorContainsFold", "supportModel", "supportModelNEQ", "supportModelIn", "supportModelNotIn", "tactic", "tacticNEQ", "tacticIn", "tacticNotIn", "paramDefs", "paramDefsNEQ", "paramDefsIn", "paramDefsNotIn", "paramDefsGT", "paramDefsGTE", "paramDefsLT", "paramDefsLTE", "paramDefsContains", "paramDefsHasPrefix", "paramDefsHasSuffix", "paramDefsIsNil", "paramDefsNotNil", "paramDefsEqualFold", "paramDefsContainsFold", "eldritch", "eldritchNEQ", "eldritchIn", "eldritchNotIn", "eldritchGT", "eldritchGTE", "eldritchLT", "eldritchLTE", "eldritchContains", "eldritchHasPrefix", "eldritchHasSuffix", "eldritchEqualFold", "eldritchContainsFold", "hasFiles", "hasFilesWith", "hasUploader", "hasUploaderWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "author", "authorNEQ", "authorIn", "authorNotIn", "authorGT", "authorGTE", "authorLT", "authorLTE", "authorContains", "authorHasPrefix", "authorHasSuffix", "authorEqualFold", "authorContainsFold", "supportModel", "supportModelNEQ", "supportModelIn", "supportModelNotIn", "tactic", "tacticNEQ", "tacticIn", "tacticNotIn", "paramDefs", "paramDefsNEQ", "paramDefsIn", "paramDefsNotIn", "paramDefsGT", "paramDefsGTE", "paramDefsLT", "paramDefsLTE", "paramDefsContains", "paramDefsHasPrefix", "paramDefsHasSuffix", "paramDefsIsNil", "paramDefsNotNil", "paramDefsEqualFold", "paramDefsContainsFold", "eldritch", "eldritchNEQ", "eldritchIn", "eldritchNotIn", "eldritchGT", "eldritchGTE", "eldritchLT", "eldritchLTE", "eldritchContains", "eldritchHasPrefix", "eldritchHasSuffix", "eldritchEqualFold", "eldritchContainsFold", "hasFiles", "hasFilesWith", "hasUploader", "hasUploaderWith", "hasRepository", "hasRepositoryWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -15797,6 +17204,24 @@ func (ec *executionContext) unmarshalInputTomeWhereInput(ctx context.Context, ob return it, err } it.HasUploaderWith = data + case "hasRepository": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasRepository")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasRepository = data + case "hasRepositoryWith": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasRepositoryWith")) + data, err := ec.unmarshalORepositoryWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasRepositoryWith = data } } @@ -16749,6 +18174,11 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._Quest(ctx, sel, obj) + case *ent.Repository: + if obj == nil { + return graphql.Null + } + return ec._Repository(ctx, sel, obj) case *ent.Tag: if obj == nil { return graphql.Null @@ -17843,6 +19273,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "repositories": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_repositories(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "beacons": field := field @@ -18107,9 +19559,134 @@ func (ec *executionContext) _Quest(ctx context.Context, sel ast.SelectionSet, ob out.Values[i] = graphql.Null continue } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "tasks": + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "tasks": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Quest_tasks(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "creator": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Quest_creator(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 repositoryImplementors = []string{"Repository", "Node"} + +func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *ent.Repository) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, repositoryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Repository") + case "id": + out.Values[i] = ec._Repository_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdAt": + out.Values[i] = ec._Repository_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastModifiedAt": + out.Values[i] = ec._Repository_lastModifiedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "url": + out.Values[i] = ec._Repository_url(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "publicKey": + out.Values[i] = ec._Repository_publicKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "tomes": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -18118,7 +19695,7 @@ func (ec *executionContext) _Quest(ctx context.Context, sel ast.SelectionSet, ob ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Quest_tasks(ctx, field, obj) + res = ec._Repository_tomes(ctx, field, obj) return res } @@ -18142,7 +19719,7 @@ func (ec *executionContext) _Quest(ctx context.Context, sel ast.SelectionSet, ob } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "creator": + case "owner": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -18151,7 +19728,7 @@ func (ec *executionContext) _Quest(ctx context.Context, sel ast.SelectionSet, ob ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Quest_creator(ctx, field, obj) + res = ec._Repository_owner(ctx, field, obj) return res } @@ -18198,6 +19775,93 @@ func (ec *executionContext) _Quest(ctx context.Context, sel ast.SelectionSet, ob return out } +var repositoryConnectionImplementors = []string{"RepositoryConnection"} + +func (ec *executionContext) _RepositoryConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.RepositoryConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, repositoryConnectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("RepositoryConnection") + case "edges": + out.Values[i] = ec._RepositoryConnection_edges(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._RepositoryConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._RepositoryConnection_totalCount(ctx, field, obj) + 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 repositoryEdgeImplementors = []string{"RepositoryEdge"} + +func (ec *executionContext) _RepositoryEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.RepositoryEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, repositoryEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("RepositoryEdge") + case "node": + out.Values[i] = ec._RepositoryEdge_node(ctx, field, obj) + case "cursor": + out.Values[i] = ec._RepositoryEdge_cursor(ctx, field, obj) + 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 tagImplementors = []string{"Tag", "Node"} func (ec *executionContext) _Tag(ctx context.Context, sel ast.SelectionSet, obj *ent.Tag) graphql.Marshaler { @@ -18725,6 +20389,39 @@ func (ec *executionContext) _Tome(ctx context.Context, sel ast.SelectionSet, obj continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "repository": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Tome_repository(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) @@ -18929,6 +20626,11 @@ func (ec *executionContext) unmarshalNCreateQuestInput2realmᚗpubᚋtavernᚋin return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNCreateRepositoryInput2realmᚗpubᚋtavernᚋinternalᚋentᚐCreateRepositoryInput(ctx context.Context, v interface{}) (ent.CreateRepositoryInput, error) { + res, err := ec.unmarshalInputCreateRepositoryInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNCreateTagInput2realmᚗpubᚋtavernᚋinternalᚋentᚐCreateTagInput(ctx context.Context, v interface{}) (ent.CreateTagInput, error) { res, err := ec.unmarshalInputCreateTagInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -19353,6 +21055,60 @@ func (ec *executionContext) unmarshalNQuestWhereInput2ᚖrealmᚗpubᚋtavernᚋ return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNRepository2realmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx context.Context, sel ast.SelectionSet, v ent.Repository) graphql.Marshaler { + return ec._Repository(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx context.Context, sel ast.SelectionSet, v *ent.Repository) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Repository(ctx, sel, v) +} + +func (ec *executionContext) marshalNRepositoryConnection2realmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryConnection(ctx context.Context, sel ast.SelectionSet, v ent.RepositoryConnection) graphql.Marshaler { + return ec._RepositoryConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRepositoryConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryConnection(ctx context.Context, sel ast.SelectionSet, v *ent.RepositoryConnection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._RepositoryConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNRepositoryOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrder(ctx context.Context, v interface{}) (*ent.RepositoryOrder, error) { + res, err := ec.unmarshalInputRepositoryOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNRepositoryOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrderField(ctx context.Context, v interface{}) (*ent.RepositoryOrderField, error) { + var res = new(ent.RepositoryOrderField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNRepositoryOrderField2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.RepositoryOrderField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalNRepositoryWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInput(ctx context.Context, v interface{}) (*ent.RepositoryWhereInput, error) { + res, err := ec.unmarshalInputRepositoryWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNTag2realmᚗpubᚋtavernᚋinternalᚋentᚐTag(ctx context.Context, sel ast.SelectionSet, v ent.Tag) graphql.Marshaler { return ec._Tag(ctx, sel, &v) } @@ -20443,6 +22199,109 @@ func (ec *executionContext) unmarshalOQuestWhereInput2ᚖrealmᚗpubᚋtavernᚋ return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalORepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx context.Context, sel ast.SelectionSet, v *ent.Repository) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Repository(ctx, sel, v) +} + +func (ec *executionContext) marshalORepositoryEdge2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.RepositoryEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalORepositoryEdge2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalORepositoryEdge2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryEdge(ctx context.Context, sel ast.SelectionSet, v *ent.RepositoryEdge) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._RepositoryEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalORepositoryOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrderᚄ(ctx context.Context, v interface{}) ([]*ent.RepositoryOrder, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*ent.RepositoryOrder, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNRepositoryOrder2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryOrder(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalORepositoryWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.RepositoryWhereInput, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*ent.RepositoryWhereInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNRepositoryWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalORepositoryWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepositoryWhereInput(ctx context.Context, v interface{}) (*ent.RepositoryWhereInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputRepositoryWhereInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOTag2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTagᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Tag) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/tavern/internal/graphql/generated/inputs.generated.go b/tavern/internal/graphql/generated/inputs.generated.go index 3e3f82c52..434e0da1d 100644 --- a/tavern/internal/graphql/generated/inputs.generated.go +++ b/tavern/internal/graphql/generated/inputs.generated.go @@ -110,29 +110,20 @@ func (ec *executionContext) unmarshalInputClaimTasksInput(ctx context.Context, o return it, nil } -func (ec *executionContext) unmarshalInputImportTomesFromGitInput(ctx context.Context, obj interface{}) (models.ImportTomesFromGitInput, error) { - var it models.ImportTomesFromGitInput +func (ec *executionContext) unmarshalInputImportRepositoryInput(ctx context.Context, obj interface{}) (models.ImportRepositoryInput, error) { + var it models.ImportRepositoryInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"gitURL", "includeDirs"} + fieldsInOrder := [...]string{"includeDirs"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "gitURL": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitURL")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.GitURL = data case "includeDirs": var err error @@ -225,9 +216,12 @@ func (ec *executionContext) unmarshalInputSubmitTaskResultInput(ctx context.Cont // region ***************************** type.gotpl ***************************** -func (ec *executionContext) unmarshalNImportTomesFromGitInput2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐImportTomesFromGitInput(ctx context.Context, v interface{}) (models.ImportTomesFromGitInput, error) { - res, err := ec.unmarshalInputImportTomesFromGitInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) +func (ec *executionContext) unmarshalOImportRepositoryInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐImportRepositoryInput(ctx context.Context, v interface{}) (*models.ImportRepositoryInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputImportRepositoryInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) } // endregion ***************************** type.gotpl ***************************** diff --git a/tavern/internal/graphql/generated/mutation.generated.go b/tavern/internal/graphql/generated/mutation.generated.go index c283a1656..f552afcd4 100644 --- a/tavern/internal/graphql/generated/mutation.generated.go +++ b/tavern/internal/graphql/generated/mutation.generated.go @@ -24,10 +24,11 @@ type MutationResolver interface { UpdateHost(ctx context.Context, hostID int, input ent.UpdateHostInput) (*ent.Host, error) CreateTag(ctx context.Context, input ent.CreateTagInput) (*ent.Tag, error) UpdateTag(ctx context.Context, tagID int, input ent.UpdateTagInput) (*ent.Tag, error) - ImportTomesFromGit(ctx context.Context, input models.ImportTomesFromGitInput) ([]*ent.Tome, error) CreateTome(ctx context.Context, input ent.CreateTomeInput) (*ent.Tome, error) UpdateTome(ctx context.Context, tomeID int, input ent.UpdateTomeInput) (*ent.Tome, error) DeleteTome(ctx context.Context, tomeID int) (int, error) + CreateRepository(ctx context.Context, input ent.CreateRepositoryInput) (*ent.Repository, error) + ImportRepository(ctx context.Context, repoID int, input *models.ImportRepositoryInput) (*ent.Repository, error) UpdateUser(ctx context.Context, userID int, input ent.UpdateUserInput) (*ent.User, error) } @@ -59,6 +60,21 @@ func (ec *executionContext) field_Mutation_createQuest_args(ctx context.Context, return args, nil } +func (ec *executionContext) field_Mutation_createRepository_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 ent.CreateRepositoryInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNCreateRepositoryInput2realmᚗpubᚋtavernᚋinternalᚋentᚐCreateRepositoryInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createTag_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -104,18 +120,27 @@ func (ec *executionContext) field_Mutation_deleteTome_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Mutation_importTomesFromGit_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_importRepository_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 models.ImportTomesFromGitInput + var arg0 int + if tmp, ok := rawArgs["repoID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("repoID")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["repoID"] = arg0 + var arg1 *models.ImportRepositoryInput if tmp, ok := rawArgs["input"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNImportTomesFromGitInput2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐImportTomesFromGitInput(ctx, tmp) + arg1, err = ec.unmarshalOImportRepositoryInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐImportRepositoryInput(ctx, tmp) if err != nil { return nil, err } } - args["input"] = arg0 + args["input"] = arg1 return args, nil } @@ -799,8 +824,8 @@ func (ec *executionContext) fieldContext_Mutation_updateTag(ctx context.Context, return fc, nil } -func (ec *executionContext) _Mutation_importTomesFromGit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_importTomesFromGit(ctx, field) +func (ec *executionContext) _Mutation_createTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTome(ctx, field) if err != nil { return graphql.Null } @@ -814,7 +839,7 @@ func (ec *executionContext) _Mutation_importTomesFromGit(ctx context.Context, fi resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().ImportTomesFromGit(rctx, fc.Args["input"].(models.ImportTomesFromGitInput)) + return ec.resolvers.Mutation().CreateTome(rctx, fc.Args["input"].(ent.CreateTomeInput)) } directive1 := func(ctx context.Context) (interface{}, error) { role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") @@ -834,24 +859,27 @@ func (ec *executionContext) _Mutation_importTomesFromGit(ctx context.Context, fi if tmp == nil { return nil, nil } - if data, ok := tmp.([]*ent.Tome); ok { + if data, ok := tmp.(*ent.Tome); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be []*realm.pub/tavern/internal/ent.Tome`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be *realm.pub/tavern/internal/ent.Tome`, tmp) }) 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.([]*ent.Tome) + res := resTmp.(*ent.Tome) fc.Result = res - return ec.marshalOTome2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTomeᚄ(ctx, field.Selections, res) + return ec.marshalNTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_importTomesFromGit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_createTome(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -883,6 +911,8 @@ func (ec *executionContext) fieldContext_Mutation_importTomesFromGit(ctx context return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, @@ -894,15 +924,15 @@ func (ec *executionContext) fieldContext_Mutation_importTomesFromGit(ctx context } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_importTomesFromGit_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_createTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_createTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createTome(ctx, field) +func (ec *executionContext) _Mutation_updateTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateTome(ctx, field) if err != nil { return graphql.Null } @@ -916,10 +946,10 @@ func (ec *executionContext) _Mutation_createTome(ctx context.Context, field grap resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateTome(rctx, fc.Args["input"].(ent.CreateTomeInput)) + return ec.resolvers.Mutation().UpdateTome(rctx, fc.Args["tomeID"].(int), fc.Args["input"].(ent.UpdateTomeInput)) } directive1 := func(ctx context.Context) (interface{}, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") if err != nil { return nil, err } @@ -956,7 +986,7 @@ func (ec *executionContext) _Mutation_createTome(ctx context.Context, field grap return ec.marshalNTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createTome(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_updateTome(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -988,6 +1018,8 @@ func (ec *executionContext) fieldContext_Mutation_createTome(ctx context.Context return ec.fieldContext_Tome_files(ctx, field) case "uploader": return ec.fieldContext_Tome_uploader(ctx, field) + case "repository": + return ec.fieldContext_Tome_repository(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) }, @@ -999,15 +1031,15 @@ func (ec *executionContext) fieldContext_Mutation_createTome(ctx context.Context } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_updateTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_updateTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateTome(ctx, field) +func (ec *executionContext) _Mutation_deleteTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteTome(ctx, field) if err != nil { return graphql.Null } @@ -1021,7 +1053,7 @@ func (ec *executionContext) _Mutation_updateTome(ctx context.Context, field grap resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateTome(rctx, fc.Args["tomeID"].(int), fc.Args["input"].(ent.UpdateTomeInput)) + return ec.resolvers.Mutation().DeleteTome(rctx, fc.Args["tomeID"].(int)) } directive1 := func(ctx context.Context) (interface{}, error) { role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") @@ -1041,10 +1073,10 @@ func (ec *executionContext) _Mutation_updateTome(ctx context.Context, field grap if tmp == nil { return nil, nil } - if data, ok := tmp.(*ent.Tome); ok { + if data, ok := tmp.(int); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *realm.pub/tavern/internal/ent.Tome`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be int`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -1056,12 +1088,91 @@ func (ec *executionContext) _Mutation_updateTome(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*ent.Tome) + res := resTmp.(int) fc.Result = res - return ec.marshalNTome2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐTome(ctx, field.Selections, res) + return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_updateTome(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_deleteTome(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 ID 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_deleteTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRepository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRepository(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) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRepository(rctx, fc.Args["input"].(ent.CreateRepositoryInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") + if err != nil { + return nil, err + } + if ec.directives.RequireRole == nil { + return nil, errors.New("directive requireRole is not implemented") + } + return ec.directives.RequireRole(ctx, nil, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*ent.Repository); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *realm.pub/tavern/internal/ent.Repository`, tmp) + }) + 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.(*ent.Repository) + fc.Result = res + return ec.marshalNRepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRepository(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -1070,31 +1181,21 @@ func (ec *executionContext) fieldContext_Mutation_updateTome(ctx context.Context Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Tome_id(ctx, field) + return ec.fieldContext_Repository_id(ctx, field) case "createdAt": - return ec.fieldContext_Tome_createdAt(ctx, field) + return ec.fieldContext_Repository_createdAt(ctx, field) case "lastModifiedAt": - return ec.fieldContext_Tome_lastModifiedAt(ctx, field) - case "name": - return ec.fieldContext_Tome_name(ctx, field) - case "description": - return ec.fieldContext_Tome_description(ctx, field) - case "author": - return ec.fieldContext_Tome_author(ctx, field) - case "supportModel": - return ec.fieldContext_Tome_supportModel(ctx, field) - case "tactic": - return ec.fieldContext_Tome_tactic(ctx, field) - case "paramDefs": - return ec.fieldContext_Tome_paramDefs(ctx, field) - case "eldritch": - return ec.fieldContext_Tome_eldritch(ctx, field) - case "files": - return ec.fieldContext_Tome_files(ctx, field) - case "uploader": - return ec.fieldContext_Tome_uploader(ctx, field) + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Tome", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) }, } defer func() { @@ -1104,15 +1205,15 @@ func (ec *executionContext) fieldContext_Mutation_updateTome(ctx context.Context } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_updateTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_createRepository_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_deleteTome(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteTome(ctx, field) +func (ec *executionContext) _Mutation_importRepository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_importRepository(ctx, field) if err != nil { return graphql.Null } @@ -1126,10 +1227,10 @@ func (ec *executionContext) _Mutation_deleteTome(ctx context.Context, field grap resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteTome(rctx, fc.Args["tomeID"].(int)) + return ec.resolvers.Mutation().ImportRepository(rctx, fc.Args["repoID"].(int), fc.Args["input"].(*models.ImportRepositoryInput)) } directive1 := func(ctx context.Context) (interface{}, error) { - role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "ADMIN") + role, err := ec.unmarshalNRole2realmᚗpubᚋtavernᚋinternalᚋgraphqlᚋmodelsᚐRole(ctx, "USER") if err != nil { return nil, err } @@ -1146,10 +1247,10 @@ func (ec *executionContext) _Mutation_deleteTome(ctx context.Context, field grap if tmp == nil { return nil, nil } - if data, ok := tmp.(int); ok { + if data, ok := tmp.(*ent.Repository); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be int`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be *realm.pub/tavern/internal/ent.Repository`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -1161,19 +1262,35 @@ func (ec *executionContext) _Mutation_deleteTome(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(int) + res := resTmp.(*ent.Repository) fc.Result = res - return ec.marshalNID2int(ctx, field.Selections, res) + return ec.marshalNRepository2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐRepository(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteTome(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_importRepository(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 ID does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Repository_id(ctx, field) + case "createdAt": + return ec.fieldContext_Repository_createdAt(ctx, field) + case "lastModifiedAt": + return ec.fieldContext_Repository_lastModifiedAt(ctx, field) + case "url": + return ec.fieldContext_Repository_url(ctx, field) + case "publicKey": + return ec.fieldContext_Repository_publicKey(ctx, field) + case "tomes": + return ec.fieldContext_Repository_tomes(ctx, field) + case "owner": + return ec.fieldContext_Repository_owner(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Repository", field.Name) }, } defer func() { @@ -1183,7 +1300,7 @@ func (ec *executionContext) fieldContext_Mutation_deleteTome(ctx context.Context } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteTome_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_importRepository_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } @@ -1350,10 +1467,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } - case "importTomesFromGit": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_importTomesFromGit(ctx, field) - }) case "createTome": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_createTome(ctx, field) @@ -1375,6 +1488,20 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "createRepository": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRepository(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "importRepository": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_importRepository(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "updateUser": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updateUser(ctx, field) diff --git a/tavern/internal/graphql/generated/root_.generated.go b/tavern/internal/graphql/generated/root_.generated.go index 64b917be0..6bdb27e5a 100644 --- a/tavern/internal/graphql/generated/root_.generated.go +++ b/tavern/internal/graphql/generated/root_.generated.go @@ -127,17 +127,18 @@ type ComplexityRoot struct { } Mutation struct { - CreateQuest func(childComplexity int, beaconIDs []int, input ent.CreateQuestInput) int - CreateTag func(childComplexity int, input ent.CreateTagInput) int - CreateTome func(childComplexity int, input ent.CreateTomeInput) int - DeleteTome func(childComplexity int, tomeID int) int - DropAllData func(childComplexity int) int - ImportTomesFromGit func(childComplexity int, input models.ImportTomesFromGitInput) int - UpdateBeacon func(childComplexity int, beaconID int, input ent.UpdateBeaconInput) int - UpdateHost func(childComplexity int, hostID int, input ent.UpdateHostInput) int - UpdateTag func(childComplexity int, tagID int, input ent.UpdateTagInput) int - UpdateTome func(childComplexity int, tomeID int, input ent.UpdateTomeInput) int - UpdateUser func(childComplexity int, userID int, input ent.UpdateUserInput) int + CreateQuest func(childComplexity int, beaconIDs []int, input ent.CreateQuestInput) int + CreateRepository func(childComplexity int, input ent.CreateRepositoryInput) int + CreateTag func(childComplexity int, input ent.CreateTagInput) int + CreateTome func(childComplexity int, input ent.CreateTomeInput) int + DeleteTome func(childComplexity int, tomeID int) int + DropAllData func(childComplexity int) int + ImportRepository func(childComplexity int, repoID int, input *models.ImportRepositoryInput) int + UpdateBeacon func(childComplexity int, beaconID int, input ent.UpdateBeaconInput) int + UpdateHost func(childComplexity int, hostID int, input ent.UpdateHostInput) int + UpdateTag func(childComplexity int, tagID int, input ent.UpdateTagInput) int + UpdateTome func(childComplexity int, tomeID int, input ent.UpdateTomeInput) int + UpdateUser func(childComplexity int, userID int, input ent.UpdateUserInput) int } PageInfo struct { @@ -148,17 +149,18 @@ type ComplexityRoot struct { } Query struct { - Beacons func(childComplexity int, where *ent.BeaconWhereInput) int - Files func(childComplexity int, where *ent.FileWhereInput) int - Hosts func(childComplexity int, where *ent.HostWhereInput) int - Me func(childComplexity int) int - Node func(childComplexity int, id int) int - Nodes func(childComplexity int, ids []int) int - Quests func(childComplexity int, where *ent.QuestWhereInput) int - Tags func(childComplexity int, where *ent.TagWhereInput) int - Tasks func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TaskOrder, where *ent.TaskWhereInput) int - Tomes func(childComplexity int, where *ent.TomeWhereInput) int - Users func(childComplexity int, where *ent.UserWhereInput) int + Beacons func(childComplexity int, where *ent.BeaconWhereInput) int + Files func(childComplexity int, where *ent.FileWhereInput) int + Hosts func(childComplexity int, where *ent.HostWhereInput) int + Me func(childComplexity int) int + Node func(childComplexity int, id int) int + Nodes func(childComplexity int, ids []int) int + Quests func(childComplexity int, where *ent.QuestWhereInput) int + Repositories func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.RepositoryOrder, where *ent.RepositoryWhereInput) int + Tags func(childComplexity int, where *ent.TagWhereInput) int + Tasks func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TaskOrder, where *ent.TaskWhereInput) int + Tomes func(childComplexity int, where *ent.TomeWhereInput) int + Users func(childComplexity int, where *ent.UserWhereInput) int } Quest struct { @@ -173,6 +175,27 @@ type ComplexityRoot struct { Tome func(childComplexity int) int } + Repository struct { + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + LastModifiedAt func(childComplexity int) int + Owner func(childComplexity int) int + PublicKey func(childComplexity int) int + Tomes func(childComplexity int) int + URL func(childComplexity int) int + } + + RepositoryConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + RepositoryEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + Tag struct { Hosts func(childComplexity int) int ID func(childComplexity int) int @@ -218,6 +241,7 @@ type ComplexityRoot struct { LastModifiedAt func(childComplexity int) int Name func(childComplexity int) int ParamDefs func(childComplexity int) int + Repository func(childComplexity int) int SupportModel func(childComplexity int) int Tactic func(childComplexity int) int Uploader func(childComplexity int) int @@ -712,6 +736,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.CreateQuest(childComplexity, args["beaconIDs"].([]int), args["input"].(ent.CreateQuestInput)), true + case "Mutation.createRepository": + if e.complexity.Mutation.CreateRepository == nil { + break + } + + args, err := ec.field_Mutation_createRepository_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRepository(childComplexity, args["input"].(ent.CreateRepositoryInput)), true + case "Mutation.createTag": if e.complexity.Mutation.CreateTag == nil { break @@ -755,17 +791,17 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.DropAllData(childComplexity), true - case "Mutation.importTomesFromGit": - if e.complexity.Mutation.ImportTomesFromGit == nil { + case "Mutation.importRepository": + if e.complexity.Mutation.ImportRepository == nil { break } - args, err := ec.field_Mutation_importTomesFromGit_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_importRepository_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Mutation.ImportTomesFromGit(childComplexity, args["input"].(models.ImportTomesFromGitInput)), true + return e.complexity.Mutation.ImportRepository(childComplexity, args["repoID"].(int), args["input"].(*models.ImportRepositoryInput)), true case "Mutation.updateBeacon": if e.complexity.Mutation.UpdateBeacon == nil { @@ -934,6 +970,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Quests(childComplexity, args["where"].(*ent.QuestWhereInput)), true + case "Query.repositories": + if e.complexity.Query.Repositories == nil { + break + } + + args, err := ec.field_Query_repositories_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Repositories(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.RepositoryOrder), args["where"].(*ent.RepositoryWhereInput)), true + case "Query.tags": if e.complexity.Query.Tags == nil { break @@ -1045,6 +1093,90 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Quest.Tome(childComplexity), true + case "Repository.createdAt": + if e.complexity.Repository.CreatedAt == nil { + break + } + + return e.complexity.Repository.CreatedAt(childComplexity), true + + case "Repository.id": + if e.complexity.Repository.ID == nil { + break + } + + return e.complexity.Repository.ID(childComplexity), true + + case "Repository.lastModifiedAt": + if e.complexity.Repository.LastModifiedAt == nil { + break + } + + return e.complexity.Repository.LastModifiedAt(childComplexity), true + + case "Repository.owner": + if e.complexity.Repository.Owner == nil { + break + } + + return e.complexity.Repository.Owner(childComplexity), true + + case "Repository.publicKey": + if e.complexity.Repository.PublicKey == nil { + break + } + + return e.complexity.Repository.PublicKey(childComplexity), true + + case "Repository.tomes": + if e.complexity.Repository.Tomes == nil { + break + } + + return e.complexity.Repository.Tomes(childComplexity), true + + case "Repository.url": + if e.complexity.Repository.URL == nil { + break + } + + return e.complexity.Repository.URL(childComplexity), true + + case "RepositoryConnection.edges": + if e.complexity.RepositoryConnection.Edges == nil { + break + } + + return e.complexity.RepositoryConnection.Edges(childComplexity), true + + case "RepositoryConnection.pageInfo": + if e.complexity.RepositoryConnection.PageInfo == nil { + break + } + + return e.complexity.RepositoryConnection.PageInfo(childComplexity), true + + case "RepositoryConnection.totalCount": + if e.complexity.RepositoryConnection.TotalCount == nil { + break + } + + return e.complexity.RepositoryConnection.TotalCount(childComplexity), true + + case "RepositoryEdge.cursor": + if e.complexity.RepositoryEdge.Cursor == nil { + break + } + + return e.complexity.RepositoryEdge.Cursor(childComplexity), true + + case "RepositoryEdge.node": + if e.complexity.RepositoryEdge.Node == nil { + break + } + + return e.complexity.RepositoryEdge.Node(childComplexity), true + case "Tag.hosts": if e.complexity.Tag.Hosts == nil { break @@ -1269,6 +1401,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Tome.ParamDefs(childComplexity), true + case "Tome.repository": + if e.complexity.Tome.Repository == nil { + break + } + + return e.complexity.Tome.Repository(childComplexity), true + case "Tome.supportModel": if e.complexity.Tome.SupportModel == nil { break @@ -1344,6 +1483,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputBeaconWhereInput, ec.unmarshalInputClaimTasksInput, ec.unmarshalInputCreateQuestInput, + ec.unmarshalInputCreateRepositoryInput, ec.unmarshalInputCreateTagInput, ec.unmarshalInputCreateTomeInput, ec.unmarshalInputFileOrder, @@ -1356,9 +1496,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputHostProcessOrder, ec.unmarshalInputHostProcessWhereInput, ec.unmarshalInputHostWhereInput, - ec.unmarshalInputImportTomesFromGitInput, + ec.unmarshalInputImportRepositoryInput, ec.unmarshalInputQuestOrder, ec.unmarshalInputQuestWhereInput, + ec.unmarshalInputRepositoryOrder, + ec.unmarshalInputRepositoryWhereInput, ec.unmarshalInputSubmitTaskResultInput, ec.unmarshalInputTagOrder, ec.unmarshalInputTagWhereInput, @@ -1650,6 +1792,14 @@ input CreateQuestInput { tomeID: ID! } """ +CreateRepositoryInput is used for create Repository object. +Input was generated by ent. +""" +input CreateRepositoryInput { + """URL of the repository""" + url: String! +} +""" CreateTagInput is used for create Tag object. Input was generated by ent. """ @@ -2597,6 +2747,119 @@ input QuestWhereInput { hasCreator: Boolean hasCreatorWith: [UserWhereInput!] } +type Repository implements Node { + id: ID! + """Timestamp of when this ent was created""" + createdAt: Time! + """Timestamp of when this ent was last updated""" + lastModifiedAt: Time! + """URL of the repository""" + url: String! + """Public key associated with this repositories private key""" + publicKey: String! + """Tomes imported using this repository.""" + tomes: [Tome!] + """User that created this repository.""" + owner: User +} +"""A connection to a list of items.""" +type RepositoryConnection { + """A list of edges.""" + edges: [RepositoryEdge] + """Information to aid in pagination.""" + pageInfo: PageInfo! + """Identifies the total count of items in the connection.""" + totalCount: Int! +} +"""An edge in a connection.""" +type RepositoryEdge { + """The item at the end of the edge.""" + node: Repository + """A cursor for use in pagination.""" + cursor: Cursor! +} +"""Ordering options for Repository connections""" +input RepositoryOrder { + """The ordering direction.""" + direction: OrderDirection! = ASC + """The field by which to order Repositories.""" + field: RepositoryOrderField! +} +"""Properties by which Repository connections can be ordered.""" +enum RepositoryOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +RepositoryWhereInput is used for filtering Repository objects. +Input was generated by ent. +""" +input RepositoryWhereInput { + not: RepositoryWhereInput + and: [RepositoryWhereInput!] + or: [RepositoryWhereInput!] + """id field predicates""" + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """created_at field predicates""" + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """last_modified_at field predicates""" + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """url field predicates""" + url: String + urlNEQ: String + urlIn: [String!] + urlNotIn: [String!] + urlGT: String + urlGTE: String + urlLT: String + urlLTE: String + urlContains: String + urlHasPrefix: String + urlHasSuffix: String + urlEqualFold: String + urlContainsFold: String + """public_key field predicates""" + publicKey: String + publicKeyNEQ: String + publicKeyIn: [String!] + publicKeyNotIn: [String!] + publicKeyGT: String + publicKeyGTE: String + publicKeyLT: String + publicKeyLTE: String + publicKeyContains: String + publicKeyHasPrefix: String + publicKeyHasSuffix: String + publicKeyEqualFold: String + publicKeyContainsFold: String + """tomes edge predicates""" + hasTomes: Boolean + hasTomesWith: [TomeWhereInput!] + """owner edge predicates""" + hasOwner: Boolean + hasOwnerWith: [UserWhereInput!] +} type Tag implements Node { id: ID! """Name of the tag""" @@ -2869,6 +3132,8 @@ type Tome implements Node { files: [File!] """User who uploaded the tome (may be null).""" uploader: User + """Repository from which this Tome was imported (may be null).""" + repository: Repository } """Ordering options for Tome connections""" input TomeOrder { @@ -3030,6 +3295,9 @@ input TomeWhereInput { """uploader edge predicates""" hasUploader: Boolean hasUploaderWith: [UserWhereInput!] + """repository edge predicates""" + hasRepository: Boolean + hasRepositoryWith: [RepositoryWhereInput!] } """ UpdateBeaconInput is used for update Beacon object. @@ -3216,6 +3484,25 @@ scalar Uint64 """Filtering options for Tasks returned from the connection.""" where: TaskWhereInput ): TaskConnection! @requireRole(role: USER) + repositories( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Repositories returned from the connection.""" + orderBy: [RepositoryOrder!] + + """Filtering options for Repositories returned from the connection.""" + where: RepositoryWhereInput + ): RepositoryConnection! @requireRole(role: USER) beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER) hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER) tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER) @@ -3254,11 +3541,16 @@ scalar Uint64 ### # Tome ### - importTomesFromGit(input: ImportTomesFromGitInput!,): [Tome!] @requireRole(role: USER) createTome(input: CreateTomeInput!,): Tome! @requireRole(role: USER) updateTome(tomeID: ID!, input: UpdateTomeInput!,): Tome! @requireRole(role: ADMIN) deleteTome(tomeID: ID!): ID! @requireRole(role: ADMIN) + ### + # Repository + ### + createRepository(input: CreateRepositoryInput!): Repository! @requireRole(role: USER) + importRepository(repoID: ID!, input: ImportRepositoryInput): Repository! @requireRole(role: USER) + ### # User ### @@ -3307,10 +3599,7 @@ input SubmitTaskResultInput { """Error message captured as the result of task execution failure.""" error: String } -input ImportTomesFromGitInput { - """Specify a git URL to obtain the tomes from.""" - gitURL: String! - +input ImportRepositoryInput { """ Optionally, specify directories to include. Only tomes that have a main.eldritch in one of these directory prefixes will be included. diff --git a/tavern/internal/graphql/models/gqlgen_models.go b/tavern/internal/graphql/models/gqlgen_models.go index cf4eec5b9..ee179ef56 100644 --- a/tavern/internal/graphql/models/gqlgen_models.go +++ b/tavern/internal/graphql/models/gqlgen_models.go @@ -28,9 +28,7 @@ type ClaimTasksInput struct { AgentIdentifier string `json:"agentIdentifier"` } -type ImportTomesFromGitInput struct { - // Specify a git URL to obtain the tomes from. - GitURL string `json:"gitURL"` +type ImportRepositoryInput struct { // Optionally, specify directories to include. // Only tomes that have a main.eldritch in one of these directory prefixes will be included. IncludeDirs []string `json:"includeDirs,omitempty"` diff --git a/tavern/internal/graphql/mutation.resolvers.go b/tavern/internal/graphql/mutation.resolvers.go index 484bcc574..91643c245 100644 --- a/tavern/internal/graphql/mutation.resolvers.go +++ b/tavern/internal/graphql/mutation.resolvers.go @@ -14,7 +14,6 @@ import ( "realm.pub/tavern/internal/ent/file" "realm.pub/tavern/internal/graphql/generated" "realm.pub/tavern/internal/graphql/models" - "realm.pub/tavern/tomes" ) // DropAllData is the resolver for the dropAllData field. @@ -160,35 +159,6 @@ func (r *mutationResolver) UpdateTag(ctx context.Context, tagID int, input ent.U return r.client.Tag.UpdateOneID(tagID).SetInput(input).Save(ctx) } -// ImportTomesFromGit is the resolver for the importTomesFromGit field. -func (r *mutationResolver) ImportTomesFromGit(ctx context.Context, input models.ImportTomesFromGitInput) ([]*ent.Tome, error) { - // Ensure a schema is set (or set https:// by default) - gitURL := input.GitURL - if !strings.HasPrefix(gitURL, "http://") && !strings.HasPrefix(gitURL, "ssh://") { - gitURL = fmt.Sprintf("https://%s", gitURL) - } - - if input.IncludeDirs == nil { - return tomes.ImportFromRepo(ctx, r.client, input.GitURL) - } - - // Filter to only include provided directories - filter := func(path string) bool { - for _, prefix := range input.IncludeDirs { - // Ignore Leading / - path = strings.TrimPrefix(path, "/") - prefix = strings.TrimPrefix(prefix, "/") - - // Include if matching - if strings.HasPrefix(path, prefix) { - return true - } - } - return false - } - return tomes.ImportFromRepo(ctx, r.client, gitURL, filter) -} - // CreateTome is the resolver for the createTome field. func (r *mutationResolver) CreateTome(ctx context.Context, input ent.CreateTomeInput) (*ent.Tome, error) { var uploaderID *int @@ -215,6 +185,53 @@ func (r *mutationResolver) DeleteTome(ctx context.Context, tomeID int) (int, err return tomeID, nil } +// CreateRepository is the resolver for the createRepository field. +func (r *mutationResolver) CreateRepository(ctx context.Context, input ent.CreateRepositoryInput) (*ent.Repository, error) { + var ownerID *int + if owner := auth.UserFromContext(ctx); owner != nil { + ownerID = &owner.ID + } + + return r.client.Repository.Create(). + SetInput(input). + SetNillableOwnerID(ownerID). + Save(ctx) +} + +// ImportRepository is the resolver for the importRepository field. +func (r *mutationResolver) ImportRepository(ctx context.Context, repoID int, input *models.ImportRepositoryInput) (*ent.Repository, error) { + // Load Repository + repo, err := r.client.Repository.Get(ctx, repoID) + if err != nil { + return nil, err + } + + // Configure Filters + filter := func(string) bool { return true } + if input != nil && input.IncludeDirs != nil { + filter = func(path string) bool { + for _, prefix := range input.IncludeDirs { + // Ignore Leading / + path = strings.TrimPrefix(path, "/") + prefix = strings.TrimPrefix(prefix, "/") + + // Include if matching + if strings.HasPrefix(path, prefix) { + return true + } + } + return false + } + } + + // Import Tomes + if err := r.importer.Import(ctx, repo, filter); err != nil { + return nil, err + } + + return repo, nil +} + // UpdateUser is the resolver for the updateUser field. func (r *mutationResolver) UpdateUser(ctx context.Context, userID int, input ent.UpdateUserInput) (*ent.User, error) { return r.client.User.UpdateOneID(userID).SetInput(input).Save(ctx) diff --git a/tavern/internal/graphql/query.resolvers.go b/tavern/internal/graphql/query.resolvers.go index 84a7faaa4..6e64aa1a0 100644 --- a/tavern/internal/graphql/query.resolvers.go +++ b/tavern/internal/graphql/query.resolvers.go @@ -61,6 +61,22 @@ func (r *queryResolver) Tasks(ctx context.Context, after *entgql.Cursor[int], fi return query.Paginate(ctx, after, first, before, last, ent.WithTaskOrder(orderBy)) } +// Repositories is the resolver for the repositories field. +func (r *queryResolver) Repositories(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.RepositoryOrder, where *ent.RepositoryWhereInput) (*ent.RepositoryConnection, error) { + query, err := r.client.Repository.Query().CollectFields(ctx) + if err != nil { + return nil, fmt.Errorf("failed to collect fields: %w", err) + } + if where != nil { + query, err := where.Filter(query) + if err != nil { + return nil, fmt.Errorf("failed to apply filter: %w", err) + } + return query.Paginate(ctx, after, first, before, last, ent.WithRepositoryOrder(orderBy)) + } + return query.Paginate(ctx, after, first, before, last, ent.WithRepositoryOrder(orderBy)) +} + // Beacons is the resolver for the beacons field. func (r *queryResolver) Beacons(ctx context.Context, where *ent.BeaconWhereInput) ([]*ent.Beacon, error) { query, err := r.client.Beacon.Query().CollectFields(ctx) diff --git a/tavern/internal/graphql/quest_test.go b/tavern/internal/graphql/quest_test.go index 56f23ffcf..2afc0f0f6 100644 --- a/tavern/internal/graphql/quest_test.go +++ b/tavern/internal/graphql/quest_test.go @@ -18,6 +18,7 @@ import ( "realm.pub/tavern/internal/ent/enttest" "realm.pub/tavern/internal/graphql" tavernhttp "realm.pub/tavern/internal/http" + "realm.pub/tavern/tomes" ) // TestCreateQuest ensures the createQuest mutation functions as expected @@ -27,9 +28,12 @@ func TestCreateQuest(t *testing.T) { graph := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1") defer graph.Close() + // Initialize Git Importer + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( tavernhttp.RouteMap{ - "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph)), + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git)), }, tavernhttp.WithAuthenticationBypass(graph), ) diff --git a/tavern/internal/graphql/resolver.go b/tavern/internal/graphql/resolver.go index 104d94ea3..b2ae9ae21 100644 --- a/tavern/internal/graphql/resolver.go +++ b/tavern/internal/graphql/resolver.go @@ -12,13 +12,21 @@ import ( "github.com/99designs/gqlgen/graphql" ) +// A RepoImporter is responsible for importing tomes from the provided URL (filter based on provided filter options). +type RepoImporter interface { + Import(ctx context.Context, repo *ent.Repository, filters ...func(path string) bool) error +} + // Resolver is the resolver root. -type Resolver struct{ client *ent.Client } +type Resolver struct { + client *ent.Client + importer RepoImporter +} // NewSchema creates a graphql executable schema. -func NewSchema(client *ent.Client) graphql.ExecutableSchema { +func NewSchema(client *ent.Client, importer RepoImporter) graphql.ExecutableSchema { cfg := generated.Config{ - Resolvers: &Resolver{client}, + Resolvers: &Resolver{client, importer}, } cfg.Directives.RequireRole = func(ctx context.Context, obj interface{}, next graphql.Resolver, requiredRole models.Role) (interface{}, error) { // Allow unauthenticated contexts to continue for open endpoints diff --git a/tavern/internal/graphql/schema.graphql b/tavern/internal/graphql/schema.graphql index d0c11d6a0..2eabab32f 100644 --- a/tavern/internal/graphql/schema.graphql +++ b/tavern/internal/graphql/schema.graphql @@ -178,6 +178,14 @@ input CreateQuestInput { tomeID: ID! } """ +CreateRepositoryInput is used for create Repository object. +Input was generated by ent. +""" +input CreateRepositoryInput { + """URL of the repository""" + url: String! +} +""" CreateTagInput is used for create Tag object. Input was generated by ent. """ @@ -1125,6 +1133,119 @@ input QuestWhereInput { hasCreator: Boolean hasCreatorWith: [UserWhereInput!] } +type Repository implements Node { + id: ID! + """Timestamp of when this ent was created""" + createdAt: Time! + """Timestamp of when this ent was last updated""" + lastModifiedAt: Time! + """URL of the repository""" + url: String! + """Public key associated with this repositories private key""" + publicKey: String! + """Tomes imported using this repository.""" + tomes: [Tome!] + """User that created this repository.""" + owner: User +} +"""A connection to a list of items.""" +type RepositoryConnection { + """A list of edges.""" + edges: [RepositoryEdge] + """Information to aid in pagination.""" + pageInfo: PageInfo! + """Identifies the total count of items in the connection.""" + totalCount: Int! +} +"""An edge in a connection.""" +type RepositoryEdge { + """The item at the end of the edge.""" + node: Repository + """A cursor for use in pagination.""" + cursor: Cursor! +} +"""Ordering options for Repository connections""" +input RepositoryOrder { + """The ordering direction.""" + direction: OrderDirection! = ASC + """The field by which to order Repositories.""" + field: RepositoryOrderField! +} +"""Properties by which Repository connections can be ordered.""" +enum RepositoryOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +RepositoryWhereInput is used for filtering Repository objects. +Input was generated by ent. +""" +input RepositoryWhereInput { + not: RepositoryWhereInput + and: [RepositoryWhereInput!] + or: [RepositoryWhereInput!] + """id field predicates""" + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """created_at field predicates""" + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """last_modified_at field predicates""" + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """url field predicates""" + url: String + urlNEQ: String + urlIn: [String!] + urlNotIn: [String!] + urlGT: String + urlGTE: String + urlLT: String + urlLTE: String + urlContains: String + urlHasPrefix: String + urlHasSuffix: String + urlEqualFold: String + urlContainsFold: String + """public_key field predicates""" + publicKey: String + publicKeyNEQ: String + publicKeyIn: [String!] + publicKeyNotIn: [String!] + publicKeyGT: String + publicKeyGTE: String + publicKeyLT: String + publicKeyLTE: String + publicKeyContains: String + publicKeyHasPrefix: String + publicKeyHasSuffix: String + publicKeyEqualFold: String + publicKeyContainsFold: String + """tomes edge predicates""" + hasTomes: Boolean + hasTomesWith: [TomeWhereInput!] + """owner edge predicates""" + hasOwner: Boolean + hasOwnerWith: [UserWhereInput!] +} type Tag implements Node { id: ID! """Name of the tag""" @@ -1397,6 +1518,8 @@ type Tome implements Node { files: [File!] """User who uploaded the tome (may be null).""" uploader: User + """Repository from which this Tome was imported (may be null).""" + repository: Repository } """Ordering options for Tome connections""" input TomeOrder { @@ -1558,6 +1681,9 @@ input TomeWhereInput { """uploader edge predicates""" hasUploader: Boolean hasUploaderWith: [UserWhereInput!] + """repository edge predicates""" + hasRepository: Boolean + hasRepositoryWith: [RepositoryWhereInput!] } """ UpdateBeaconInput is used for update Beacon object. @@ -1760,10 +1886,7 @@ input SubmitTaskResultInput { """Error message captured as the result of task execution failure.""" error: String } -input ImportTomesFromGitInput { - """Specify a git URL to obtain the tomes from.""" - gitURL: String! - +input ImportRepositoryInput { """ Optionally, specify directories to include. Only tomes that have a main.eldritch in one of these directory prefixes will be included. @@ -1800,11 +1923,16 @@ type Mutation { ### # Tome ### - importTomesFromGit(input: ImportTomesFromGitInput!,): [Tome!] @requireRole(role: USER) createTome(input: CreateTomeInput!,): Tome! @requireRole(role: USER) updateTome(tomeID: ID!, input: UpdateTomeInput!,): Tome! @requireRole(role: ADMIN) deleteTome(tomeID: ID!): ID! @requireRole(role: ADMIN) + ### + # Repository + ### + createRepository(input: CreateRepositoryInput!): Repository! @requireRole(role: USER) + importRepository(repoID: ID!, input: ImportRepositoryInput): Repository! @requireRole(role: USER) + ### # User ### @@ -1832,6 +1960,25 @@ extend type Query { """Filtering options for Tasks returned from the connection.""" where: TaskWhereInput ): TaskConnection! @requireRole(role: USER) + repositories( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Repositories returned from the connection.""" + orderBy: [RepositoryOrder!] + + """Filtering options for Repositories returned from the connection.""" + where: RepositoryWhereInput + ): RepositoryConnection! @requireRole(role: USER) beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER) hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER) tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER) diff --git a/tavern/internal/graphql/schema/ent.graphql b/tavern/internal/graphql/schema/ent.graphql index e8b099200..707561839 100644 --- a/tavern/internal/graphql/schema/ent.graphql +++ b/tavern/internal/graphql/schema/ent.graphql @@ -173,6 +173,14 @@ input CreateQuestInput { tomeID: ID! } """ +CreateRepositoryInput is used for create Repository object. +Input was generated by ent. +""" +input CreateRepositoryInput { + """URL of the repository""" + url: String! +} +""" CreateTagInput is used for create Tag object. Input was generated by ent. """ @@ -1120,6 +1128,119 @@ input QuestWhereInput { hasCreator: Boolean hasCreatorWith: [UserWhereInput!] } +type Repository implements Node { + id: ID! + """Timestamp of when this ent was created""" + createdAt: Time! + """Timestamp of when this ent was last updated""" + lastModifiedAt: Time! + """URL of the repository""" + url: String! + """Public key associated with this repositories private key""" + publicKey: String! + """Tomes imported using this repository.""" + tomes: [Tome!] + """User that created this repository.""" + owner: User +} +"""A connection to a list of items.""" +type RepositoryConnection { + """A list of edges.""" + edges: [RepositoryEdge] + """Information to aid in pagination.""" + pageInfo: PageInfo! + """Identifies the total count of items in the connection.""" + totalCount: Int! +} +"""An edge in a connection.""" +type RepositoryEdge { + """The item at the end of the edge.""" + node: Repository + """A cursor for use in pagination.""" + cursor: Cursor! +} +"""Ordering options for Repository connections""" +input RepositoryOrder { + """The ordering direction.""" + direction: OrderDirection! = ASC + """The field by which to order Repositories.""" + field: RepositoryOrderField! +} +"""Properties by which Repository connections can be ordered.""" +enum RepositoryOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +RepositoryWhereInput is used for filtering Repository objects. +Input was generated by ent. +""" +input RepositoryWhereInput { + not: RepositoryWhereInput + and: [RepositoryWhereInput!] + or: [RepositoryWhereInput!] + """id field predicates""" + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """created_at field predicates""" + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """last_modified_at field predicates""" + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """url field predicates""" + url: String + urlNEQ: String + urlIn: [String!] + urlNotIn: [String!] + urlGT: String + urlGTE: String + urlLT: String + urlLTE: String + urlContains: String + urlHasPrefix: String + urlHasSuffix: String + urlEqualFold: String + urlContainsFold: String + """public_key field predicates""" + publicKey: String + publicKeyNEQ: String + publicKeyIn: [String!] + publicKeyNotIn: [String!] + publicKeyGT: String + publicKeyGTE: String + publicKeyLT: String + publicKeyLTE: String + publicKeyContains: String + publicKeyHasPrefix: String + publicKeyHasSuffix: String + publicKeyEqualFold: String + publicKeyContainsFold: String + """tomes edge predicates""" + hasTomes: Boolean + hasTomesWith: [TomeWhereInput!] + """owner edge predicates""" + hasOwner: Boolean + hasOwnerWith: [UserWhereInput!] +} type Tag implements Node { id: ID! """Name of the tag""" @@ -1392,6 +1513,8 @@ type Tome implements Node { files: [File!] """User who uploaded the tome (may be null).""" uploader: User + """Repository from which this Tome was imported (may be null).""" + repository: Repository } """Ordering options for Tome connections""" input TomeOrder { @@ -1553,6 +1676,9 @@ input TomeWhereInput { """uploader edge predicates""" hasUploader: Boolean hasUploaderWith: [UserWhereInput!] + """repository edge predicates""" + hasRepository: Boolean + hasRepositoryWith: [RepositoryWhereInput!] } """ UpdateBeaconInput is used for update Beacon object. diff --git a/tavern/internal/graphql/schema/inputs.graphql b/tavern/internal/graphql/schema/inputs.graphql index a752a22fb..80dac9eb5 100644 --- a/tavern/internal/graphql/schema/inputs.graphql +++ b/tavern/internal/graphql/schema/inputs.graphql @@ -40,10 +40,7 @@ input SubmitTaskResultInput { """Error message captured as the result of task execution failure.""" error: String } -input ImportTomesFromGitInput { - """Specify a git URL to obtain the tomes from.""" - gitURL: String! - +input ImportRepositoryInput { """ Optionally, specify directories to include. Only tomes that have a main.eldritch in one of these directory prefixes will be included. diff --git a/tavern/internal/graphql/schema/mutation.graphql b/tavern/internal/graphql/schema/mutation.graphql index 418792755..9e315a702 100644 --- a/tavern/internal/graphql/schema/mutation.graphql +++ b/tavern/internal/graphql/schema/mutation.graphql @@ -28,11 +28,16 @@ type Mutation { ### # Tome ### - importTomesFromGit(input: ImportTomesFromGitInput!,): [Tome!] @requireRole(role: USER) createTome(input: CreateTomeInput!,): Tome! @requireRole(role: USER) updateTome(tomeID: ID!, input: UpdateTomeInput!,): Tome! @requireRole(role: ADMIN) deleteTome(tomeID: ID!): ID! @requireRole(role: ADMIN) + ### + # Repository + ### + createRepository(input: CreateRepositoryInput!): Repository! @requireRole(role: USER) + importRepository(repoID: ID!, input: ImportRepositoryInput): Repository! @requireRole(role: USER) + ### # User ### diff --git a/tavern/internal/graphql/schema/query.graphql b/tavern/internal/graphql/schema/query.graphql index d3edef49d..2690bd00b 100644 --- a/tavern/internal/graphql/schema/query.graphql +++ b/tavern/internal/graphql/schema/query.graphql @@ -20,6 +20,25 @@ extend type Query { """Filtering options for Tasks returned from the connection.""" where: TaskWhereInput ): TaskConnection! @requireRole(role: USER) + repositories( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Repositories returned from the connection.""" + orderBy: [RepositoryOrder!] + + """Filtering options for Repositories returned from the connection.""" + where: RepositoryWhereInput + ): RepositoryConnection! @requireRole(role: USER) beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER) hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER) tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER) diff --git a/tavern/internal/graphql/testdata/mutations/createRepository/URLWithoutSchema.yml b/tavern/internal/graphql/testdata/mutations/createRepository/URLWithoutSchema.yml new file mode 100644 index 000000000..e03cda668 --- /dev/null +++ b/tavern/internal/graphql/testdata/mutations/createRepository/URLWithoutSchema.yml @@ -0,0 +1,24 @@ +state: | + INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin) + VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true); +requestor: + session_token: secretToken +query: | + mutation CreateRepository($input: CreateRepositoryInput!) { + createRepository(input: $input) { + url + + owner { + id + } + } + } +variables: + input: + url: "github.com/spellshift/realm" + +expected: + createRepository: + url: "https://github.com/spellshift/realm" + owner: + id: "5" diff --git a/tavern/internal/graphql/testdata/mutations/createRepository/ValidURL.yml b/tavern/internal/graphql/testdata/mutations/createRepository/ValidURL.yml new file mode 100644 index 000000000..2f10a7a9d --- /dev/null +++ b/tavern/internal/graphql/testdata/mutations/createRepository/ValidURL.yml @@ -0,0 +1,24 @@ +state: | + INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin) + VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true); +requestor: + session_token: secretToken +query: | + mutation CreateRepository($input: CreateRepositoryInput!) { + createRepository(input: $input) { + url + + owner { + id + } + } + } +variables: + input: + url: "ssh://github.com/spellshift/realm" + +expected: + createRepository: + url: "ssh://github.com/spellshift/realm" + owner: + id: "5" diff --git a/tavern/internal/graphql/testdata/mutations/importRepository/ExistingTomes.yml b/tavern/internal/graphql/testdata/mutations/importRepository/ExistingTomes.yml new file mode 100644 index 000000000..4d4d989c1 --- /dev/null +++ b/tavern/internal/graphql/testdata/mutations/importRepository/ExistingTomes.yml @@ -0,0 +1,44 @@ +state: | + INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin) + VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true); + INSERT INTO `repositories` (id, repository_owner, url, public_key, private_key, created_at, last_modified_at) + VALUES (11000, 5, "ssh://code.google.com/my/repo", "--PUBLIC KEY--", "--PRIVATE KEY--", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); + INSERT INTO `tomes` (id, tome_repository, name, description, author, eldritch, hash, created_at, last_modified_at) + VALUES (2000,11000,"Test Tome","Used in a unit test :D", "kcarretto", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); + INSERT INTO `tomes` (id, tome_repository, name, description, author, eldritch, hash, created_at, last_modified_at) + VALUES (2001,11000,"expected_tome","Filtered by a unit test :D", "kcarretto", "print('Goodbye World!')", "gfedcba", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); +requestor: + session_token: secretToken +query: | + mutation ImportRepository { + importRepository(repoID: 11000) { + id + url + publicKey + tomes { + id + name + author + eldritch + } + owner { + id + } + } + } +expected: + importRepository: + id: "11000" + url: "ssh://code.google.com/my/repo" + publicKey: "--PUBLIC KEY--" + tomes: + - id: "2000" + name: "Test Tome" + author: kcarretto + eldritch: print('Hello World!') + - id: "2001" + name: "expected_tome" + author: "expected_author" + eldritch: print("expected") + owner: + id: "5" diff --git a/tavern/internal/graphql/testdata/mutations/importRepository/NoExistingTomes.yml b/tavern/internal/graphql/testdata/mutations/importRepository/NoExistingTomes.yml new file mode 100644 index 000000000..b081d80bf --- /dev/null +++ b/tavern/internal/graphql/testdata/mutations/importRepository/NoExistingTomes.yml @@ -0,0 +1,34 @@ +state: | + INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin) + VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true); + INSERT INTO `repositories` (id, repository_owner, url, public_key, private_key, created_at, last_modified_at) + VALUES (11000, 5, "ssh://code.google.com/my/repo", "--PUBLIC KEY--", "--PRIVATE KEY--", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); +requestor: + session_token: secretToken +query: | + mutation ImportRepository { + importRepository(repoID: 11000) { + id + url + publicKey + tomes { + name + author + eldritch + } + owner { + id + } + } + } +expected: + importRepository: + id: "11000" + url: "ssh://code.google.com/my/repo" + publicKey: "--PUBLIC KEY--" + tomes: + - name: "expected_tome" + author: "expected_author" + eldritch: print("expected") + owner: + id: "5" diff --git a/tavern/internal/graphql/testdata/queries/repositories/WithTomes.yml b/tavern/internal/graphql/testdata/queries/repositories/WithTomes.yml new file mode 100644 index 000000000..a0814ab0d --- /dev/null +++ b/tavern/internal/graphql/testdata/queries/repositories/WithTomes.yml @@ -0,0 +1,35 @@ +state: | + INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin) + VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true); + INSERT INTO `repositories` (id, repository_owner, url, public_key, private_key, created_at, last_modified_at) + VALUES (11000, 5, "ssh://code.google.com/my/repo", "--PUBLIC KEY--", "--PRIVATE KEY--", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); + INSERT INTO `tomes` (id, tome_repository, name, description, author, eldritch, hash, created_at, last_modified_at) + VALUES (2000,11000,"Test Tome","Used in a unit test :D", "kcarretto", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); + INSERT INTO `tomes` (id, tome_repository, name, description, author, eldritch, hash, created_at, last_modified_at) + VALUES (2001,11000,"Test Tome 2","Filtered by a unit test :D", "kcarretto", "print('Goodbye World!')", "gfedcba", "2023-03-04 14:51:13", "2023-03-04 14:51:13"); +requestor: + session_token: secretToken +query: | + query Repositories { + repositories { + edges { + node { + id + url + publicKey + owner { + id + } + } + } + } + } +expected: + repositories: + edges: + - node: + id: "11000" + url: "ssh://code.google.com/my/repo" + publicKey: "--PUBLIC KEY--" + owner: + id: "5" diff --git a/tavern/internal/graphql/tome_test.go b/tavern/internal/graphql/tome_test.go index 648cd09bf..471947794 100644 --- a/tavern/internal/graphql/tome_test.go +++ b/tavern/internal/graphql/tome_test.go @@ -12,6 +12,7 @@ import ( "realm.pub/tavern/internal/ent/enttest" "realm.pub/tavern/internal/graphql" tavernhttp "realm.pub/tavern/internal/http" + "realm.pub/tavern/tomes" ) func TestTomeMutations(t *testing.T) { @@ -19,9 +20,13 @@ func TestTomeMutations(t *testing.T) { ctx := context.Background() graph := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1") defer graph.Close() + + // Initialize Git Importer + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( tavernhttp.RouteMap{ - "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph)), + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git)), }, tavernhttp.WithAuthenticationBypass(graph), ) diff --git a/tavern/internal/graphql/user_test.go b/tavern/internal/graphql/user_test.go index 9e99a6665..d97f9e71d 100644 --- a/tavern/internal/graphql/user_test.go +++ b/tavern/internal/graphql/user_test.go @@ -10,6 +10,7 @@ import ( "realm.pub/tavern/internal/ent/enttest" "realm.pub/tavern/internal/graphql" tavernhttp "realm.pub/tavern/internal/http" + "realm.pub/tavern/tomes" "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql/handler" @@ -22,9 +23,13 @@ func TestUserMutations(t *testing.T) { ctx := context.Background() graph := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1") defer graph.Close() + + // Initialize Git Importer + git := tomes.NewGitImporter(graph) + srv := tavernhttp.NewServer( tavernhttp.RouteMap{ - "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph)), + "/graphql": handler.NewDefaultServer(graphql.NewSchema(graph, git)), }, tavernhttp.WithAuthenticationBypass(graph), ) diff --git a/tavern/internal/www/schema.graphql b/tavern/internal/www/schema.graphql index d0c11d6a0..2eabab32f 100644 --- a/tavern/internal/www/schema.graphql +++ b/tavern/internal/www/schema.graphql @@ -178,6 +178,14 @@ input CreateQuestInput { tomeID: ID! } """ +CreateRepositoryInput is used for create Repository object. +Input was generated by ent. +""" +input CreateRepositoryInput { + """URL of the repository""" + url: String! +} +""" CreateTagInput is used for create Tag object. Input was generated by ent. """ @@ -1125,6 +1133,119 @@ input QuestWhereInput { hasCreator: Boolean hasCreatorWith: [UserWhereInput!] } +type Repository implements Node { + id: ID! + """Timestamp of when this ent was created""" + createdAt: Time! + """Timestamp of when this ent was last updated""" + lastModifiedAt: Time! + """URL of the repository""" + url: String! + """Public key associated with this repositories private key""" + publicKey: String! + """Tomes imported using this repository.""" + tomes: [Tome!] + """User that created this repository.""" + owner: User +} +"""A connection to a list of items.""" +type RepositoryConnection { + """A list of edges.""" + edges: [RepositoryEdge] + """Information to aid in pagination.""" + pageInfo: PageInfo! + """Identifies the total count of items in the connection.""" + totalCount: Int! +} +"""An edge in a connection.""" +type RepositoryEdge { + """The item at the end of the edge.""" + node: Repository + """A cursor for use in pagination.""" + cursor: Cursor! +} +"""Ordering options for Repository connections""" +input RepositoryOrder { + """The ordering direction.""" + direction: OrderDirection! = ASC + """The field by which to order Repositories.""" + field: RepositoryOrderField! +} +"""Properties by which Repository connections can be ordered.""" +enum RepositoryOrderField { + CREATED_AT + LAST_MODIFIED_AT +} +""" +RepositoryWhereInput is used for filtering Repository objects. +Input was generated by ent. +""" +input RepositoryWhereInput { + not: RepositoryWhereInput + and: [RepositoryWhereInput!] + or: [RepositoryWhereInput!] + """id field predicates""" + id: ID + idNEQ: ID + idIn: [ID!] + idNotIn: [ID!] + idGT: ID + idGTE: ID + idLT: ID + idLTE: ID + """created_at field predicates""" + createdAt: Time + createdAtNEQ: Time + createdAtIn: [Time!] + createdAtNotIn: [Time!] + createdAtGT: Time + createdAtGTE: Time + createdAtLT: Time + createdAtLTE: Time + """last_modified_at field predicates""" + lastModifiedAt: Time + lastModifiedAtNEQ: Time + lastModifiedAtIn: [Time!] + lastModifiedAtNotIn: [Time!] + lastModifiedAtGT: Time + lastModifiedAtGTE: Time + lastModifiedAtLT: Time + lastModifiedAtLTE: Time + """url field predicates""" + url: String + urlNEQ: String + urlIn: [String!] + urlNotIn: [String!] + urlGT: String + urlGTE: String + urlLT: String + urlLTE: String + urlContains: String + urlHasPrefix: String + urlHasSuffix: String + urlEqualFold: String + urlContainsFold: String + """public_key field predicates""" + publicKey: String + publicKeyNEQ: String + publicKeyIn: [String!] + publicKeyNotIn: [String!] + publicKeyGT: String + publicKeyGTE: String + publicKeyLT: String + publicKeyLTE: String + publicKeyContains: String + publicKeyHasPrefix: String + publicKeyHasSuffix: String + publicKeyEqualFold: String + publicKeyContainsFold: String + """tomes edge predicates""" + hasTomes: Boolean + hasTomesWith: [TomeWhereInput!] + """owner edge predicates""" + hasOwner: Boolean + hasOwnerWith: [UserWhereInput!] +} type Tag implements Node { id: ID! """Name of the tag""" @@ -1397,6 +1518,8 @@ type Tome implements Node { files: [File!] """User who uploaded the tome (may be null).""" uploader: User + """Repository from which this Tome was imported (may be null).""" + repository: Repository } """Ordering options for Tome connections""" input TomeOrder { @@ -1558,6 +1681,9 @@ input TomeWhereInput { """uploader edge predicates""" hasUploader: Boolean hasUploaderWith: [UserWhereInput!] + """repository edge predicates""" + hasRepository: Boolean + hasRepositoryWith: [RepositoryWhereInput!] } """ UpdateBeaconInput is used for update Beacon object. @@ -1760,10 +1886,7 @@ input SubmitTaskResultInput { """Error message captured as the result of task execution failure.""" error: String } -input ImportTomesFromGitInput { - """Specify a git URL to obtain the tomes from.""" - gitURL: String! - +input ImportRepositoryInput { """ Optionally, specify directories to include. Only tomes that have a main.eldritch in one of these directory prefixes will be included. @@ -1800,11 +1923,16 @@ type Mutation { ### # Tome ### - importTomesFromGit(input: ImportTomesFromGitInput!,): [Tome!] @requireRole(role: USER) createTome(input: CreateTomeInput!,): Tome! @requireRole(role: USER) updateTome(tomeID: ID!, input: UpdateTomeInput!,): Tome! @requireRole(role: ADMIN) deleteTome(tomeID: ID!): ID! @requireRole(role: ADMIN) + ### + # Repository + ### + createRepository(input: CreateRepositoryInput!): Repository! @requireRole(role: USER) + importRepository(repoID: ID!, input: ImportRepositoryInput): Repository! @requireRole(role: USER) + ### # User ### @@ -1832,6 +1960,25 @@ extend type Query { """Filtering options for Tasks returned from the connection.""" where: TaskWhereInput ): TaskConnection! @requireRole(role: USER) + repositories( + """Returns the elements in the list that come after the specified cursor.""" + after: Cursor + + """Returns the first _n_ elements from the list.""" + first: Int + + """Returns the elements in the list that come before the specified cursor.""" + before: Cursor + + """Returns the last _n_ elements from the list.""" + last: Int + + """Ordering options for Repositories returned from the connection.""" + orderBy: [RepositoryOrder!] + + """Filtering options for Repositories returned from the connection.""" + where: RepositoryWhereInput + ): RepositoryConnection! @requireRole(role: USER) beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER) hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER) tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER) diff --git a/tavern/tomes/git.go b/tavern/tomes/git.go index ec9d8bcb7..71b7cce11 100644 --- a/tavern/tomes/git.go +++ b/tavern/tomes/git.go @@ -13,60 +13,101 @@ import ( "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/go-git/go-git/v5/plumbing/object" + gitssh "github.com/go-git/go-git/v5/plumbing/transport/ssh" "github.com/go-git/go-git/v5/storage/memory" + "golang.org/x/crypto/ssh" "gopkg.in/yaml.v3" "realm.pub/tavern/internal/ent" "realm.pub/tavern/internal/ent/tome" ) -// ImportFromRepo clones a git repository from the provided URL in memory. +// GitImportOption provides configuration for creating a new GitImporter. +type GitImportOption func(*GitImporter) + +// NewGitImporter initializes and returns a new GitImporter. +// If no SSH Private Key is provided, a new ECDSA P256 private key is generated. +// This panics if a new SSH Private Key cannot be generated. +func NewGitImporter(graph *ent.Client, options ...GitImportOption) *GitImporter { + importer := &GitImporter{ + graph: graph, + } + for _, opt := range options { + opt(importer) + } + + return importer +} + +// A GitImporter imports tomes from a provided Git URL. +type GitImporter struct { + graph *ent.Client +} + +// Import clones a git repository from the provided URL in memory. // It walks the directory structure, looking for 'main.eldritch' files. // For each 'main.eldritch' file found, it's parent directory is treated as the tome's root. // All files in that directory and it's subdirectories (recursively) aside from the reserved // metadata.yml file are uploaded as the tome's assets. - -// Provided filters on tome paths may be used to exclude directories by returning true if the +// +// Provided filters on tome paths may be used to limit included directories by returning true if the // result should be included. -func ImportFromRepo(ctx context.Context, graph *ent.Client, gitURL string, filters ...func(path string) bool) ([]*ent.Tome, error) { +func (importer *GitImporter) Import(ctx context.Context, entRepo *ent.Repository, filters ...func(path string) bool) error { + // Use Private Key Auth for SSH + var authMethod *gitssh.PublicKeys + if strings.HasPrefix(entRepo.URL, "ssh://") { + privKey, err := ssh.ParsePrivateKey([]byte(entRepo.PrivateKey)) + if err != nil { + return fmt.Errorf("failed to parse private key for repository: %w", err) + } + authMethod = &gitssh.PublicKeys{ + User: "git", + Signer: privKey, + HostKeyCallbackHelper: gitssh.HostKeyCallbackHelper{ + // Ignore Host Keys + HostKeyCallback: ssh.InsecureIgnoreHostKey(), + }, + } + } + // Clone Repository (In-Memory) storage := memory.NewStorage() repo, err := git.CloneContext(ctx, storage, nil, &git.CloneOptions{ - URL: gitURL, + URL: entRepo.URL, SingleBranch: true, Depth: 1, + Auth: authMethod, Tags: git.NoTags, }) if err != nil { - return nil, fmt.Errorf("failed to clone: %w", err) + return fmt.Errorf("failed to clone: %w", err) } // Get HEAD head, err := repo.Head() if err != nil { - return nil, fmt.Errorf("failed to get repository HEAD: %w", err) + return fmt.Errorf("failed to get repository HEAD: %w", err) } // Get Commit commit, err := repo.CommitObject(head.Hash()) if err != nil { - return nil, fmt.Errorf("failed to get commit object (HEAD): %w", err) + return fmt.Errorf("failed to get commit object (HEAD): %w", err) } // Get Root File Tree tree, err := repo.TreeObject(commit.TreeHash) if err != nil { - return nil, fmt.Errorf("failed to get tree (%q): %w", commit.Hash, err) + return fmt.Errorf("failed to get tree (%q): %w", commit.Hash, err) } // Get Tome Paths tomePaths, err := findTomePaths(tree) if err != nil { - return nil, err + return err } // Import Tomes - namespace := parseNamespaceFromGit(gitURL) - tomes := make([]*ent.Tome, 0, len(tomePaths)) + namespace := parseNamespaceFromGit(entRepo.URL) for _, path := range tomePaths { // Apply Filters include := true @@ -81,55 +122,19 @@ func ImportFromRepo(ctx context.Context, graph *ent.Client, gitURL string, filte } // Import Tome - tome, err := importFromGitTree(ctx, repo, namespace, tree, path, graph) - if err != nil { - return nil, fmt.Errorf("failed to import tome (%q): %w", path, err) - } - tomes = append(tomes, tome) - } - - return tomes, nil -} - -// findTomePaths returns a list of valid paths to the root directory of a Tome. -// This is based on all of the 'main.eldritch' files found in the repository. -func findTomePaths(tree *object.Tree) ([]string, error) { - var tomePaths []string - walker := object.NewTreeWalker(tree, true, make(map[plumbing.Hash]bool)) - defer walker.Close() - for { - // Fetch next entry - name, _, err := walker.Next() - if err == io.EOF { - // No more entries - break - } - if err != nil { - return nil, fmt.Errorf("failed to walk repo tree: %w", err) - } - - // If 'main.eldritch' is present, the parent directory is the tome root - base := filepath.Base(name) - if base == "main.eldritch" { - // Cannot use filepath.Dir on Windows, git does not use \ separators - tomePaths = append( - tomePaths, - strings.TrimSuffix( - strings.TrimSuffix(name, base), // Get the directory name - "/", // Remove the trailing / - ), - ) + if err := importer.importFromGitTree(ctx, repo, entRepo, namespace, tree, path); err != nil { + return fmt.Errorf("failed to import tome (%q): %w", path, err) } } - return tomePaths, nil + return nil } // ImportFromGitTree imports a tome based on the provided path -func importFromGitTree(ctx context.Context, repo *git.Repository, namespace string, root *object.Tree, path string, graph *ent.Client) (*ent.Tome, error) { +func (importer *GitImporter) importFromGitTree(ctx context.Context, repo *git.Repository, entRepo *ent.Repository, namespace string, root *object.Tree, path string) error { tree, err := root.Tree(path) if err != nil { - return nil, fmt.Errorf("failed to get tome tree (%q): %w", path, err) + return fmt.Errorf("failed to get tome tree (%q): %w", path, err) } walker := object.NewTreeWalker(tree, true, make(map[plumbing.Hash]bool)) @@ -145,7 +150,7 @@ func importFromGitTree(ctx context.Context, repo *git.Repository, namespace stri break } if err != nil { - return nil, fmt.Errorf("failed to walk tome tree (%q): %w", name, err) + return fmt.Errorf("failed to walk tome tree (%q): %w", name, err) } // Skip Directory Files @@ -156,25 +161,25 @@ func importFromGitTree(ctx context.Context, repo *git.Repository, namespace stri // Read File Data blob, err := repo.BlobObject(entry.Hash) if err != nil { - return nil, fmt.Errorf("failed to get tome blob (%q): %w", name, err) + return fmt.Errorf("failed to get tome blob (%q): %w", name, err) } reader, err := blob.Reader() if err != nil { - return nil, fmt.Errorf("failed to get tome blob reader (%q): %w", name, err) + return fmt.Errorf("failed to get tome blob reader (%q): %w", name, err) } defer reader.Close() data, err := io.ReadAll(reader) if err != nil { - return nil, fmt.Errorf("failed to read tome file (%q): %w", name, err) + return fmt.Errorf("failed to read tome file (%q): %w", name, err) } // Parse metadata.yml if filepath.Base(name) == "metadata.yml" { if err := yaml.Unmarshal(data, &metadata); err != nil { - return nil, fmt.Errorf("failed to parse tome metadata %q: %w", name, err) + return fmt.Errorf("failed to parse tome metadata %q: %w", name, err) } if err := metadata.Validate(); err != nil { - return nil, fmt.Errorf("invalid tome metadata %q: %w", name, err) + return fmt.Errorf("invalid tome metadata %q: %w", name, err) } continue @@ -188,36 +193,36 @@ func importFromGitTree(ctx context.Context, repo *git.Repository, namespace stri // Upload other files // TODO: Namespace tomes to prevent multi-repo conflicts - fileID, err := graph.File.Create(). + fileID, err := importer.graph.File.Create(). SetName(fmt.Sprintf("%s/%s", filepath.Base(path), name)). SetContent(data). OnConflict(). UpdateNewValues(). ID(ctx) if err != nil { - return nil, fmt.Errorf("failed to upload tome file %q: %w", name, err) + return fmt.Errorf("failed to upload tome file %q: %w", name, err) } tomeFileIDs = append(tomeFileIDs, fileID) } // Ensure Metadata was found if metadata.Name == "" { - return nil, fmt.Errorf("tome must include 'metadata.yml' file (%q)", path) + return fmt.Errorf("tome must include 'metadata.yml' file (%q)", path) } // Ensure Eldritch not empty if eldritch == "" { - return nil, fmt.Errorf("tome must include non-empty 'eldritch.main' file (%q)", path) + return fmt.Errorf("tome must include non-empty 'eldritch.main' file (%q)", path) } // Marshal Params paramdefs, err := json.Marshal(metadata.ParamDefs) if err != nil { - return nil, fmt.Errorf("failed to marshal param defs for %q: %w", path, err) + return fmt.Errorf("failed to marshal param defs for %q: %w", path, err) } // Create the tome - tomeID, err := graph.Tome.Create(). + _, err = importer.graph.Tome.Create(). SetName(fmt.Sprintf("%s::%s", namespace, metadata.Name)). SetDescription(metadata.Description). SetAuthor(metadata.Author). @@ -225,15 +230,49 @@ func importFromGitTree(ctx context.Context, repo *git.Repository, namespace stri SetSupportModel(tome.SupportModelCOMMUNITY). SetTactic(tome.Tactic(metadata.Tactic)). SetEldritch(eldritch). + SetRepository(entRepo). AddFileIDs(tomeFileIDs...). OnConflict(). UpdateNewValues(). ID(ctx) if err != nil { - return nil, fmt.Errorf("failed to create tome %q: %w", metadata.Name, err) + return fmt.Errorf("failed to create tome %q: %w", metadata.Name, err) } + return nil +} - return graph.Tome.Get(ctx, tomeID) +// findTomePaths returns a list of valid paths to the root directory of a Tome. +// This is based on all of the 'main.eldritch' files found in the repository. +func findTomePaths(tree *object.Tree) ([]string, error) { + var tomePaths []string + walker := object.NewTreeWalker(tree, true, make(map[plumbing.Hash]bool)) + defer walker.Close() + for { + // Fetch next entry + name, _, err := walker.Next() + if err == io.EOF { + // No more entries + break + } + if err != nil { + return nil, fmt.Errorf("failed to walk repo tree: %w", err) + } + + // If 'main.eldritch' is present, the parent directory is the tome root + base := filepath.Base(name) + if base == "main.eldritch" { + // Cannot use filepath.Dir on Windows, git does not use \ separators + tomePaths = append( + tomePaths, + strings.TrimSuffix( + strings.TrimSuffix(name, base), // Get the directory name + "/", // Remove the trailing / + ), + ) + } + } + + return tomePaths, nil } // parseNamespaceFromGit attempts to return a shortend namespace for the tome based on the git URL. diff --git a/tavern/tomes/git_test.go b/tavern/tomes/git_test.go index a2ae961ef..6010ce524 100644 --- a/tavern/tomes/git_test.go +++ b/tavern/tomes/git_test.go @@ -24,10 +24,19 @@ func TestImportFromRepo(t *testing.T) { graph := enttest.Open(t, driverName, dataSourceName, enttest.WithOptions()) defer graph.Close() + // Initialize Git Importer + git := tomes.NewGitImporter(graph) + + // Create repository + repo := graph.Repository.Create().SetURL(localGit).SaveX(ctx) + repo.URL = localGit // Override schema hook to test with local repo + + assert.NotEmpty(t, repo.PrivateKey) + filter := func(path string) bool { return strings.Contains(path, "example") } - _, err := tomes.ImportFromRepo(ctx, graph, localGit, filter) + err := git.Import(ctx, repo, filter) require.NoError(t, err) testTome := graph.Tome.Query().