ent

package
v0.11.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeTask = "Task"
	TypeTeam = "Team"
	TypeUser = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Task is the client for interacting with the Task builders.
	Task *TaskClient
	// Team is the client for interacting with the Team builders.
	Team *TeamClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Task.
	Query().
	Count(ctx)

func (*Client) Intercept added in v0.11.5

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate added in v0.11.5

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

type ConstraintError struct {
	// contains filtered or unexported fields
}

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type InterceptFunc added in v0.11.5

type InterceptFunc = ent.InterceptFunc

ent aliases to avoid import conflicts in user's code.

type Interceptor added in v0.11.5

type Interceptor = ent.Interceptor

ent aliases to avoid import conflicts in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

type NotLoadedError struct {
	// contains filtered or unexported fields
}

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

type NotSingularError struct {
	// contains filtered or unexported fields
}

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func HTTPClient added in v0.11.0

func HTTPClient(v *http.Client) Option

HTTPClient configures the HTTPClient.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Querier added in v0.11.5

type Querier = ent.Querier

ent aliases to avoid import conflicts in user's code.

type QuerierFunc added in v0.11.5

type QuerierFunc = ent.QuerierFunc

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type QueryContext added in v0.11.6

type QueryContext = ent.QueryContext

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Task

type Task struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Status holds the value of the "status" field.
	Status task.Status `json:"status,omitempty"`
	// UUID holds the value of the "uuid" field.
	UUID uuid.UUID `json:"uuid,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TaskQuery when eager-loading is set.
	Edges TaskEdges `json:"edges"`
	// contains filtered or unexported fields
}

Task is the model entity for the Task schema.

func (*Task) QueryOwner

func (t *Task) QueryOwner() *UserQuery

QueryOwner queries the "owner" edge of the Task entity.

func (*Task) QueryTeams

func (t *Task) QueryTeams() *TeamQuery

QueryTeams queries the "teams" edge of the Task entity.

func (*Task) String

func (t *Task) String() string

String implements the fmt.Stringer.

func (*Task) Unwrap

func (t *Task) Unwrap() *Task

Unwrap unwraps the Task 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 (*Task) Update

func (t *Task) Update() *TaskUpdateOne

Update returns a builder for updating this Task. Note that you need to call Task.Unwrap() before calling this method if this Task was returned from a transaction, and the transaction was committed or rolled back.

type TaskClient

type TaskClient struct {
	// contains filtered or unexported fields
}

TaskClient is a client for the Task schema.

func NewTaskClient

func NewTaskClient(c config) *TaskClient

NewTaskClient returns a client for the Task from the given config.

func (*TaskClient) Create

func (c *TaskClient) Create() *TaskCreate

Create returns a builder for creating a Task entity.

func (*TaskClient) CreateBulk

func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk

CreateBulk returns a builder for creating a bulk of Task entities.

func (*TaskClient) Delete

func (c *TaskClient) Delete() *TaskDelete

Delete returns a delete builder for Task.

func (*TaskClient) DeleteOne

func (c *TaskClient) DeleteOne(t *Task) *TaskDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TaskClient) DeleteOneID

func (c *TaskClient) DeleteOneID(id int) *TaskDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*TaskClient) Get

func (c *TaskClient) Get(ctx context.Context, id int) (*Task, error)

Get returns a Task entity by its id.

func (*TaskClient) GetX

func (c *TaskClient) GetX(ctx context.Context, id int) *Task

GetX is like Get, but panics if an error occurs.

func (*TaskClient) Hooks

func (c *TaskClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TaskClient) Intercept added in v0.11.5

func (c *TaskClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `task.Intercept(f(g(h())))`.

func (*TaskClient) Interceptors added in v0.11.5

func (c *TaskClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*TaskClient) Query

func (c *TaskClient) Query() *TaskQuery

Query returns a query builder for Task.

func (*TaskClient) QueryOwner

func (c *TaskClient) QueryOwner(t *Task) *UserQuery

QueryOwner queries the owner edge of a Task.

func (*TaskClient) QueryTeams

func (c *TaskClient) QueryTeams(t *Task) *TeamQuery

QueryTeams queries the teams edge of a Task.

func (*TaskClient) Update

func (c *TaskClient) Update() *TaskUpdate

Update returns an update builder for Task.

func (*TaskClient) UpdateOne

func (c *TaskClient) UpdateOne(t *Task) *TaskUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TaskClient) UpdateOneID

func (c *TaskClient) UpdateOneID(id int) *TaskUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TaskClient) Use

func (c *TaskClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `task.Hooks(f(g(h())))`.

type TaskCreate

type TaskCreate struct {
	// contains filtered or unexported fields
}

TaskCreate is the builder for creating a Task entity.

func (*TaskCreate) AddTeamIDs

func (tc *TaskCreate) AddTeamIDs(ids ...int) *TaskCreate

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*TaskCreate) AddTeams

func (tc *TaskCreate) AddTeams(t ...*Team) *TaskCreate

AddTeams adds the "teams" edges to the Team entity.

func (*TaskCreate) Exec added in v0.9.0

func (tc *TaskCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskCreate) ExecX added in v0.9.0

func (tc *TaskCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskCreate) Mutation

func (tc *TaskCreate) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskCreate) Save

func (tc *TaskCreate) Save(ctx context.Context) (*Task, error)

Save creates the Task in the database.

func (*TaskCreate) SaveX

func (tc *TaskCreate) SaveX(ctx context.Context) *Task

SaveX calls Save and panics if Save returns an error.

func (*TaskCreate) SetDescription

func (tc *TaskCreate) SetDescription(s string) *TaskCreate

SetDescription sets the "description" field.

func (*TaskCreate) SetNillableDescription

func (tc *TaskCreate) SetNillableDescription(s *string) *TaskCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TaskCreate) SetNillableOwnerID

func (tc *TaskCreate) SetNillableOwnerID(id *int) *TaskCreate

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*TaskCreate) SetNillableStatus

func (tc *TaskCreate) SetNillableStatus(t *task.Status) *TaskCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TaskCreate) SetNillableUUID added in v0.10.0

func (tc *TaskCreate) SetNillableUUID(u *uuid.UUID) *TaskCreate

SetNillableUUID sets the "uuid" field if the given value is not nil.

func (*TaskCreate) SetOwner

func (tc *TaskCreate) SetOwner(u *User) *TaskCreate

SetOwner sets the "owner" edge to the User entity.

func (*TaskCreate) SetOwnerID

func (tc *TaskCreate) SetOwnerID(id int) *TaskCreate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*TaskCreate) SetStatus

func (tc *TaskCreate) SetStatus(t task.Status) *TaskCreate

SetStatus sets the "status" field.

func (*TaskCreate) SetTitle

func (tc *TaskCreate) SetTitle(s string) *TaskCreate

SetTitle sets the "title" field.

func (*TaskCreate) SetUUID

func (tc *TaskCreate) SetUUID(u uuid.UUID) *TaskCreate

SetUUID sets the "uuid" field.

type TaskCreateBulk

type TaskCreateBulk struct {
	// contains filtered or unexported fields
}

TaskCreateBulk is the builder for creating many Task entities in bulk.

func (*TaskCreateBulk) Exec added in v0.9.0

func (tcb *TaskCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskCreateBulk) ExecX added in v0.9.0

func (tcb *TaskCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskCreateBulk) Save

func (tcb *TaskCreateBulk) Save(ctx context.Context) ([]*Task, error)

Save creates the Task entities in the database.

func (*TaskCreateBulk) SaveX

func (tcb *TaskCreateBulk) SaveX(ctx context.Context) []*Task

SaveX is like Save, but panics if an error occurs.

type TaskDelete

type TaskDelete struct {
	// contains filtered or unexported fields
}

TaskDelete is the builder for deleting a Task entity.

func (*TaskDelete) Exec

func (td *TaskDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TaskDelete) ExecX

func (td *TaskDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TaskDelete) Where

func (td *TaskDelete) Where(ps ...predicate.Task) *TaskDelete

Where appends a list predicates to the TaskDelete builder.

type TaskDeleteOne

type TaskDeleteOne struct {
	// contains filtered or unexported fields
}

TaskDeleteOne is the builder for deleting a single Task entity.

func (*TaskDeleteOne) Exec

func (tdo *TaskDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TaskDeleteOne) ExecX

func (tdo *TaskDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskDeleteOne) Where added in v0.11.7

func (tdo *TaskDeleteOne) Where(ps ...predicate.Task) *TaskDeleteOne

Where appends a list predicates to the TaskDelete builder.

type TaskEdges

type TaskEdges struct {
	// Teams holds the value of the teams edge.
	Teams []*Team `json:"teams,omitempty"`
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

TaskEdges holds the relations/edges for other nodes in the graph.

func (TaskEdges) OwnerOrErr

func (e TaskEdges) OwnerOrErr() (*User, error)

OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (TaskEdges) TeamsOrErr

func (e TaskEdges) TeamsOrErr() ([]*Team, error)

TeamsOrErr returns the Teams value or an error if the edge was not loaded in eager-loading.

type TaskFilter

type TaskFilter struct {
	// contains filtered or unexported fields
}

TaskFilter provides a generic filtering capability at runtime for TaskQuery.

func (*TaskFilter) Where

func (f *TaskFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*TaskFilter) WhereDescription

func (f *TaskFilter) WhereDescription(p entql.StringP)

WhereDescription applies the entql string predicate on the description field.

func (*TaskFilter) WhereHasOwner

func (f *TaskFilter) WhereHasOwner()

WhereHasOwner applies a predicate to check if query has an edge owner.

func (*TaskFilter) WhereHasOwnerWith

func (f *TaskFilter) WhereHasOwnerWith(preds ...predicate.User)

WhereHasOwnerWith applies a predicate to check if query has an edge owner with a given conditions (other predicates).

func (*TaskFilter) WhereHasTeams

func (f *TaskFilter) WhereHasTeams()

WhereHasTeams applies a predicate to check if query has an edge teams.

func (*TaskFilter) WhereHasTeamsWith

func (f *TaskFilter) WhereHasTeamsWith(preds ...predicate.Team)

WhereHasTeamsWith applies a predicate to check if query has an edge teams with a given conditions (other predicates).

func (*TaskFilter) WhereID

func (f *TaskFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*TaskFilter) WhereStatus

func (f *TaskFilter) WhereStatus(p entql.StringP)

WhereStatus applies the entql string predicate on the status field.

func (*TaskFilter) WhereTitle

func (f *TaskFilter) WhereTitle(p entql.StringP)

WhereTitle applies the entql string predicate on the title field.

func (*TaskFilter) WhereUUID

func (f *TaskFilter) WhereUUID(p entql.ValueP)

WhereUUID applies the entql [16]byte predicate on the uuid field.

type TaskGroupBy

type TaskGroupBy struct {
	// contains filtered or unexported fields
}

TaskGroupBy is the group-by builder for Task entities.

func (*TaskGroupBy) Aggregate

func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TaskGroupBy) Bool

func (s *TaskGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) BoolX

func (s *TaskGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TaskGroupBy) Bools

func (s *TaskGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) BoolsX

func (s *TaskGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TaskGroupBy) Float64

func (s *TaskGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) Float64X

func (s *TaskGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TaskGroupBy) Float64s

func (s *TaskGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) Float64sX

func (s *TaskGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TaskGroupBy) Int

func (s *TaskGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) IntX

func (s *TaskGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TaskGroupBy) Ints

func (s *TaskGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) IntsX

func (s *TaskGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TaskGroupBy) Scan

func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TaskGroupBy) ScanX

func (s *TaskGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TaskGroupBy) String

func (s *TaskGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) StringX

func (s *TaskGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TaskGroupBy) Strings

func (s *TaskGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TaskGroupBy) StringsX

func (s *TaskGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TaskMutation

type TaskMutation struct {
	// contains filtered or unexported fields
}

TaskMutation represents an operation that mutates the Task nodes in the graph.

func (*TaskMutation) AddField

func (m *TaskMutation) AddField(name string, value ent.Value) error

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 (*TaskMutation) AddTeamIDs

func (m *TaskMutation) AddTeamIDs(ids ...int)

AddTeamIDs adds the "teams" edge to the Team entity by ids.

func (*TaskMutation) AddedEdges

func (m *TaskMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TaskMutation) AddedField

func (m *TaskMutation) AddedField(name string) (ent.Value, bool)

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 (*TaskMutation) AddedFields

func (m *TaskMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TaskMutation) AddedIDs

func (m *TaskMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TaskMutation) ClearDescription

func (m *TaskMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*TaskMutation) ClearEdge

func (m *TaskMutation) ClearEdge(name string) error

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 (*TaskMutation) ClearField

func (m *TaskMutation) ClearField(name string) error

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 (*TaskMutation) ClearOwner

func (m *TaskMutation) ClearOwner()

ClearOwner clears the "owner" edge to the User entity.

func (*TaskMutation) ClearTeams

func (m *TaskMutation) ClearTeams()

ClearTeams clears the "teams" edge to the Team entity.

func (*TaskMutation) ClearUUID

func (m *TaskMutation) ClearUUID()

ClearUUID clears the value of the "uuid" field.

func (*TaskMutation) ClearedEdges

func (m *TaskMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TaskMutation) ClearedFields

func (m *TaskMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TaskMutation) Client

func (m TaskMutation) Client() *Client

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 (*TaskMutation) Description

func (m *TaskMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*TaskMutation) DescriptionCleared

func (m *TaskMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*TaskMutation) EdgeCleared

func (m *TaskMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TaskMutation) Field

func (m *TaskMutation) Field(name string) (ent.Value, bool)

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 (*TaskMutation) FieldCleared

func (m *TaskMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TaskMutation) Fields

func (m *TaskMutation) Fields() []string

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 (*TaskMutation) Filter

func (m *TaskMutation) Filter() *TaskFilter

Filter returns an entql.Where implementation to apply filters on the TaskMutation builder.

func (*TaskMutation) ID

func (m *TaskMutation) ID() (id int, exists bool)

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 (*TaskMutation) IDs added in v0.10.0

func (m *TaskMutation) IDs(ctx context.Context) ([]int, error)

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 (*TaskMutation) OldDescription

func (m *TaskMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Task entity. If the Task 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 (*TaskMutation) OldField

func (m *TaskMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*TaskMutation) OldStatus

func (m *TaskMutation) OldStatus(ctx context.Context) (v task.Status, err error)

OldStatus returns the old "status" field's value of the Task entity. If the Task 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 (*TaskMutation) OldTitle

func (m *TaskMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Task entity. If the Task 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 (*TaskMutation) OldUUID

func (m *TaskMutation) OldUUID(ctx context.Context) (v uuid.UUID, err error)

OldUUID returns the old "uuid" field's value of the Task entity. If the Task 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 (*TaskMutation) Op

func (m *TaskMutation) Op() Op

Op returns the operation name.

func (*TaskMutation) OwnerCleared

func (m *TaskMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*TaskMutation) OwnerID

func (m *TaskMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*TaskMutation) OwnerIDs

func (m *TaskMutation) OwnerIDs() (ids []int)

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 (*TaskMutation) RemoveTeamIDs

func (m *TaskMutation) RemoveTeamIDs(ids ...int)

RemoveTeamIDs removes the "teams" edge to the Team entity by IDs.

func (*TaskMutation) RemovedEdges

func (m *TaskMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TaskMutation) RemovedIDs

func (m *TaskMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TaskMutation) RemovedTeamsIDs

func (m *TaskMutation) RemovedTeamsIDs() (ids []int)

RemovedTeams returns the removed IDs of the "teams" edge to the Team entity.

func (*TaskMutation) ResetDescription

func (m *TaskMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*TaskMutation) ResetEdge

func (m *TaskMutation) ResetEdge(name string) error

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 (*TaskMutation) ResetField

func (m *TaskMutation) ResetField(name string) error

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 (*TaskMutation) ResetOwner

func (m *TaskMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*TaskMutation) ResetStatus

func (m *TaskMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*TaskMutation) ResetTeams

func (m *TaskMutation) ResetTeams()

ResetTeams resets all changes to the "teams" edge.

func (*TaskMutation) ResetTitle

func (m *TaskMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*TaskMutation) ResetUUID

func (m *TaskMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*TaskMutation) SetDescription

func (m *TaskMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*TaskMutation) SetField

func (m *TaskMutation) SetField(name string, value ent.Value) error

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 (*TaskMutation) SetOp added in v0.11.5

func (m *TaskMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TaskMutation) SetOwnerID

func (m *TaskMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*TaskMutation) SetStatus

func (m *TaskMutation) SetStatus(t task.Status)

SetStatus sets the "status" field.

func (*TaskMutation) SetTitle

func (m *TaskMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*TaskMutation) SetUUID

func (m *TaskMutation) SetUUID(u uuid.UUID)

SetUUID sets the "uuid" field.

func (*TaskMutation) Status

func (m *TaskMutation) Status() (r task.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*TaskMutation) TeamsCleared

func (m *TaskMutation) TeamsCleared() bool

TeamsCleared reports if the "teams" edge to the Team entity was cleared.

func (*TaskMutation) TeamsIDs

func (m *TaskMutation) TeamsIDs() (ids []int)

TeamsIDs returns the "teams" edge IDs in the mutation.

func (*TaskMutation) Title

func (m *TaskMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (TaskMutation) Tx

func (m TaskMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TaskMutation) Type

func (m *TaskMutation) Type() string

Type returns the node type of this mutation (Task).

func (*TaskMutation) UUID

func (m *TaskMutation) UUID() (r uuid.UUID, exists bool)

UUID returns the value of the "uuid" field in the mutation.

func (*TaskMutation) UUIDCleared

func (m *TaskMutation) UUIDCleared() bool

UUIDCleared returns if the "uuid" field was cleared in this mutation.

func (*TaskMutation) Where added in v0.9.0

func (m *TaskMutation) Where(ps ...predicate.Task)

Where appends a list predicates to the TaskMutation builder.

func (*TaskMutation) WhereP added in v0.11.5

func (m *TaskMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TaskMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TaskQuery

type TaskQuery struct {
	// contains filtered or unexported fields
}

TaskQuery is the builder for querying Task entities.

func (*TaskQuery) Aggregate added in v0.11.4

func (tq *TaskQuery) Aggregate(fns ...AggregateFunc) *TaskSelect

Aggregate returns a TaskSelect configured with the given aggregations.

func (*TaskQuery) All

func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error)

All executes the query and returns a list of Tasks.

func (*TaskQuery) AllX

func (tq *TaskQuery) AllX(ctx context.Context) []*Task

AllX is like All, but panics if an error occurs.

func (*TaskQuery) Clone

func (tq *TaskQuery) Clone() *TaskQuery

Clone returns a duplicate of the TaskQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TaskQuery) Count

func (tq *TaskQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TaskQuery) CountX

func (tq *TaskQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TaskQuery) Exist

func (tq *TaskQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TaskQuery) ExistX

func (tq *TaskQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TaskQuery) Filter

func (tq *TaskQuery) Filter() *TaskFilter

Filter returns a Filter implementation to apply filters on the TaskQuery builder.

func (*TaskQuery) First

func (tq *TaskQuery) First(ctx context.Context) (*Task, error)

First returns the first Task entity from the query. Returns a *NotFoundError when no Task was found.

func (*TaskQuery) FirstID

func (tq *TaskQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Task ID from the query. Returns a *NotFoundError when no Task ID was found.

func (*TaskQuery) FirstIDX

func (tq *TaskQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TaskQuery) FirstX

func (tq *TaskQuery) FirstX(ctx context.Context) *Task

FirstX is like First, but panics if an error occurs.

func (*TaskQuery) GroupBy

func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy

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 {
	Title string `json:"title,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Task.Query().
	GroupBy(task.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TaskQuery) IDs

func (tq *TaskQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Task IDs.

func (*TaskQuery) IDsX

func (tq *TaskQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TaskQuery) Limit

func (tq *TaskQuery) Limit(limit int) *TaskQuery

Limit the number of records to be returned by this query.

func (*TaskQuery) Offset

func (tq *TaskQuery) Offset(offset int) *TaskQuery

Offset to start from.

func (*TaskQuery) Only

func (tq *TaskQuery) Only(ctx context.Context) (*Task, error)

Only returns a single Task entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Task entity is found. Returns a *NotFoundError when no Task entities are found.

func (*TaskQuery) OnlyID

func (tq *TaskQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Task ID in the query. Returns a *NotSingularError when more than one Task ID is found. Returns a *NotFoundError when no entities are found.

func (*TaskQuery) OnlyIDX

func (tq *TaskQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TaskQuery) OnlyX

func (tq *TaskQuery) OnlyX(ctx context.Context) *Task

OnlyX is like Only, but panics if an error occurs.

func (*TaskQuery) Order

func (tq *TaskQuery) Order(o ...OrderFunc) *TaskQuery

Order specifies how the records should be ordered.

func (*TaskQuery) QueryOwner

func (tq *TaskQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*TaskQuery) QueryTeams

func (tq *TaskQuery) QueryTeams() *TeamQuery

QueryTeams chains the current query on the "teams" edge.

func (*TaskQuery) Select

func (tq *TaskQuery) Select(fields ...string) *TaskSelect

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 {
	Title string `json:"title,omitempty"`
}

client.Task.Query().
	Select(task.FieldTitle).
	Scan(ctx, &v)

func (*TaskQuery) Unique added in v0.8.0

func (tq *TaskQuery) Unique(unique bool) *TaskQuery

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 (*TaskQuery) Where

func (tq *TaskQuery) Where(ps ...predicate.Task) *TaskQuery

Where adds a new predicate for the TaskQuery builder.

func (*TaskQuery) WithOwner

func (tq *TaskQuery) WithOwner(opts ...func(*UserQuery)) *TaskQuery

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 (*TaskQuery) WithTeams

func (tq *TaskQuery) WithTeams(opts ...func(*TeamQuery)) *TaskQuery

WithTeams tells the query-builder to eager-load the nodes that are connected to the "teams" edge. The optional arguments are used to configure the query builder of the edge.

type TaskSelect

type TaskSelect struct {
	*TaskQuery
	// contains filtered or unexported fields
}

TaskSelect is the builder for selecting fields of Task entities.

func (*TaskSelect) Aggregate added in v0.11.4

func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TaskSelect) Bool

func (s *TaskSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TaskSelect) BoolX

func (s *TaskSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TaskSelect) Bools

func (s *TaskSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TaskSelect) BoolsX

func (s *TaskSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TaskSelect) Float64

func (s *TaskSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TaskSelect) Float64X

func (s *TaskSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TaskSelect) Float64s

func (s *TaskSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TaskSelect) Float64sX

func (s *TaskSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TaskSelect) Int

func (s *TaskSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TaskSelect) IntX

func (s *TaskSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TaskSelect) Ints

func (s *TaskSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TaskSelect) IntsX

func (s *TaskSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TaskSelect) Scan

func (ts *TaskSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TaskSelect) ScanX

func (s *TaskSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TaskSelect) String

func (s *TaskSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TaskSelect) StringX

func (s *TaskSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TaskSelect) Strings

func (s *TaskSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TaskSelect) StringsX

func (s *TaskSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TaskUpdate

type TaskUpdate struct {
	// contains filtered or unexported fields
}

TaskUpdate is the builder for updating Task entities.

func (*TaskUpdate) AddTeamIDs

func (tu *TaskUpdate) AddTeamIDs(ids ...int) *TaskUpdate

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*TaskUpdate) AddTeams

func (tu *TaskUpdate) AddTeams(t ...*Team) *TaskUpdate

AddTeams adds the "teams" edges to the Team entity.

func (*TaskUpdate) ClearDescription

func (tu *TaskUpdate) ClearDescription() *TaskUpdate

ClearDescription clears the value of the "description" field.

func (*TaskUpdate) ClearOwner

func (tu *TaskUpdate) ClearOwner() *TaskUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*TaskUpdate) ClearTeams

func (tu *TaskUpdate) ClearTeams() *TaskUpdate

ClearTeams clears all "teams" edges to the Team entity.

func (*TaskUpdate) ClearUUID

func (tu *TaskUpdate) ClearUUID() *TaskUpdate

ClearUUID clears the value of the "uuid" field.

func (*TaskUpdate) Exec

func (tu *TaskUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskUpdate) ExecX

func (tu *TaskUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskUpdate) Mutation

func (tu *TaskUpdate) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskUpdate) RemoveTeamIDs

func (tu *TaskUpdate) RemoveTeamIDs(ids ...int) *TaskUpdate

RemoveTeamIDs removes the "teams" edge to Team entities by IDs.

func (*TaskUpdate) RemoveTeams

func (tu *TaskUpdate) RemoveTeams(t ...*Team) *TaskUpdate

RemoveTeams removes "teams" edges to Team entities.

func (*TaskUpdate) Save

func (tu *TaskUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TaskUpdate) SaveX

func (tu *TaskUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TaskUpdate) SetDescription

func (tu *TaskUpdate) SetDescription(s string) *TaskUpdate

SetDescription sets the "description" field.

func (*TaskUpdate) SetNillableDescription

func (tu *TaskUpdate) SetNillableDescription(s *string) *TaskUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TaskUpdate) SetNillableOwnerID

func (tu *TaskUpdate) SetNillableOwnerID(id *int) *TaskUpdate

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*TaskUpdate) SetNillableStatus

func (tu *TaskUpdate) SetNillableStatus(t *task.Status) *TaskUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TaskUpdate) SetNillableUUID added in v0.10.0

func (tu *TaskUpdate) SetNillableUUID(u *uuid.UUID) *TaskUpdate

SetNillableUUID sets the "uuid" field if the given value is not nil.

func (*TaskUpdate) SetOwner

func (tu *TaskUpdate) SetOwner(u *User) *TaskUpdate

SetOwner sets the "owner" edge to the User entity.

func (*TaskUpdate) SetOwnerID

func (tu *TaskUpdate) SetOwnerID(id int) *TaskUpdate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*TaskUpdate) SetStatus

func (tu *TaskUpdate) SetStatus(t task.Status) *TaskUpdate

SetStatus sets the "status" field.

func (*TaskUpdate) SetTitle

func (tu *TaskUpdate) SetTitle(s string) *TaskUpdate

SetTitle sets the "title" field.

func (*TaskUpdate) SetUUID

func (tu *TaskUpdate) SetUUID(u uuid.UUID) *TaskUpdate

SetUUID sets the "uuid" field.

func (*TaskUpdate) Where

func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate

Where appends a list predicates to the TaskUpdate builder.

type TaskUpdateOne

type TaskUpdateOne struct {
	// contains filtered or unexported fields
}

TaskUpdateOne is the builder for updating a single Task entity.

func (*TaskUpdateOne) AddTeamIDs

func (tuo *TaskUpdateOne) AddTeamIDs(ids ...int) *TaskUpdateOne

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*TaskUpdateOne) AddTeams

func (tuo *TaskUpdateOne) AddTeams(t ...*Team) *TaskUpdateOne

AddTeams adds the "teams" edges to the Team entity.

func (*TaskUpdateOne) ClearDescription

func (tuo *TaskUpdateOne) ClearDescription() *TaskUpdateOne

ClearDescription clears the value of the "description" field.

func (*TaskUpdateOne) ClearOwner

func (tuo *TaskUpdateOne) ClearOwner() *TaskUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*TaskUpdateOne) ClearTeams

func (tuo *TaskUpdateOne) ClearTeams() *TaskUpdateOne

ClearTeams clears all "teams" edges to the Team entity.

func (*TaskUpdateOne) ClearUUID

func (tuo *TaskUpdateOne) ClearUUID() *TaskUpdateOne

ClearUUID clears the value of the "uuid" field.

func (*TaskUpdateOne) Exec

func (tuo *TaskUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TaskUpdateOne) ExecX

func (tuo *TaskUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskUpdateOne) Mutation

func (tuo *TaskUpdateOne) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskUpdateOne) RemoveTeamIDs

func (tuo *TaskUpdateOne) RemoveTeamIDs(ids ...int) *TaskUpdateOne

RemoveTeamIDs removes the "teams" edge to Team entities by IDs.

func (*TaskUpdateOne) RemoveTeams

func (tuo *TaskUpdateOne) RemoveTeams(t ...*Team) *TaskUpdateOne

RemoveTeams removes "teams" edges to Team entities.

func (*TaskUpdateOne) Save

func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error)

Save executes the query and returns the updated Task entity.

func (*TaskUpdateOne) SaveX

func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task

SaveX is like Save, but panics if an error occurs.

func (*TaskUpdateOne) Select added in v0.8.0

func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TaskUpdateOne) SetDescription

func (tuo *TaskUpdateOne) SetDescription(s string) *TaskUpdateOne

SetDescription sets the "description" field.

func (*TaskUpdateOne) SetNillableDescription

func (tuo *TaskUpdateOne) SetNillableDescription(s *string) *TaskUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableOwnerID

func (tuo *TaskUpdateOne) SetNillableOwnerID(id *int) *TaskUpdateOne

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*TaskUpdateOne) SetNillableStatus

func (tuo *TaskUpdateOne) SetNillableStatus(t *task.Status) *TaskUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableUUID added in v0.10.0

func (tuo *TaskUpdateOne) SetNillableUUID(u *uuid.UUID) *TaskUpdateOne

SetNillableUUID sets the "uuid" field if the given value is not nil.

func (*TaskUpdateOne) SetOwner

func (tuo *TaskUpdateOne) SetOwner(u *User) *TaskUpdateOne

SetOwner sets the "owner" edge to the User entity.

func (*TaskUpdateOne) SetOwnerID

func (tuo *TaskUpdateOne) SetOwnerID(id int) *TaskUpdateOne

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*TaskUpdateOne) SetStatus

func (tuo *TaskUpdateOne) SetStatus(t task.Status) *TaskUpdateOne

SetStatus sets the "status" field.

func (*TaskUpdateOne) SetTitle

func (tuo *TaskUpdateOne) SetTitle(s string) *TaskUpdateOne

SetTitle sets the "title" field.

func (*TaskUpdateOne) SetUUID

func (tuo *TaskUpdateOne) SetUUID(u uuid.UUID) *TaskUpdateOne

SetUUID sets the "uuid" field.

func (*TaskUpdateOne) Where added in v0.11.8

func (tuo *TaskUpdateOne) Where(ps ...predicate.Task) *TaskUpdateOne

Where appends a list predicates to the TaskUpdate builder.

type Tasks

type Tasks []*Task

Tasks is a parsable slice of Task.

type Team

type Team struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TeamQuery when eager-loading is set.
	Edges TeamEdges `json:"edges"`
	// contains filtered or unexported fields
}

Team is the model entity for the Team schema.

func (*Team) QueryTasks

func (t *Team) QueryTasks() *TaskQuery

QueryTasks queries the "tasks" edge of the Team entity.

func (*Team) QueryUsers

func (t *Team) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Team entity.

func (*Team) String

func (t *Team) String() string

String implements the fmt.Stringer.

func (*Team) Unwrap

func (t *Team) Unwrap() *Team

Unwrap unwraps the Team 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 (*Team) Update

func (t *Team) Update() *TeamUpdateOne

Update returns a builder for updating this Team. Note that you need to call Team.Unwrap() before calling this method if this Team was returned from a transaction, and the transaction was committed or rolled back.

type TeamClient

type TeamClient struct {
	// contains filtered or unexported fields
}

TeamClient is a client for the Team schema.

func NewTeamClient

func NewTeamClient(c config) *TeamClient

NewTeamClient returns a client for the Team from the given config.

func (*TeamClient) Create

func (c *TeamClient) Create() *TeamCreate

Create returns a builder for creating a Team entity.

func (*TeamClient) CreateBulk

func (c *TeamClient) CreateBulk(builders ...*TeamCreate) *TeamCreateBulk

CreateBulk returns a builder for creating a bulk of Team entities.

func (*TeamClient) Delete

func (c *TeamClient) Delete() *TeamDelete

Delete returns a delete builder for Team.

func (*TeamClient) DeleteOne

func (c *TeamClient) DeleteOne(t *Team) *TeamDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TeamClient) DeleteOneID

func (c *TeamClient) DeleteOneID(id int) *TeamDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*TeamClient) Get

func (c *TeamClient) Get(ctx context.Context, id int) (*Team, error)

Get returns a Team entity by its id.

func (*TeamClient) GetX

func (c *TeamClient) GetX(ctx context.Context, id int) *Team

GetX is like Get, but panics if an error occurs.

func (*TeamClient) Hooks

func (c *TeamClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TeamClient) Intercept added in v0.11.5

func (c *TeamClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `team.Intercept(f(g(h())))`.

func (*TeamClient) Interceptors added in v0.11.5

func (c *TeamClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*TeamClient) Query

func (c *TeamClient) Query() *TeamQuery

Query returns a query builder for Team.

func (*TeamClient) QueryTasks

func (c *TeamClient) QueryTasks(t *Team) *TaskQuery

QueryTasks queries the tasks edge of a Team.

func (*TeamClient) QueryUsers

func (c *TeamClient) QueryUsers(t *Team) *UserQuery

QueryUsers queries the users edge of a Team.

func (*TeamClient) Update

func (c *TeamClient) Update() *TeamUpdate

Update returns an update builder for Team.

func (*TeamClient) UpdateOne

func (c *TeamClient) UpdateOne(t *Team) *TeamUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TeamClient) UpdateOneID

func (c *TeamClient) UpdateOneID(id int) *TeamUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TeamClient) Use

func (c *TeamClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `team.Hooks(f(g(h())))`.

type TeamCreate

type TeamCreate struct {
	// contains filtered or unexported fields
}

TeamCreate is the builder for creating a Team entity.

func (*TeamCreate) AddTaskIDs

func (tc *TeamCreate) AddTaskIDs(ids ...int) *TeamCreate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TeamCreate) AddTasks

func (tc *TeamCreate) AddTasks(t ...*Task) *TeamCreate

AddTasks adds the "tasks" edges to the Task entity.

func (*TeamCreate) AddUserIDs

func (tc *TeamCreate) AddUserIDs(ids ...int) *TeamCreate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*TeamCreate) AddUsers

func (tc *TeamCreate) AddUsers(u ...*User) *TeamCreate

AddUsers adds the "users" edges to the User entity.

func (*TeamCreate) Exec added in v0.9.0

func (tc *TeamCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TeamCreate) ExecX added in v0.9.0

func (tc *TeamCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TeamCreate) Mutation

func (tc *TeamCreate) Mutation() *TeamMutation

Mutation returns the TeamMutation object of the builder.

func (*TeamCreate) Save

func (tc *TeamCreate) Save(ctx context.Context) (*Team, error)

Save creates the Team in the database.

func (*TeamCreate) SaveX

func (tc *TeamCreate) SaveX(ctx context.Context) *Team

SaveX calls Save and panics if Save returns an error.

func (*TeamCreate) SetName

func (tc *TeamCreate) SetName(s string) *TeamCreate

SetName sets the "name" field.

type TeamCreateBulk

type TeamCreateBulk struct {
	// contains filtered or unexported fields
}

TeamCreateBulk is the builder for creating many Team entities in bulk.

func (*TeamCreateBulk) Exec added in v0.9.0

func (tcb *TeamCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TeamCreateBulk) ExecX added in v0.9.0

func (tcb *TeamCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TeamCreateBulk) Save

func (tcb *TeamCreateBulk) Save(ctx context.Context) ([]*Team, error)

Save creates the Team entities in the database.

func (*TeamCreateBulk) SaveX

func (tcb *TeamCreateBulk) SaveX(ctx context.Context) []*Team

SaveX is like Save, but panics if an error occurs.

type TeamDelete

type TeamDelete struct {
	// contains filtered or unexported fields
}

TeamDelete is the builder for deleting a Team entity.

func (*TeamDelete) Exec

func (td *TeamDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TeamDelete) ExecX

func (td *TeamDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TeamDelete) Where

func (td *TeamDelete) Where(ps ...predicate.Team) *TeamDelete

Where appends a list predicates to the TeamDelete builder.

type TeamDeleteOne

type TeamDeleteOne struct {
	// contains filtered or unexported fields
}

TeamDeleteOne is the builder for deleting a single Team entity.

func (*TeamDeleteOne) Exec

func (tdo *TeamDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TeamDeleteOne) ExecX

func (tdo *TeamDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TeamDeleteOne) Where added in v0.11.7

func (tdo *TeamDeleteOne) Where(ps ...predicate.Team) *TeamDeleteOne

Where appends a list predicates to the TeamDelete builder.

type TeamEdges

type TeamEdges struct {
	// Tasks holds the value of the tasks edge.
	Tasks []*Task `json:"tasks,omitempty"`
	// Users holds the value of the users edge.
	Users []*User `json:"users,omitempty"`
	// contains filtered or unexported fields
}

TeamEdges holds the relations/edges for other nodes in the graph.

func (TeamEdges) TasksOrErr

func (e TeamEdges) TasksOrErr() ([]*Task, error)

TasksOrErr returns the Tasks value or an error if the edge was not loaded in eager-loading.

func (TeamEdges) UsersOrErr

func (e TeamEdges) UsersOrErr() ([]*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading.

type TeamFilter

type TeamFilter struct {
	// contains filtered or unexported fields
}

TeamFilter provides a generic filtering capability at runtime for TeamQuery.

func (*TeamFilter) Where

func (f *TeamFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*TeamFilter) WhereHasTasks

func (f *TeamFilter) WhereHasTasks()

WhereHasTasks applies a predicate to check if query has an edge tasks.

func (*TeamFilter) WhereHasTasksWith

func (f *TeamFilter) WhereHasTasksWith(preds ...predicate.Task)

WhereHasTasksWith applies a predicate to check if query has an edge tasks with a given conditions (other predicates).

func (*TeamFilter) WhereHasUsers

func (f *TeamFilter) WhereHasUsers()

WhereHasUsers applies a predicate to check if query has an edge users.

func (*TeamFilter) WhereHasUsersWith

func (f *TeamFilter) WhereHasUsersWith(preds ...predicate.User)

WhereHasUsersWith applies a predicate to check if query has an edge users with a given conditions (other predicates).

func (*TeamFilter) WhereID

func (f *TeamFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*TeamFilter) WhereName

func (f *TeamFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

type TeamGroupBy

type TeamGroupBy struct {
	// contains filtered or unexported fields
}

TeamGroupBy is the group-by builder for Team entities.

func (*TeamGroupBy) Aggregate

func (tgb *TeamGroupBy) Aggregate(fns ...AggregateFunc) *TeamGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TeamGroupBy) Bool

func (s *TeamGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) BoolX

func (s *TeamGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TeamGroupBy) Bools

func (s *TeamGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) BoolsX

func (s *TeamGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TeamGroupBy) Float64

func (s *TeamGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) Float64X

func (s *TeamGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TeamGroupBy) Float64s

func (s *TeamGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) Float64sX

func (s *TeamGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TeamGroupBy) Int

func (s *TeamGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) IntX

func (s *TeamGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TeamGroupBy) Ints

func (s *TeamGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) IntsX

func (s *TeamGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TeamGroupBy) Scan

func (tgb *TeamGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TeamGroupBy) ScanX

func (s *TeamGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TeamGroupBy) String

func (s *TeamGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) StringX

func (s *TeamGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TeamGroupBy) Strings

func (s *TeamGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TeamGroupBy) StringsX

func (s *TeamGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TeamMutation

type TeamMutation struct {
	// contains filtered or unexported fields
}

TeamMutation represents an operation that mutates the Team nodes in the graph.

func (*TeamMutation) AddField

func (m *TeamMutation) AddField(name string, value ent.Value) error

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 (*TeamMutation) AddTaskIDs

func (m *TeamMutation) AddTaskIDs(ids ...int)

AddTaskIDs adds the "tasks" edge to the Task entity by ids.

func (*TeamMutation) AddUserIDs

func (m *TeamMutation) AddUserIDs(ids ...int)

AddUserIDs adds the "users" edge to the User entity by ids.

func (*TeamMutation) AddedEdges

func (m *TeamMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TeamMutation) AddedField

func (m *TeamMutation) AddedField(name string) (ent.Value, bool)

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 (*TeamMutation) AddedFields

func (m *TeamMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TeamMutation) AddedIDs

func (m *TeamMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TeamMutation) ClearEdge

func (m *TeamMutation) ClearEdge(name string) error

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 (*TeamMutation) ClearField

func (m *TeamMutation) ClearField(name string) error

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 (*TeamMutation) ClearTasks

func (m *TeamMutation) ClearTasks()

ClearTasks clears the "tasks" edge to the Task entity.

func (*TeamMutation) ClearUsers

func (m *TeamMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*TeamMutation) ClearedEdges

func (m *TeamMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TeamMutation) ClearedFields

func (m *TeamMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TeamMutation) Client

func (m TeamMutation) Client() *Client

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 (*TeamMutation) EdgeCleared

func (m *TeamMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TeamMutation) Field

func (m *TeamMutation) Field(name string) (ent.Value, bool)

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 (*TeamMutation) FieldCleared

func (m *TeamMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TeamMutation) Fields

func (m *TeamMutation) Fields() []string

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 (*TeamMutation) Filter

func (m *TeamMutation) Filter() *TeamFilter

Filter returns an entql.Where implementation to apply filters on the TeamMutation builder.

func (*TeamMutation) ID

func (m *TeamMutation) ID() (id int, exists bool)

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 (*TeamMutation) IDs added in v0.10.0

func (m *TeamMutation) IDs(ctx context.Context) ([]int, error)

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 (*TeamMutation) Name

func (m *TeamMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TeamMutation) OldField

func (m *TeamMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*TeamMutation) OldName

func (m *TeamMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Team entity. If the Team 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 (*TeamMutation) Op

func (m *TeamMutation) Op() Op

Op returns the operation name.

func (*TeamMutation) RemoveTaskIDs

func (m *TeamMutation) RemoveTaskIDs(ids ...int)

RemoveTaskIDs removes the "tasks" edge to the Task entity by IDs.

func (*TeamMutation) RemoveUserIDs

func (m *TeamMutation) RemoveUserIDs(ids ...int)

RemoveUserIDs removes the "users" edge to the User entity by IDs.

func (*TeamMutation) RemovedEdges

func (m *TeamMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TeamMutation) RemovedIDs

func (m *TeamMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TeamMutation) RemovedTasksIDs

func (m *TeamMutation) RemovedTasksIDs() (ids []int)

RemovedTasks returns the removed IDs of the "tasks" edge to the Task entity.

func (*TeamMutation) RemovedUsersIDs

func (m *TeamMutation) RemovedUsersIDs() (ids []int)

RemovedUsers returns the removed IDs of the "users" edge to the User entity.

func (*TeamMutation) ResetEdge

func (m *TeamMutation) ResetEdge(name string) error

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 (*TeamMutation) ResetField

func (m *TeamMutation) ResetField(name string) error

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 (*TeamMutation) ResetName

func (m *TeamMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TeamMutation) ResetTasks

func (m *TeamMutation) ResetTasks()

ResetTasks resets all changes to the "tasks" edge.

func (*TeamMutation) ResetUsers

func (m *TeamMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*TeamMutation) SetField

func (m *TeamMutation) SetField(name string, value ent.Value) error

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 (*TeamMutation) SetName

func (m *TeamMutation) SetName(s string)

SetName sets the "name" field.

func (*TeamMutation) SetOp added in v0.11.5

func (m *TeamMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TeamMutation) TasksCleared

func (m *TeamMutation) TasksCleared() bool

TasksCleared reports if the "tasks" edge to the Task entity was cleared.

func (*TeamMutation) TasksIDs

func (m *TeamMutation) TasksIDs() (ids []int)

TasksIDs returns the "tasks" edge IDs in the mutation.

func (TeamMutation) Tx

func (m TeamMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TeamMutation) Type

func (m *TeamMutation) Type() string

Type returns the node type of this mutation (Team).

func (*TeamMutation) UsersCleared

func (m *TeamMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*TeamMutation) UsersIDs

func (m *TeamMutation) UsersIDs() (ids []int)

UsersIDs returns the "users" edge IDs in the mutation.

func (*TeamMutation) Where added in v0.9.0

func (m *TeamMutation) Where(ps ...predicate.Team)

Where appends a list predicates to the TeamMutation builder.

func (*TeamMutation) WhereP added in v0.11.5

func (m *TeamMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TeamMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TeamQuery

type TeamQuery struct {
	// contains filtered or unexported fields
}

TeamQuery is the builder for querying Team entities.

func (*TeamQuery) Aggregate added in v0.11.4

func (tq *TeamQuery) Aggregate(fns ...AggregateFunc) *TeamSelect

Aggregate returns a TeamSelect configured with the given aggregations.

func (*TeamQuery) All

func (tq *TeamQuery) All(ctx context.Context) ([]*Team, error)

All executes the query and returns a list of Teams.

func (*TeamQuery) AllX

func (tq *TeamQuery) AllX(ctx context.Context) []*Team

AllX is like All, but panics if an error occurs.

func (*TeamQuery) Clone

func (tq *TeamQuery) Clone() *TeamQuery

Clone returns a duplicate of the TeamQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TeamQuery) Count

func (tq *TeamQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TeamQuery) CountX

func (tq *TeamQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TeamQuery) Exist

func (tq *TeamQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TeamQuery) ExistX

func (tq *TeamQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TeamQuery) Filter

func (tq *TeamQuery) Filter() *TeamFilter

Filter returns a Filter implementation to apply filters on the TeamQuery builder.

func (*TeamQuery) First

func (tq *TeamQuery) First(ctx context.Context) (*Team, error)

First returns the first Team entity from the query. Returns a *NotFoundError when no Team was found.

func (*TeamQuery) FirstID

func (tq *TeamQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Team ID from the query. Returns a *NotFoundError when no Team ID was found.

func (*TeamQuery) FirstIDX

func (tq *TeamQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TeamQuery) FirstX

func (tq *TeamQuery) FirstX(ctx context.Context) *Team

FirstX is like First, but panics if an error occurs.

func (*TeamQuery) GroupBy

func (tq *TeamQuery) GroupBy(field string, fields ...string) *TeamGroupBy

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 {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Team.Query().
	GroupBy(team.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TeamQuery) IDs

func (tq *TeamQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Team IDs.

func (*TeamQuery) IDsX

func (tq *TeamQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TeamQuery) Limit

func (tq *TeamQuery) Limit(limit int) *TeamQuery

Limit the number of records to be returned by this query.

func (*TeamQuery) Offset

func (tq *TeamQuery) Offset(offset int) *TeamQuery

Offset to start from.

func (*TeamQuery) Only

func (tq *TeamQuery) Only(ctx context.Context) (*Team, error)

Only returns a single Team entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Team entity is found. Returns a *NotFoundError when no Team entities are found.

func (*TeamQuery) OnlyID

func (tq *TeamQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Team ID in the query. Returns a *NotSingularError when more than one Team ID is found. Returns a *NotFoundError when no entities are found.

func (*TeamQuery) OnlyIDX

func (tq *TeamQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TeamQuery) OnlyX

func (tq *TeamQuery) OnlyX(ctx context.Context) *Team

OnlyX is like Only, but panics if an error occurs.

func (*TeamQuery) Order

func (tq *TeamQuery) Order(o ...OrderFunc) *TeamQuery

Order specifies how the records should be ordered.

func (*TeamQuery) QueryTasks

func (tq *TeamQuery) QueryTasks() *TaskQuery

QueryTasks chains the current query on the "tasks" edge.

func (*TeamQuery) QueryUsers

func (tq *TeamQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*TeamQuery) Select

func (tq *TeamQuery) Select(fields ...string) *TeamSelect

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 {
	Name string `json:"name,omitempty"`
}

client.Team.Query().
	Select(team.FieldName).
	Scan(ctx, &v)

func (*TeamQuery) Unique added in v0.8.0

func (tq *TeamQuery) Unique(unique bool) *TeamQuery

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 (*TeamQuery) Where

func (tq *TeamQuery) Where(ps ...predicate.Team) *TeamQuery

Where adds a new predicate for the TeamQuery builder.

func (*TeamQuery) WithTasks

func (tq *TeamQuery) WithTasks(opts ...func(*TaskQuery)) *TeamQuery

WithTasks tells the query-builder to eager-load the nodes that are connected to the "tasks" edge. The optional arguments are used to configure the query builder of the edge.

func (*TeamQuery) WithUsers

func (tq *TeamQuery) WithUsers(opts ...func(*UserQuery)) *TeamQuery

WithUsers tells the query-builder to eager-load the nodes that are connected to the "users" edge. The optional arguments are used to configure the query builder of the edge.

type TeamSelect

type TeamSelect struct {
	*TeamQuery
	// contains filtered or unexported fields
}

TeamSelect is the builder for selecting fields of Team entities.

func (*TeamSelect) Aggregate added in v0.11.4

func (ts *TeamSelect) Aggregate(fns ...AggregateFunc) *TeamSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TeamSelect) Bool

func (s *TeamSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TeamSelect) BoolX

func (s *TeamSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TeamSelect) Bools

func (s *TeamSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TeamSelect) BoolsX

func (s *TeamSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TeamSelect) Float64

func (s *TeamSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TeamSelect) Float64X

func (s *TeamSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TeamSelect) Float64s

func (s *TeamSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TeamSelect) Float64sX

func (s *TeamSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TeamSelect) Int

func (s *TeamSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TeamSelect) IntX

func (s *TeamSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TeamSelect) Ints

func (s *TeamSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TeamSelect) IntsX

func (s *TeamSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TeamSelect) Scan

func (ts *TeamSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TeamSelect) ScanX

func (s *TeamSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TeamSelect) String

func (s *TeamSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TeamSelect) StringX

func (s *TeamSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TeamSelect) Strings

func (s *TeamSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TeamSelect) StringsX

func (s *TeamSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TeamUpdate

type TeamUpdate struct {
	// contains filtered or unexported fields
}

TeamUpdate is the builder for updating Team entities.

func (*TeamUpdate) AddTaskIDs

func (tu *TeamUpdate) AddTaskIDs(ids ...int) *TeamUpdate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TeamUpdate) AddTasks

func (tu *TeamUpdate) AddTasks(t ...*Task) *TeamUpdate

AddTasks adds the "tasks" edges to the Task entity.

func (*TeamUpdate) AddUserIDs

func (tu *TeamUpdate) AddUserIDs(ids ...int) *TeamUpdate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*TeamUpdate) AddUsers

func (tu *TeamUpdate) AddUsers(u ...*User) *TeamUpdate

AddUsers adds the "users" edges to the User entity.

func (*TeamUpdate) ClearTasks

func (tu *TeamUpdate) ClearTasks() *TeamUpdate

ClearTasks clears all "tasks" edges to the Task entity.

func (*TeamUpdate) ClearUsers

func (tu *TeamUpdate) ClearUsers() *TeamUpdate

ClearUsers clears all "users" edges to the User entity.

func (*TeamUpdate) Exec

func (tu *TeamUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TeamUpdate) ExecX

func (tu *TeamUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TeamUpdate) Mutation

func (tu *TeamUpdate) Mutation() *TeamMutation

Mutation returns the TeamMutation object of the builder.

func (*TeamUpdate) RemoveTaskIDs

func (tu *TeamUpdate) RemoveTaskIDs(ids ...int) *TeamUpdate

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TeamUpdate) RemoveTasks

func (tu *TeamUpdate) RemoveTasks(t ...*Task) *TeamUpdate

RemoveTasks removes "tasks" edges to Task entities.

func (*TeamUpdate) RemoveUserIDs

func (tu *TeamUpdate) RemoveUserIDs(ids ...int) *TeamUpdate

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*TeamUpdate) RemoveUsers

func (tu *TeamUpdate) RemoveUsers(u ...*User) *TeamUpdate

RemoveUsers removes "users" edges to User entities.

func (*TeamUpdate) Save

func (tu *TeamUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TeamUpdate) SaveX

func (tu *TeamUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TeamUpdate) SetName

func (tu *TeamUpdate) SetName(s string) *TeamUpdate

SetName sets the "name" field.

func (*TeamUpdate) Where

func (tu *TeamUpdate) Where(ps ...predicate.Team) *TeamUpdate

Where appends a list predicates to the TeamUpdate builder.

type TeamUpdateOne

type TeamUpdateOne struct {
	// contains filtered or unexported fields
}

TeamUpdateOne is the builder for updating a single Team entity.

func (*TeamUpdateOne) AddTaskIDs

func (tuo *TeamUpdateOne) AddTaskIDs(ids ...int) *TeamUpdateOne

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TeamUpdateOne) AddTasks

func (tuo *TeamUpdateOne) AddTasks(t ...*Task) *TeamUpdateOne

AddTasks adds the "tasks" edges to the Task entity.

func (*TeamUpdateOne) AddUserIDs

func (tuo *TeamUpdateOne) AddUserIDs(ids ...int) *TeamUpdateOne

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*TeamUpdateOne) AddUsers

func (tuo *TeamUpdateOne) AddUsers(u ...*User) *TeamUpdateOne

AddUsers adds the "users" edges to the User entity.

func (*TeamUpdateOne) ClearTasks

func (tuo *TeamUpdateOne) ClearTasks() *TeamUpdateOne

ClearTasks clears all "tasks" edges to the Task entity.

func (*TeamUpdateOne) ClearUsers

func (tuo *TeamUpdateOne) ClearUsers() *TeamUpdateOne

ClearUsers clears all "users" edges to the User entity.

func (*TeamUpdateOne) Exec

func (tuo *TeamUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TeamUpdateOne) ExecX

func (tuo *TeamUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TeamUpdateOne) Mutation

func (tuo *TeamUpdateOne) Mutation() *TeamMutation

Mutation returns the TeamMutation object of the builder.

func (*TeamUpdateOne) RemoveTaskIDs

func (tuo *TeamUpdateOne) RemoveTaskIDs(ids ...int) *TeamUpdateOne

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TeamUpdateOne) RemoveTasks

func (tuo *TeamUpdateOne) RemoveTasks(t ...*Task) *TeamUpdateOne

RemoveTasks removes "tasks" edges to Task entities.

func (*TeamUpdateOne) RemoveUserIDs

func (tuo *TeamUpdateOne) RemoveUserIDs(ids ...int) *TeamUpdateOne

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*TeamUpdateOne) RemoveUsers

func (tuo *TeamUpdateOne) RemoveUsers(u ...*User) *TeamUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*TeamUpdateOne) Save

func (tuo *TeamUpdateOne) Save(ctx context.Context) (*Team, error)

Save executes the query and returns the updated Team entity.

func (*TeamUpdateOne) SaveX

func (tuo *TeamUpdateOne) SaveX(ctx context.Context) *Team

SaveX is like Save, but panics if an error occurs.

func (*TeamUpdateOne) Select added in v0.8.0

func (tuo *TeamUpdateOne) Select(field string, fields ...string) *TeamUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TeamUpdateOne) SetName

func (tuo *TeamUpdateOne) SetName(s string) *TeamUpdateOne

SetName sets the "name" field.

func (*TeamUpdateOne) Where added in v0.11.8

func (tuo *TeamUpdateOne) Where(ps ...predicate.Team) *TeamUpdateOne

Where appends a list predicates to the TeamUpdate builder.

type Teams

type Teams []*Team

Teams is a parsable slice of Team.

type TraverseFunc added in v0.11.5

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser added in v0.11.5

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// Task is the client for interacting with the Task builders.
	Task *TaskClient
	// Team is the client for interacting with the Team builders.
	Team *TeamClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Age holds the value of the "age" field.
	Age uint `json:"age,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryTasks

func (u *User) QueryTasks() *TaskQuery

QueryTasks queries the "tasks" edge of the User entity.

func (*User) QueryTeams

func (u *User) QueryTeams() *TeamQuery

QueryTeams queries the "teams" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User 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 (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Intercept added in v0.11.5

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors added in v0.11.5

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryTasks

func (c *UserClient) QueryTasks(u *User) *TaskQuery

QueryTasks queries the tasks edge of a User.

func (*UserClient) QueryTeams

func (c *UserClient) QueryTeams(u *User) *TeamQuery

QueryTeams queries the teams edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddTaskIDs

func (uc *UserCreate) AddTaskIDs(ids ...int) *UserCreate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*UserCreate) AddTasks

func (uc *UserCreate) AddTasks(t ...*Task) *UserCreate

AddTasks adds the "tasks" edges to the Task entity.

func (*UserCreate) AddTeamIDs

func (uc *UserCreate) AddTeamIDs(ids ...int) *UserCreate

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*UserCreate) AddTeams

func (uc *UserCreate) AddTeams(t ...*Team) *UserCreate

AddTeams adds the "teams" edges to the Team entity.

func (*UserCreate) Exec added in v0.9.0

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX added in v0.9.0

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAge

func (uc *UserCreate) SetAge(u uint) *UserCreate

SetAge sets the "age" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableAge

func (uc *UserCreate) SetNillableAge(u *uint) *UserCreate

SetNillableAge sets the "age" field if the given value is not nil.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec added in v0.9.0

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX added in v0.9.0

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDeleteOne) Where added in v0.11.7

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Teams holds the value of the teams edge.
	Teams []*Team `json:"teams,omitempty"`
	// Tasks holds the value of the tasks edge.
	Tasks []*Task `json:"tasks,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) TasksOrErr

func (e UserEdges) TasksOrErr() ([]*Task, error)

TasksOrErr returns the Tasks value or an error if the edge was not loaded in eager-loading.

func (UserEdges) TeamsOrErr

func (e UserEdges) TeamsOrErr() ([]*Team, error)

TeamsOrErr returns the Teams value or an error if the edge was not loaded in eager-loading.

type UserFilter

type UserFilter struct {
	// contains filtered or unexported fields
}

UserFilter provides a generic filtering capability at runtime for UserQuery.

func (*UserFilter) Where

func (f *UserFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*UserFilter) WhereAge

func (f *UserFilter) WhereAge(p entql.UintP)

WhereAge applies the entql uint predicate on the age field.

func (*UserFilter) WhereHasTasks

func (f *UserFilter) WhereHasTasks()

WhereHasTasks applies a predicate to check if query has an edge tasks.

func (*UserFilter) WhereHasTasksWith

func (f *UserFilter) WhereHasTasksWith(preds ...predicate.Task)

WhereHasTasksWith applies a predicate to check if query has an edge tasks with a given conditions (other predicates).

func (*UserFilter) WhereHasTeams

func (f *UserFilter) WhereHasTeams()

WhereHasTeams applies a predicate to check if query has an edge teams.

func (*UserFilter) WhereHasTeamsWith

func (f *UserFilter) WhereHasTeamsWith(preds ...predicate.Team)

WhereHasTeamsWith applies a predicate to check if query has an edge teams with a given conditions (other predicates).

func (*UserFilter) WhereID

func (f *UserFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*UserFilter) WhereName

func (f *UserFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddAge

func (m *UserMutation) AddAge(u int)

AddAge adds u to the "age" field.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

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 (*UserMutation) AddTaskIDs

func (m *UserMutation) AddTaskIDs(ids ...int)

AddTaskIDs adds the "tasks" edge to the Task entity by ids.

func (*UserMutation) AddTeamIDs

func (m *UserMutation) AddTeamIDs(ids ...int)

AddTeamIDs adds the "teams" edge to the Team entity by ids.

func (*UserMutation) AddedAge

func (m *UserMutation) AddedAge() (r int, exists bool)

AddedAge returns the value that was added to the "age" field in this mutation.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

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 (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) Age

func (m *UserMutation) Age() (r uint, exists bool)

Age returns the value of the "age" field in the mutation.

func (*UserMutation) AgeCleared

func (m *UserMutation) AgeCleared() bool

AgeCleared returns if the "age" field was cleared in this mutation.

func (*UserMutation) ClearAge

func (m *UserMutation) ClearAge()

ClearAge clears the value of the "age" field.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

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 (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

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 (*UserMutation) ClearTasks

func (m *UserMutation) ClearTasks()

ClearTasks clears the "tasks" edge to the Task entity.

func (*UserMutation) ClearTeams

func (m *UserMutation) ClearTeams()

ClearTeams clears the "teams" edge to the Team entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

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 (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

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 (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

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 (*UserMutation) Filter

func (m *UserMutation) Filter() *UserFilter

Filter returns an entql.Where implementation to apply filters on the UserMutation builder.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

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 (*UserMutation) IDs added in v0.10.0

func (m *UserMutation) IDs(ctx context.Context) ([]int, error)

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 (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldAge

func (m *UserMutation) OldAge(ctx context.Context) (v uint, err error)

OldAge returns the old "age" field's value of the User entity. If the User 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 (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*UserMutation) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveTaskIDs

func (m *UserMutation) RemoveTaskIDs(ids ...int)

RemoveTaskIDs removes the "tasks" edge to the Task entity by IDs.

func (*UserMutation) RemoveTeamIDs

func (m *UserMutation) RemoveTeamIDs(ids ...int)

RemoveTeamIDs removes the "teams" edge to the Team entity by IDs.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedTasksIDs

func (m *UserMutation) RemovedTasksIDs() (ids []int)

RemovedTasks returns the removed IDs of the "tasks" edge to the Task entity.

func (*UserMutation) RemovedTeamsIDs

func (m *UserMutation) RemovedTeamsIDs() (ids []int)

RemovedTeams returns the removed IDs of the "teams" edge to the Team entity.

func (*UserMutation) ResetAge

func (m *UserMutation) ResetAge()

ResetAge resets all changes to the "age" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

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 (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

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 (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetTasks

func (m *UserMutation) ResetTasks()

ResetTasks resets all changes to the "tasks" edge.

func (*UserMutation) ResetTeams

func (m *UserMutation) ResetTeams()

ResetTeams resets all changes to the "teams" edge.

func (*UserMutation) SetAge

func (m *UserMutation) SetAge(u uint)

SetAge sets the "age" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

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 (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp added in v0.11.5

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) TasksCleared

func (m *UserMutation) TasksCleared() bool

TasksCleared reports if the "tasks" edge to the Task entity was cleared.

func (*UserMutation) TasksIDs

func (m *UserMutation) TasksIDs() (ids []int)

TasksIDs returns the "tasks" edge IDs in the mutation.

func (*UserMutation) TeamsCleared

func (m *UserMutation) TeamsCleared() bool

TeamsCleared reports if the "teams" edge to the Team entity was cleared.

func (*UserMutation) TeamsIDs

func (m *UserMutation) TeamsIDs() (ids []int)

TeamsIDs returns the "teams" edge IDs in the mutation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where added in v0.9.0

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP added in v0.11.5

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate added in v0.11.4

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) Filter

func (uq *UserQuery) Filter() *UserFilter

Filter returns a Filter implementation to apply filters on the UserQuery builder.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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 {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryTasks

func (uq *UserQuery) QueryTasks() *TaskQuery

QueryTasks chains the current query on the "tasks" edge.

func (*UserQuery) QueryTeams

func (uq *UserQuery) QueryTeams() *TeamQuery

QueryTeams chains the current query on the "teams" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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 {
	Name string `json:"name,omitempty"`
}

client.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique added in v0.8.0

func (uq *UserQuery) Unique(unique bool) *UserQuery

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 (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithTasks

func (uq *UserQuery) WithTasks(opts ...func(*TaskQuery)) *UserQuery

WithTasks tells the query-builder to eager-load the nodes that are connected to the "tasks" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithTeams

func (uq *UserQuery) WithTeams(opts ...func(*TeamQuery)) *UserQuery

WithTeams tells the query-builder to eager-load the nodes that are connected to the "teams" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate added in v0.11.4

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAge

func (uu *UserUpdate) AddAge(u int) *UserUpdate

AddAge adds u to the "age" field.

func (*UserUpdate) AddTaskIDs

func (uu *UserUpdate) AddTaskIDs(ids ...int) *UserUpdate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*UserUpdate) AddTasks

func (uu *UserUpdate) AddTasks(t ...*Task) *UserUpdate

AddTasks adds the "tasks" edges to the Task entity.

func (*UserUpdate) AddTeamIDs

func (uu *UserUpdate) AddTeamIDs(ids ...int) *UserUpdate

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*UserUpdate) AddTeams

func (uu *UserUpdate) AddTeams(t ...*Team) *UserUpdate

AddTeams adds the "teams" edges to the Team entity.

func (*UserUpdate) ClearAge

func (uu *UserUpdate) ClearAge() *UserUpdate

ClearAge clears the value of the "age" field.

func (*UserUpdate) ClearTasks

func (uu *UserUpdate) ClearTasks() *UserUpdate

ClearTasks clears all "tasks" edges to the Task entity.

func (*UserUpdate) ClearTeams

func (uu *UserUpdate) ClearTeams() *UserUpdate

ClearTeams clears all "teams" edges to the Team entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveTaskIDs

func (uu *UserUpdate) RemoveTaskIDs(ids ...int) *UserUpdate

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*UserUpdate) RemoveTasks

func (uu *UserUpdate) RemoveTasks(t ...*Task) *UserUpdate

RemoveTasks removes "tasks" edges to Task entities.

func (*UserUpdate) RemoveTeamIDs

func (uu *UserUpdate) RemoveTeamIDs(ids ...int) *UserUpdate

RemoveTeamIDs removes the "teams" edge to Team entities by IDs.

func (*UserUpdate) RemoveTeams

func (uu *UserUpdate) RemoveTeams(t ...*Team) *UserUpdate

RemoveTeams removes "teams" edges to Team entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAge

func (uu *UserUpdate) SetAge(u uint) *UserUpdate

SetAge sets the "age" field.

func (*UserUpdate) SetNillableAge

func (uu *UserUpdate) SetNillableAge(u *uint) *UserUpdate

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAge

func (uuo *UserUpdateOne) AddAge(u int) *UserUpdateOne

AddAge adds u to the "age" field.

func (*UserUpdateOne) AddTaskIDs

func (uuo *UserUpdateOne) AddTaskIDs(ids ...int) *UserUpdateOne

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*UserUpdateOne) AddTasks

func (uuo *UserUpdateOne) AddTasks(t ...*Task) *UserUpdateOne

AddTasks adds the "tasks" edges to the Task entity.

func (*UserUpdateOne) AddTeamIDs

func (uuo *UserUpdateOne) AddTeamIDs(ids ...int) *UserUpdateOne

AddTeamIDs adds the "teams" edge to the Team entity by IDs.

func (*UserUpdateOne) AddTeams

func (uuo *UserUpdateOne) AddTeams(t ...*Team) *UserUpdateOne

AddTeams adds the "teams" edges to the Team entity.

func (*UserUpdateOne) ClearAge

func (uuo *UserUpdateOne) ClearAge() *UserUpdateOne

ClearAge clears the value of the "age" field.

func (*UserUpdateOne) ClearTasks

func (uuo *UserUpdateOne) ClearTasks() *UserUpdateOne

ClearTasks clears all "tasks" edges to the Task entity.

func (*UserUpdateOne) ClearTeams

func (uuo *UserUpdateOne) ClearTeams() *UserUpdateOne

ClearTeams clears all "teams" edges to the Team entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveTaskIDs

func (uuo *UserUpdateOne) RemoveTaskIDs(ids ...int) *UserUpdateOne

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*UserUpdateOne) RemoveTasks

func (uuo *UserUpdateOne) RemoveTasks(t ...*Task) *UserUpdateOne

RemoveTasks removes "tasks" edges to Task entities.

func (*UserUpdateOne) RemoveTeamIDs

func (uuo *UserUpdateOne) RemoveTeamIDs(ids ...int) *UserUpdateOne

RemoveTeamIDs removes the "teams" edge to Team entities by IDs.

func (*UserUpdateOne) RemoveTeams

func (uuo *UserUpdateOne) RemoveTeams(t ...*Team) *UserUpdateOne

RemoveTeams removes "teams" edges to Team entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select added in v0.8.0

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAge

func (uuo *UserUpdateOne) SetAge(u uint) *UserUpdateOne

SetAge sets the "age" field.

func (*UserUpdateOne) SetNillableAge

func (uuo *UserUpdateOne) SetNillableAge(u *uint) *UserUpdateOne

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdateOne) Where added in v0.11.8

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL