Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type CreateTodoInput
- type Cursor
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type PageInfo
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type SchemaConfig
- type Todo
- func (c *Todo) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (n *Todo) IsNode()
- func (c *Todo) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (t *Todo) String() string
- func (t *Todo) ToEdge(order *TodoOrder) *TodoEdge
- func (t *Todo) Unwrap() *Todo
- func (t *Todo) Update() *TodoUpdateOne
- func (t *Todo) Value(name string) (ent.Value, error)
- type TodoClient
- func (c *TodoClient) Create() *TodoCreate
- func (c *TodoClient) CreateBulk(builders ...*TodoCreate) *TodoCreateBulk
- func (c *TodoClient) Delete() *TodoDelete
- func (c *TodoClient) DeleteOne(t *Todo) *TodoDeleteOne
- func (c *TodoClient) DeleteOneID(id int) *TodoDeleteOne
- func (c *TodoClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *TodoClient) Get(ctx context.Context, id int) (*Todo, error)
- func (c *TodoClient) GetX(ctx context.Context, id int) *Todo
- func (c *TodoClient) Hooks() []Hook
- func (c *TodoClient) Intercept(interceptors ...Interceptor)
- func (c *TodoClient) Interceptors() []Interceptor
- func (c *TodoClient) Query() *TodoQuery
- func (c *TodoClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *TodoClient) Update() *TodoUpdate
- func (c *TodoClient) UpdateOne(t *Todo) *TodoUpdateOne
- func (c *TodoClient) UpdateOneID(id int) *TodoUpdateOne
- func (c *TodoClient) Use(hooks ...Hook)
- type TodoConnection
- type TodoCreate
- func (tc *TodoCreate) Exec(ctx context.Context) error
- func (c *TodoCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tc *TodoCreate) ExecX(ctx context.Context)
- func (tc *TodoCreate) Mutation() *TodoMutation
- func (tc *TodoCreate) OnConflict(opts ...sql.ConflictOption) *TodoUpsertOne
- func (tc *TodoCreate) OnConflictColumns(columns ...string) *TodoUpsertOne
- func (c *TodoCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tc *TodoCreate) Save(ctx context.Context) (*Todo, error)
- func (tc *TodoCreate) SaveX(ctx context.Context) *Todo
- func (tc *TodoCreate) SetContent(s string) *TodoCreate
- func (tc *TodoCreate) SetDue(t time.Time) *TodoCreate
- func (c *TodoCreate) SetInput(i CreateTodoInput) *TodoCreate
- func (tc *TodoCreate) SetNillableDue(t *time.Time) *TodoCreate
- func (tc *TodoCreate) SetNillablePriority(t *todo.Priority) *TodoCreate
- func (tc *TodoCreate) SetPriority(t todo.Priority) *TodoCreate
- type TodoCreateBulk
- func (tcb *TodoCreateBulk) Exec(ctx context.Context) error
- func (c *TodoCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tcb *TodoCreateBulk) ExecX(ctx context.Context)
- func (tcb *TodoCreateBulk) OnConflict(opts ...sql.ConflictOption) *TodoUpsertBulk
- func (tcb *TodoCreateBulk) OnConflictColumns(columns ...string) *TodoUpsertBulk
- func (c *TodoCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tcb *TodoCreateBulk) Save(ctx context.Context) ([]*Todo, error)
- func (tcb *TodoCreateBulk) SaveX(ctx context.Context) []*Todo
- type TodoDelete
- func (td *TodoDelete) Exec(ctx context.Context) (int, error)
- func (c *TodoDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (td *TodoDelete) ExecX(ctx context.Context) int
- func (c *TodoDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (td *TodoDelete) Where(ps ...predicate.Todo) *TodoDelete
- type TodoDeleteOne
- type TodoEdge
- type TodoFilter
- func (c *TodoFilter) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *TodoFilter) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (f *TodoFilter) Where(p entql.P)
- func (f *TodoFilter) WhereContent(p entql.StringP)
- func (f *TodoFilter) WhereDue(p entql.TimeP)
- func (f *TodoFilter) WhereID(p entql.IntP)
- func (f *TodoFilter) WherePriority(p entql.StringP)
- type TodoGroupBy
- func (tgb *TodoGroupBy) Aggregate(fns ...AggregateFunc) *TodoGroupBy
- func (s *TodoGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TodoGroupBy) BoolX(ctx context.Context) bool
- func (s *TodoGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TodoGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TodoGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TodoGroupBy) Float64X(ctx context.Context) float64
- func (s *TodoGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TodoGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TodoGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TodoGroupBy) IntX(ctx context.Context) int
- func (s *TodoGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TodoGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TodoGroupBy) Scan(ctx context.Context, v any) error
- func (s *TodoGroupBy) ScanX(ctx context.Context, v any)
- func (s *TodoGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TodoGroupBy) StringX(ctx context.Context) string
- func (s *TodoGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TodoGroupBy) StringsX(ctx context.Context) []string
- type TodoMutation
- func (m *TodoMutation) AddField(name string, value ent.Value) error
- func (m *TodoMutation) AddedEdges() []string
- func (m *TodoMutation) AddedField(name string) (ent.Value, bool)
- func (m *TodoMutation) AddedFields() []string
- func (m *TodoMutation) AddedIDs(name string) []ent.Value
- func (m *TodoMutation) ClearDue()
- func (m *TodoMutation) ClearEdge(name string) error
- func (m *TodoMutation) ClearField(name string) error
- func (m *TodoMutation) ClearedEdges() []string
- func (m *TodoMutation) ClearedFields() []string
- func (m TodoMutation) Client() *Client
- func (m *TodoMutation) Content() (r string, exists bool)
- func (m *TodoMutation) Due() (r time.Time, exists bool)
- func (m *TodoMutation) DueCleared() bool
- func (m *TodoMutation) EdgeCleared(name string) bool
- func (c *TodoMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (m *TodoMutation) Field(name string) (ent.Value, bool)
- func (m *TodoMutation) FieldCleared(name string) bool
- func (m *TodoMutation) Fields() []string
- func (m *TodoMutation) Filter() *TodoFilter
- func (m *TodoMutation) ID() (id int, exists bool)
- func (m *TodoMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TodoMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *TodoMutation) OldDue(ctx context.Context) (v time.Time, err error)
- func (m *TodoMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TodoMutation) OldPriority(ctx context.Context) (v todo.Priority, err error)
- func (m *TodoMutation) Op() Op
- func (m *TodoMutation) Priority() (r todo.Priority, exists bool)
- func (c *TodoMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (m *TodoMutation) RemovedEdges() []string
- func (m *TodoMutation) RemovedIDs(name string) []ent.Value
- func (m *TodoMutation) ResetContent()
- func (m *TodoMutation) ResetDue()
- func (m *TodoMutation) ResetEdge(name string) error
- func (m *TodoMutation) ResetField(name string) error
- func (m *TodoMutation) ResetPriority()
- func (m *TodoMutation) SetContent(s string)
- func (m *TodoMutation) SetDue(t time.Time)
- func (m *TodoMutation) SetField(name string, value ent.Value) error
- func (m *TodoMutation) SetOp(op Op)
- func (m *TodoMutation) SetPriority(t todo.Priority)
- func (m TodoMutation) Tx() (*Tx, error)
- func (m *TodoMutation) Type() string
- func (m *TodoMutation) Where(ps ...predicate.Todo)
- func (m *TodoMutation) WhereP(ps ...func(*sql.Selector))
- type TodoOrder
- type TodoOrderField
- type TodoPaginateOption
- type TodoQuery
- func (tq *TodoQuery) Aggregate(fns ...AggregateFunc) *TodoSelect
- func (tq *TodoQuery) All(ctx context.Context) ([]*Todo, error)
- func (tq *TodoQuery) AllX(ctx context.Context) []*Todo
- func (tq *TodoQuery) Clone() *TodoQuery
- func (t *TodoQuery) CollectFields(ctx context.Context, satisfies ...string) (*TodoQuery, error)
- func (tq *TodoQuery) Count(ctx context.Context) (int, error)
- func (tq *TodoQuery) CountX(ctx context.Context) int
- func (c *TodoQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tq *TodoQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TodoQuery) ExistX(ctx context.Context) bool
- func (tq *TodoQuery) Filter() *TodoFilter
- func (tq *TodoQuery) First(ctx context.Context) (*Todo, error)
- func (tq *TodoQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TodoQuery) FirstIDX(ctx context.Context) int
- func (tq *TodoQuery) FirstX(ctx context.Context) *Todo
- func (tq *TodoQuery) ForShare(opts ...sql.LockOption) *TodoQuery
- func (tq *TodoQuery) ForUpdate(opts ...sql.LockOption) *TodoQuery
- func (tq *TodoQuery) GroupBy(field string, fields ...string) *TodoGroupBy
- func (tq *TodoQuery) IDs(ctx context.Context) (ids []int, err error)
- func (tq *TodoQuery) IDsX(ctx context.Context) []int
- func (tq *TodoQuery) Limit(limit int) *TodoQuery
- func (tq *TodoQuery) Modify(modifiers ...func(s *sql.Selector)) *TodoSelect
- func (tq *TodoQuery) Offset(offset int) *TodoQuery
- func (tq *TodoQuery) Only(ctx context.Context) (*Todo, error)
- func (tq *TodoQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TodoQuery) OnlyIDX(ctx context.Context) int
- func (tq *TodoQuery) OnlyX(ctx context.Context) *Todo
- func (tq *TodoQuery) Order(o ...todo.OrderOption) *TodoQuery
- func (t *TodoQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*TodoConnection, error)
- func (c *TodoQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tq *TodoQuery) Select(fields ...string) *TodoSelect
- func (tq *TodoQuery) Unique(unique bool) *TodoQuery
- func (tq *TodoQuery) Where(ps ...predicate.Todo) *TodoQuery
- type TodoSelect
- func (ts *TodoSelect) Aggregate(fns ...AggregateFunc) *TodoSelect
- func (s *TodoSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TodoSelect) BoolX(ctx context.Context) bool
- func (s *TodoSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TodoSelect) BoolsX(ctx context.Context) []bool
- func (c TodoSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (s *TodoSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TodoSelect) Float64X(ctx context.Context) float64
- func (s *TodoSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TodoSelect) Float64sX(ctx context.Context) []float64
- func (s *TodoSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TodoSelect) IntX(ctx context.Context) int
- func (s *TodoSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TodoSelect) IntsX(ctx context.Context) []int
- func (ts *TodoSelect) Modify(modifiers ...func(s *sql.Selector)) *TodoSelect
- func (c TodoSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ts *TodoSelect) Scan(ctx context.Context, v any) error
- func (s *TodoSelect) ScanX(ctx context.Context, v any)
- func (s *TodoSelect) String(ctx context.Context) (_ string, err error)
- func (s *TodoSelect) StringX(ctx context.Context) string
- func (s *TodoSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TodoSelect) StringsX(ctx context.Context) []string
- type TodoUpdate
- func (tu *TodoUpdate) ClearDue() *TodoUpdate
- func (tu *TodoUpdate) Exec(ctx context.Context) error
- func (c *TodoUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tu *TodoUpdate) ExecX(ctx context.Context)
- func (tu *TodoUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TodoUpdate
- func (tu *TodoUpdate) Mutation() *TodoMutation
- func (c *TodoUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tu *TodoUpdate) Save(ctx context.Context) (int, error)
- func (tu *TodoUpdate) SaveX(ctx context.Context) int
- func (tu *TodoUpdate) SetContent(s string) *TodoUpdate
- func (tu *TodoUpdate) SetDue(t time.Time) *TodoUpdate
- func (c *TodoUpdate) SetInput(i UpdateTodoInput) *TodoUpdate
- func (tu *TodoUpdate) SetNillableDue(t *time.Time) *TodoUpdate
- func (tu *TodoUpdate) SetNillablePriority(t *todo.Priority) *TodoUpdate
- func (tu *TodoUpdate) SetPriority(t todo.Priority) *TodoUpdate
- func (tu *TodoUpdate) Where(ps ...predicate.Todo) *TodoUpdate
- type TodoUpdateOne
- func (tuo *TodoUpdateOne) ClearDue() *TodoUpdateOne
- func (tuo *TodoUpdateOne) Exec(ctx context.Context) error
- func (c *TodoUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tuo *TodoUpdateOne) ExecX(ctx context.Context)
- func (tuo *TodoUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TodoUpdateOne
- func (tuo *TodoUpdateOne) Mutation() *TodoMutation
- func (c *TodoUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tuo *TodoUpdateOne) Save(ctx context.Context) (*Todo, error)
- func (tuo *TodoUpdateOne) SaveX(ctx context.Context) *Todo
- func (tuo *TodoUpdateOne) Select(field string, fields ...string) *TodoUpdateOne
- func (tuo *TodoUpdateOne) SetContent(s string) *TodoUpdateOne
- func (tuo *TodoUpdateOne) SetDue(t time.Time) *TodoUpdateOne
- func (c *TodoUpdateOne) SetInput(i UpdateTodoInput) *TodoUpdateOne
- func (tuo *TodoUpdateOne) SetNillableDue(t *time.Time) *TodoUpdateOne
- func (tuo *TodoUpdateOne) SetNillablePriority(t *todo.Priority) *TodoUpdateOne
- func (tuo *TodoUpdateOne) SetPriority(t todo.Priority) *TodoUpdateOne
- func (tuo *TodoUpdateOne) Where(ps ...predicate.Todo) *TodoUpdateOne
- type TodoUpsert
- func (u *TodoUpsert) ClearDue() *TodoUpsert
- func (u *TodoUpsert) SetContent(v string) *TodoUpsert
- func (u *TodoUpsert) SetDue(v time.Time) *TodoUpsert
- func (u *TodoUpsert) SetPriority(v todo.Priority) *TodoUpsert
- func (u *TodoUpsert) UpdateContent() *TodoUpsert
- func (u *TodoUpsert) UpdateDue() *TodoUpsert
- func (u *TodoUpsert) UpdatePriority() *TodoUpsert
- type TodoUpsertBulk
- func (u *TodoUpsertBulk) ClearDue() *TodoUpsertBulk
- func (u *TodoUpsertBulk) DoNothing() *TodoUpsertBulk
- func (u *TodoUpsertBulk) Exec(ctx context.Context) error
- func (u *TodoUpsertBulk) ExecX(ctx context.Context)
- func (u *TodoUpsertBulk) Ignore() *TodoUpsertBulk
- func (u *TodoUpsertBulk) SetContent(v string) *TodoUpsertBulk
- func (u *TodoUpsertBulk) SetDue(v time.Time) *TodoUpsertBulk
- func (u *TodoUpsertBulk) SetPriority(v todo.Priority) *TodoUpsertBulk
- func (u *TodoUpsertBulk) Update(set func(*TodoUpsert)) *TodoUpsertBulk
- func (u *TodoUpsertBulk) UpdateContent() *TodoUpsertBulk
- func (u *TodoUpsertBulk) UpdateDue() *TodoUpsertBulk
- func (u *TodoUpsertBulk) UpdateNewValues() *TodoUpsertBulk
- func (u *TodoUpsertBulk) UpdatePriority() *TodoUpsertBulk
- type TodoUpsertOne
- func (u *TodoUpsertOne) ClearDue() *TodoUpsertOne
- func (u *TodoUpsertOne) DoNothing() *TodoUpsertOne
- func (u *TodoUpsertOne) Exec(ctx context.Context) error
- func (u *TodoUpsertOne) ExecX(ctx context.Context)
- func (u *TodoUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *TodoUpsertOne) IDX(ctx context.Context) int
- func (u *TodoUpsertOne) Ignore() *TodoUpsertOne
- func (u *TodoUpsertOne) SetContent(v string) *TodoUpsertOne
- func (u *TodoUpsertOne) SetDue(v time.Time) *TodoUpsertOne
- func (u *TodoUpsertOne) SetPriority(v todo.Priority) *TodoUpsertOne
- func (u *TodoUpsertOne) Update(set func(*TodoUpsert)) *TodoUpsertOne
- func (u *TodoUpsertOne) UpdateContent() *TodoUpsertOne
- func (u *TodoUpsertOne) UpdateDue() *TodoUpsertOne
- func (u *TodoUpsertOne) UpdateNewValues() *TodoUpsertOne
- func (u *TodoUpsertOne) UpdatePriority() *TodoUpsertOne
- type TodoWhereInput
- type Todos
- type TraverseFunc
- type Traverser
- type Tx
- func (tx *Tx) Client() *Client
- func (tx *Tx) Commit() error
- func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tx *Tx) OnCommit(f CommitHook)
- func (tx *Tx) OnRollback(f RollbackHook)
- func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tx *Tx) Rollback() error
- type UpdateTodoInput
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeTodo = "Todo" )
Variables ¶
var DefaultTodoOrder = &TodoOrder{ Direction: entgql.OrderDirectionAsc, Field: &TodoOrderField{ Value: func(t *Todo) (ent.Value, error) { return t.ID, nil }, column: todo.FieldID, toTerm: todo.ByID, toCursor: func(t *Todo) Cursor { return Cursor{ID: t.ID} }, }, }
DefaultTodoOrder is the default ordering of Todo.
var ErrEmptyTodoWhereInput = errors.New("ent: empty predicate TodoWhereInput")
ErrEmptyTodoWhereInput is returned in case the TodoWhereInput is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
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 // Todo is the client for interacting with the Todo builders. Todo *TodoClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
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) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Todo. Query(). Count(ctx)
func (*Client) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Client) Intercept ¶
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) Noder ¶
Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.
c.Noder(ctx, id) c.Noder(ctx, id, ent.WithNodeType(typeResolver))
func (*Client) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
func (*Client) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type CommitFunc ¶
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.
type CommitHook ¶
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 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 CreateTodoInput ¶
CreateTodoInput represents a mutation input for creating todos.
func (*CreateTodoInput) Mutate ¶
func (i *CreateTodoInput) Mutate(m *TodoMutation)
Mutate applies the CreateTodoInput on the TodoMutation builder.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
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 NodeOption ¶
type NodeOption func(*nodeOptions)
NodeOption allows configuring the Noder execution using functional options.
func WithFixedNodeType ¶
func WithFixedNodeType(t string) NodeOption
WithFixedNodeType sets the Type of the node to a fixed value.
func WithNodeType ¶
WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.
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 Option ¶
type Option func(*config)
Option function to configure the client.
func AlternateSchema ¶
func AlternateSchema(schemaConfig SchemaConfig) Option
AlternateSchemas allows alternate schema names to be passed into ent operations.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
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.
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 ¶
Rollbacker is the interface that wraps the Rollback method.
type SchemaConfig ¶
type SchemaConfig = internal.SchemaConfig
SchemaConfig represents alternative schema names for all tables that can be passed at runtime.
type Todo ¶
type Todo struct { // ID of the ent. ID int `json:"id,omitempty"` // Content holds the value of the "content" field. Content string `json:"content,omitempty"` // Due holds the value of the "due" field. Due time.Time `json:"due,omitempty"` // Priority holds the value of the "priority" field. Priority todo.Priority `json:"priority,omitempty"` // contains filtered or unexported fields }
Todo is the model entity for the Todo schema.
func (*Todo) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Todo) IsNode ¶
func (n *Todo) IsNode()
IsNode implements the Node interface check for GQLGen.
func (*Todo) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*Todo) Unwrap ¶
Unwrap unwraps the Todo 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 (*Todo) Update ¶
func (t *Todo) Update() *TodoUpdateOne
Update returns a builder for updating this Todo. Note that you need to call Todo.Unwrap() before calling this method if this Todo was returned from a transaction, and the transaction was committed or rolled back.
type TodoClient ¶
type TodoClient struct {
// contains filtered or unexported fields
}
TodoClient is a client for the Todo schema.
func NewTodoClient ¶
func NewTodoClient(c config) *TodoClient
NewTodoClient returns a client for the Todo from the given config.
func (*TodoClient) Create ¶
func (c *TodoClient) Create() *TodoCreate
Create returns a builder for creating a Todo entity.
func (*TodoClient) CreateBulk ¶
func (c *TodoClient) CreateBulk(builders ...*TodoCreate) *TodoCreateBulk
CreateBulk returns a builder for creating a bulk of Todo entities.
func (*TodoClient) Delete ¶
func (c *TodoClient) Delete() *TodoDelete
Delete returns a delete builder for Todo.
func (*TodoClient) DeleteOne ¶
func (c *TodoClient) DeleteOne(t *Todo) *TodoDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TodoClient) DeleteOneID ¶
func (c *TodoClient) DeleteOneID(id int) *TodoDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*TodoClient) ExecContext ¶
func (c *TodoClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoClient) GetX ¶
func (c *TodoClient) GetX(ctx context.Context, id int) *Todo
GetX is like Get, but panics if an error occurs.
func (*TodoClient) Intercept ¶
func (c *TodoClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `todo.Intercept(f(g(h())))`.
func (*TodoClient) Interceptors ¶
func (c *TodoClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*TodoClient) Query ¶
func (c *TodoClient) Query() *TodoQuery
Query returns a query builder for Todo.
func (*TodoClient) QueryContext ¶
func (c *TodoClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoClient) Update ¶
func (c *TodoClient) Update() *TodoUpdate
Update returns an update builder for Todo.
func (*TodoClient) UpdateOne ¶
func (c *TodoClient) UpdateOne(t *Todo) *TodoUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TodoClient) UpdateOneID ¶
func (c *TodoClient) UpdateOneID(id int) *TodoUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TodoClient) Use ¶
func (c *TodoClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `todo.Hooks(f(g(h())))`.
type TodoConnection ¶
type TodoConnection struct { Edges []*TodoEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
TodoConnection is the connection containing edges to Todo.
type TodoCreate ¶
type TodoCreate struct {
// contains filtered or unexported fields
}
TodoCreate is the builder for creating a Todo entity.
func (*TodoCreate) Exec ¶
func (tc *TodoCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*TodoCreate) ExecContext ¶
func (c *TodoCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoCreate) ExecX ¶
func (tc *TodoCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoCreate) Mutation ¶
func (tc *TodoCreate) Mutation() *TodoMutation
Mutation returns the TodoMutation object of the builder.
func (*TodoCreate) OnConflict ¶
func (tc *TodoCreate) OnConflict(opts ...sql.ConflictOption) *TodoUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Todo.Create(). SetContent(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.TodoUpsert) { SetContent(v+v). }). Exec(ctx)
func (*TodoCreate) OnConflictColumns ¶
func (tc *TodoCreate) OnConflictColumns(columns ...string) *TodoUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Todo.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*TodoCreate) QueryContext ¶
func (c *TodoCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoCreate) Save ¶
func (tc *TodoCreate) Save(ctx context.Context) (*Todo, error)
Save creates the Todo in the database.
func (*TodoCreate) SaveX ¶
func (tc *TodoCreate) SaveX(ctx context.Context) *Todo
SaveX calls Save and panics if Save returns an error.
func (*TodoCreate) SetContent ¶
func (tc *TodoCreate) SetContent(s string) *TodoCreate
SetContent sets the "content" field.
func (*TodoCreate) SetDue ¶
func (tc *TodoCreate) SetDue(t time.Time) *TodoCreate
SetDue sets the "due" field.
func (*TodoCreate) SetInput ¶
func (c *TodoCreate) SetInput(i CreateTodoInput) *TodoCreate
SetInput applies the change-set in the CreateTodoInput on the TodoCreate builder.
func (*TodoCreate) SetNillableDue ¶
func (tc *TodoCreate) SetNillableDue(t *time.Time) *TodoCreate
SetNillableDue sets the "due" field if the given value is not nil.
func (*TodoCreate) SetNillablePriority ¶
func (tc *TodoCreate) SetNillablePriority(t *todo.Priority) *TodoCreate
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*TodoCreate) SetPriority ¶
func (tc *TodoCreate) SetPriority(t todo.Priority) *TodoCreate
SetPriority sets the "priority" field.
type TodoCreateBulk ¶
type TodoCreateBulk struct {
// contains filtered or unexported fields
}
TodoCreateBulk is the builder for creating many Todo entities in bulk.
func (*TodoCreateBulk) Exec ¶
func (tcb *TodoCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TodoCreateBulk) ExecContext ¶
func (c *TodoCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoCreateBulk) ExecX ¶
func (tcb *TodoCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoCreateBulk) OnConflict ¶
func (tcb *TodoCreateBulk) OnConflict(opts ...sql.ConflictOption) *TodoUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Todo.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.TodoUpsert) { SetContent(v+v). }). Exec(ctx)
func (*TodoCreateBulk) OnConflictColumns ¶
func (tcb *TodoCreateBulk) OnConflictColumns(columns ...string) *TodoUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Todo.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*TodoCreateBulk) QueryContext ¶
func (c *TodoCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type TodoDelete ¶
type TodoDelete struct {
// contains filtered or unexported fields
}
TodoDelete is the builder for deleting a Todo entity.
func (*TodoDelete) Exec ¶
func (td *TodoDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TodoDelete) ExecContext ¶
func (c *TodoDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoDelete) ExecX ¶
func (td *TodoDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TodoDelete) QueryContext ¶
func (c *TodoDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoDelete) Where ¶
func (td *TodoDelete) Where(ps ...predicate.Todo) *TodoDelete
Where appends a list predicates to the TodoDelete builder.
type TodoDeleteOne ¶
type TodoDeleteOne struct {
// contains filtered or unexported fields
}
TodoDeleteOne is the builder for deleting a single Todo entity.
func (*TodoDeleteOne) Exec ¶
func (tdo *TodoDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TodoDeleteOne) ExecX ¶
func (tdo *TodoDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoDeleteOne) Where ¶
func (tdo *TodoDeleteOne) Where(ps ...predicate.Todo) *TodoDeleteOne
Where appends a list predicates to the TodoDelete builder.
type TodoFilter ¶
type TodoFilter struct {
// contains filtered or unexported fields
}
TodoFilter provides a generic filtering capability at runtime for TodoQuery.
func (*TodoFilter) ExecContext ¶
func (c *TodoFilter) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoFilter) QueryContext ¶
func (c *TodoFilter) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoFilter) Where ¶
func (f *TodoFilter) Where(p entql.P)
Where applies the entql predicate on the query filter.
func (*TodoFilter) WhereContent ¶
func (f *TodoFilter) WhereContent(p entql.StringP)
WhereContent applies the entql string predicate on the content field.
func (*TodoFilter) WhereDue ¶
func (f *TodoFilter) WhereDue(p entql.TimeP)
WhereDue applies the entql time.Time predicate on the due field.
func (*TodoFilter) WhereID ¶
func (f *TodoFilter) WhereID(p entql.IntP)
WhereID applies the entql int predicate on the id field.
func (*TodoFilter) WherePriority ¶
func (f *TodoFilter) WherePriority(p entql.StringP)
WherePriority applies the entql string predicate on the priority field.
type TodoGroupBy ¶
type TodoGroupBy struct {
// contains filtered or unexported fields
}
TodoGroupBy is the group-by builder for Todo entities.
func (*TodoGroupBy) Aggregate ¶
func (tgb *TodoGroupBy) Aggregate(fns ...AggregateFunc) *TodoGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TodoGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TodoGroupBy) Scan ¶
func (tgb *TodoGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TodoGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TodoMutation ¶
type TodoMutation struct {
// contains filtered or unexported fields
}
TodoMutation represents an operation that mutates the Todo nodes in the graph.
func (*TodoMutation) AddField ¶
func (m *TodoMutation) 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 (*TodoMutation) AddedEdges ¶
func (m *TodoMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TodoMutation) AddedField ¶
func (m *TodoMutation) 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 (*TodoMutation) AddedFields ¶
func (m *TodoMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TodoMutation) AddedIDs ¶
func (m *TodoMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TodoMutation) ClearDue ¶
func (m *TodoMutation) ClearDue()
ClearDue clears the value of the "due" field.
func (*TodoMutation) ClearEdge ¶
func (m *TodoMutation) 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 (*TodoMutation) ClearField ¶
func (m *TodoMutation) 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 (*TodoMutation) ClearedEdges ¶
func (m *TodoMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TodoMutation) ClearedFields ¶
func (m *TodoMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TodoMutation) Client ¶
func (m TodoMutation) 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 (*TodoMutation) Content ¶
func (m *TodoMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*TodoMutation) Due ¶
func (m *TodoMutation) Due() (r time.Time, exists bool)
Due returns the value of the "due" field in the mutation.
func (*TodoMutation) DueCleared ¶
func (m *TodoMutation) DueCleared() bool
DueCleared returns if the "due" field was cleared in this mutation.
func (*TodoMutation) EdgeCleared ¶
func (m *TodoMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TodoMutation) ExecContext ¶
func (c *TodoMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoMutation) Field ¶
func (m *TodoMutation) 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 (*TodoMutation) FieldCleared ¶
func (m *TodoMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TodoMutation) Fields ¶
func (m *TodoMutation) 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 (*TodoMutation) Filter ¶
func (m *TodoMutation) Filter() *TodoFilter
Filter returns an entql.Where implementation to apply filters on the TodoMutation builder.
func (*TodoMutation) ID ¶
func (m *TodoMutation) 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 (*TodoMutation) IDs ¶
func (m *TodoMutation) 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 (*TodoMutation) OldContent ¶
func (m *TodoMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Todo entity. If the Todo 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 (*TodoMutation) OldDue ¶
OldDue returns the old "due" field's value of the Todo entity. If the Todo 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 (*TodoMutation) OldField ¶
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 (*TodoMutation) OldPriority ¶
OldPriority returns the old "priority" field's value of the Todo entity. If the Todo 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 (*TodoMutation) Priority ¶
func (m *TodoMutation) Priority() (r todo.Priority, exists bool)
Priority returns the value of the "priority" field in the mutation.
func (*TodoMutation) QueryContext ¶
func (c *TodoMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoMutation) RemovedEdges ¶
func (m *TodoMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TodoMutation) RemovedIDs ¶
func (m *TodoMutation) 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 (*TodoMutation) ResetContent ¶
func (m *TodoMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*TodoMutation) ResetDue ¶
func (m *TodoMutation) ResetDue()
ResetDue resets all changes to the "due" field.
func (*TodoMutation) ResetEdge ¶
func (m *TodoMutation) 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 (*TodoMutation) ResetField ¶
func (m *TodoMutation) 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 (*TodoMutation) ResetPriority ¶
func (m *TodoMutation) ResetPriority()
ResetPriority resets all changes to the "priority" field.
func (*TodoMutation) SetContent ¶
func (m *TodoMutation) SetContent(s string)
SetContent sets the "content" field.
func (*TodoMutation) SetDue ¶
func (m *TodoMutation) SetDue(t time.Time)
SetDue sets the "due" field.
func (*TodoMutation) SetField ¶
func (m *TodoMutation) 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 (*TodoMutation) SetOp ¶
func (m *TodoMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*TodoMutation) SetPriority ¶
func (m *TodoMutation) SetPriority(t todo.Priority)
SetPriority sets the "priority" field.
func (TodoMutation) Tx ¶
func (m TodoMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TodoMutation) Type ¶
func (m *TodoMutation) Type() string
Type returns the node type of this mutation (Todo).
func (*TodoMutation) Where ¶
func (m *TodoMutation) Where(ps ...predicate.Todo)
Where appends a list predicates to the TodoMutation builder.
func (*TodoMutation) WhereP ¶
func (m *TodoMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the TodoMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type TodoOrder ¶
type TodoOrder struct { Direction OrderDirection `json:"direction"` Field *TodoOrderField `json:"field"` }
TodoOrder defines the ordering of Todo.
type TodoOrderField ¶
type TodoOrderField struct { // Value extracts the ordering value from the given Todo. Value func(*Todo) (ent.Value, error) // contains filtered or unexported fields }
TodoOrderField defines the ordering field of Todo.
type TodoPaginateOption ¶
type TodoPaginateOption func(*todoPager) error
TodoPaginateOption enables pagination customization.
func WithTodoFilter ¶
func WithTodoFilter(filter func(*TodoQuery) (*TodoQuery, error)) TodoPaginateOption
WithTodoFilter configures pagination filter.
func WithTodoOrder ¶
func WithTodoOrder(order *TodoOrder) TodoPaginateOption
WithTodoOrder configures pagination ordering.
type TodoQuery ¶
type TodoQuery struct {
// contains filtered or unexported fields
}
TodoQuery is the builder for querying Todo entities.
func (*TodoQuery) Aggregate ¶
func (tq *TodoQuery) Aggregate(fns ...AggregateFunc) *TodoSelect
Aggregate returns a TodoSelect configured with the given aggregations.
func (*TodoQuery) Clone ¶
Clone returns a duplicate of the TodoQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TodoQuery) CollectFields ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*TodoQuery) ExecContext ¶
func (c *TodoQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoQuery) Filter ¶
func (tq *TodoQuery) Filter() *TodoFilter
Filter returns a Filter implementation to apply filters on the TodoQuery builder.
func (*TodoQuery) First ¶
First returns the first Todo entity from the query. Returns a *NotFoundError when no Todo was found.
func (*TodoQuery) FirstID ¶
FirstID returns the first Todo ID from the query. Returns a *NotFoundError when no Todo ID was found.
func (*TodoQuery) ForShare ¶
func (tq *TodoQuery) ForShare(opts ...sql.LockOption) *TodoQuery
ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
func (*TodoQuery) ForUpdate ¶
func (tq *TodoQuery) ForUpdate(opts ...sql.LockOption) *TodoQuery
ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
func (*TodoQuery) GroupBy ¶
func (tq *TodoQuery) GroupBy(field string, fields ...string) *TodoGroupBy
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 { Content string `json:"content,omitempty"` Count int `json:"count,omitempty"` } client.Todo.Query(). GroupBy(todo.FieldContent). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TodoQuery) Modify ¶
func (tq *TodoQuery) Modify(modifiers ...func(s *sql.Selector)) *TodoSelect
Modify adds a query modifier for attaching custom logic to queries.
func (*TodoQuery) Only ¶
Only returns a single Todo entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Todo entity is found. Returns a *NotFoundError when no Todo entities are found.
func (*TodoQuery) OnlyID ¶
OnlyID is like Only, but returns the only Todo ID in the query. Returns a *NotSingularError when more than one Todo ID is found. Returns a *NotFoundError when no entities are found.
func (*TodoQuery) Order ¶
func (tq *TodoQuery) Order(o ...todo.OrderOption) *TodoQuery
Order specifies how the records should be ordered.
func (*TodoQuery) Paginate ¶
func (t *TodoQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...TodoPaginateOption, ) (*TodoConnection, error)
Paginate executes the query and returns a relay based cursor connection to Todo.
func (*TodoQuery) QueryContext ¶
func (c *TodoQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoQuery) Select ¶
func (tq *TodoQuery) Select(fields ...string) *TodoSelect
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 { Content string `json:"content,omitempty"` } client.Todo.Query(). Select(todo.FieldContent). Scan(ctx, &v)
type TodoSelect ¶
type TodoSelect struct { *TodoQuery // contains filtered or unexported fields }
TodoSelect is the builder for selecting fields of Todo entities.
func (*TodoSelect) Aggregate ¶
func (ts *TodoSelect) Aggregate(fns ...AggregateFunc) *TodoSelect
Aggregate adds the given aggregation functions to the selector query.
func (*TodoSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TodoSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (TodoSelect) ExecContext ¶
func (c TodoSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TodoSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TodoSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TodoSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TodoSelect) Modify ¶
func (ts *TodoSelect) Modify(modifiers ...func(s *sql.Selector)) *TodoSelect
Modify adds a query modifier for attaching custom logic to queries.
func (TodoSelect) QueryContext ¶
func (c TodoSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoSelect) Scan ¶
func (ts *TodoSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TodoSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TodoUpdate ¶
type TodoUpdate struct {
// contains filtered or unexported fields
}
TodoUpdate is the builder for updating Todo entities.
func (*TodoUpdate) ClearDue ¶
func (tu *TodoUpdate) ClearDue() *TodoUpdate
ClearDue clears the value of the "due" field.
func (*TodoUpdate) Exec ¶
func (tu *TodoUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TodoUpdate) ExecContext ¶
func (c *TodoUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoUpdate) ExecX ¶
func (tu *TodoUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoUpdate) Modify ¶
func (tu *TodoUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TodoUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*TodoUpdate) Mutation ¶
func (tu *TodoUpdate) Mutation() *TodoMutation
Mutation returns the TodoMutation object of the builder.
func (*TodoUpdate) QueryContext ¶
func (c *TodoUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoUpdate) Save ¶
func (tu *TodoUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*TodoUpdate) SaveX ¶
func (tu *TodoUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TodoUpdate) SetContent ¶
func (tu *TodoUpdate) SetContent(s string) *TodoUpdate
SetContent sets the "content" field.
func (*TodoUpdate) SetDue ¶
func (tu *TodoUpdate) SetDue(t time.Time) *TodoUpdate
SetDue sets the "due" field.
func (*TodoUpdate) SetInput ¶
func (c *TodoUpdate) SetInput(i UpdateTodoInput) *TodoUpdate
SetInput applies the change-set in the UpdateTodoInput on the TodoUpdate builder.
func (*TodoUpdate) SetNillableDue ¶
func (tu *TodoUpdate) SetNillableDue(t *time.Time) *TodoUpdate
SetNillableDue sets the "due" field if the given value is not nil.
func (*TodoUpdate) SetNillablePriority ¶
func (tu *TodoUpdate) SetNillablePriority(t *todo.Priority) *TodoUpdate
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*TodoUpdate) SetPriority ¶
func (tu *TodoUpdate) SetPriority(t todo.Priority) *TodoUpdate
SetPriority sets the "priority" field.
func (*TodoUpdate) Where ¶
func (tu *TodoUpdate) Where(ps ...predicate.Todo) *TodoUpdate
Where appends a list predicates to the TodoUpdate builder.
type TodoUpdateOne ¶
type TodoUpdateOne struct {
// contains filtered or unexported fields
}
TodoUpdateOne is the builder for updating a single Todo entity.
func (*TodoUpdateOne) ClearDue ¶
func (tuo *TodoUpdateOne) ClearDue() *TodoUpdateOne
ClearDue clears the value of the "due" field.
func (*TodoUpdateOne) Exec ¶
func (tuo *TodoUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TodoUpdateOne) ExecContext ¶
func (c *TodoUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*TodoUpdateOne) ExecX ¶
func (tuo *TodoUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoUpdateOne) Modify ¶
func (tuo *TodoUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TodoUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*TodoUpdateOne) Mutation ¶
func (tuo *TodoUpdateOne) Mutation() *TodoMutation
Mutation returns the TodoMutation object of the builder.
func (*TodoUpdateOne) QueryContext ¶
func (c *TodoUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*TodoUpdateOne) Save ¶
func (tuo *TodoUpdateOne) Save(ctx context.Context) (*Todo, error)
Save executes the query and returns the updated Todo entity.
func (*TodoUpdateOne) SaveX ¶
func (tuo *TodoUpdateOne) SaveX(ctx context.Context) *Todo
SaveX is like Save, but panics if an error occurs.
func (*TodoUpdateOne) Select ¶
func (tuo *TodoUpdateOne) Select(field string, fields ...string) *TodoUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TodoUpdateOne) SetContent ¶
func (tuo *TodoUpdateOne) SetContent(s string) *TodoUpdateOne
SetContent sets the "content" field.
func (*TodoUpdateOne) SetDue ¶
func (tuo *TodoUpdateOne) SetDue(t time.Time) *TodoUpdateOne
SetDue sets the "due" field.
func (*TodoUpdateOne) SetInput ¶
func (c *TodoUpdateOne) SetInput(i UpdateTodoInput) *TodoUpdateOne
SetInput applies the change-set in the UpdateTodoInput on the TodoUpdateOne builder.
func (*TodoUpdateOne) SetNillableDue ¶
func (tuo *TodoUpdateOne) SetNillableDue(t *time.Time) *TodoUpdateOne
SetNillableDue sets the "due" field if the given value is not nil.
func (*TodoUpdateOne) SetNillablePriority ¶
func (tuo *TodoUpdateOne) SetNillablePriority(t *todo.Priority) *TodoUpdateOne
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*TodoUpdateOne) SetPriority ¶
func (tuo *TodoUpdateOne) SetPriority(t todo.Priority) *TodoUpdateOne
SetPriority sets the "priority" field.
func (*TodoUpdateOne) Where ¶
func (tuo *TodoUpdateOne) Where(ps ...predicate.Todo) *TodoUpdateOne
Where appends a list predicates to the TodoUpdate builder.
type TodoUpsert ¶
TodoUpsert is the "OnConflict" setter.
func (*TodoUpsert) ClearDue ¶
func (u *TodoUpsert) ClearDue() *TodoUpsert
ClearDue clears the value of the "due" field.
func (*TodoUpsert) SetContent ¶
func (u *TodoUpsert) SetContent(v string) *TodoUpsert
SetContent sets the "content" field.
func (*TodoUpsert) SetDue ¶
func (u *TodoUpsert) SetDue(v time.Time) *TodoUpsert
SetDue sets the "due" field.
func (*TodoUpsert) SetPriority ¶
func (u *TodoUpsert) SetPriority(v todo.Priority) *TodoUpsert
SetPriority sets the "priority" field.
func (*TodoUpsert) UpdateContent ¶
func (u *TodoUpsert) UpdateContent() *TodoUpsert
UpdateContent sets the "content" field to the value that was provided on create.
func (*TodoUpsert) UpdateDue ¶
func (u *TodoUpsert) UpdateDue() *TodoUpsert
UpdateDue sets the "due" field to the value that was provided on create.
func (*TodoUpsert) UpdatePriority ¶
func (u *TodoUpsert) UpdatePriority() *TodoUpsert
UpdatePriority sets the "priority" field to the value that was provided on create.
type TodoUpsertBulk ¶
type TodoUpsertBulk struct {
// contains filtered or unexported fields
}
TodoUpsertBulk is the builder for "upsert"-ing a bulk of Todo nodes.
func (*TodoUpsertBulk) ClearDue ¶
func (u *TodoUpsertBulk) ClearDue() *TodoUpsertBulk
ClearDue clears the value of the "due" field.
func (*TodoUpsertBulk) DoNothing ¶
func (u *TodoUpsertBulk) DoNothing() *TodoUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TodoUpsertBulk) Exec ¶
func (u *TodoUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TodoUpsertBulk) ExecX ¶
func (u *TodoUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoUpsertBulk) Ignore ¶
func (u *TodoUpsertBulk) Ignore() *TodoUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Todo.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*TodoUpsertBulk) SetContent ¶
func (u *TodoUpsertBulk) SetContent(v string) *TodoUpsertBulk
SetContent sets the "content" field.
func (*TodoUpsertBulk) SetDue ¶
func (u *TodoUpsertBulk) SetDue(v time.Time) *TodoUpsertBulk
SetDue sets the "due" field.
func (*TodoUpsertBulk) SetPriority ¶
func (u *TodoUpsertBulk) SetPriority(v todo.Priority) *TodoUpsertBulk
SetPriority sets the "priority" field.
func (*TodoUpsertBulk) Update ¶
func (u *TodoUpsertBulk) Update(set func(*TodoUpsert)) *TodoUpsertBulk
Update allows overriding fields `UPDATE` values. See the TodoCreateBulk.OnConflict documentation for more info.
func (*TodoUpsertBulk) UpdateContent ¶
func (u *TodoUpsertBulk) UpdateContent() *TodoUpsertBulk
UpdateContent sets the "content" field to the value that was provided on create.
func (*TodoUpsertBulk) UpdateDue ¶
func (u *TodoUpsertBulk) UpdateDue() *TodoUpsertBulk
UpdateDue sets the "due" field to the value that was provided on create.
func (*TodoUpsertBulk) UpdateNewValues ¶
func (u *TodoUpsertBulk) UpdateNewValues() *TodoUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Todo.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*TodoUpsertBulk) UpdatePriority ¶
func (u *TodoUpsertBulk) UpdatePriority() *TodoUpsertBulk
UpdatePriority sets the "priority" field to the value that was provided on create.
type TodoUpsertOne ¶
type TodoUpsertOne struct {
// contains filtered or unexported fields
}
TodoUpsertOne is the builder for "upsert"-ing
one Todo node.
func (*TodoUpsertOne) ClearDue ¶
func (u *TodoUpsertOne) ClearDue() *TodoUpsertOne
ClearDue clears the value of the "due" field.
func (*TodoUpsertOne) DoNothing ¶
func (u *TodoUpsertOne) DoNothing() *TodoUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TodoUpsertOne) Exec ¶
func (u *TodoUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*TodoUpsertOne) ExecX ¶
func (u *TodoUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TodoUpsertOne) ID ¶
func (u *TodoUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*TodoUpsertOne) IDX ¶
func (u *TodoUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*TodoUpsertOne) Ignore ¶
func (u *TodoUpsertOne) Ignore() *TodoUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Todo.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*TodoUpsertOne) SetContent ¶
func (u *TodoUpsertOne) SetContent(v string) *TodoUpsertOne
SetContent sets the "content" field.
func (*TodoUpsertOne) SetDue ¶
func (u *TodoUpsertOne) SetDue(v time.Time) *TodoUpsertOne
SetDue sets the "due" field.
func (*TodoUpsertOne) SetPriority ¶
func (u *TodoUpsertOne) SetPriority(v todo.Priority) *TodoUpsertOne
SetPriority sets the "priority" field.
func (*TodoUpsertOne) Update ¶
func (u *TodoUpsertOne) Update(set func(*TodoUpsert)) *TodoUpsertOne
Update allows overriding fields `UPDATE` values. See the TodoCreate.OnConflict documentation for more info.
func (*TodoUpsertOne) UpdateContent ¶
func (u *TodoUpsertOne) UpdateContent() *TodoUpsertOne
UpdateContent sets the "content" field to the value that was provided on create.
func (*TodoUpsertOne) UpdateDue ¶
func (u *TodoUpsertOne) UpdateDue() *TodoUpsertOne
UpdateDue sets the "due" field to the value that was provided on create.
func (*TodoUpsertOne) UpdateNewValues ¶
func (u *TodoUpsertOne) UpdateNewValues() *TodoUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Todo.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*TodoUpsertOne) UpdatePriority ¶
func (u *TodoUpsertOne) UpdatePriority() *TodoUpsertOne
UpdatePriority sets the "priority" field to the value that was provided on create.
type TodoWhereInput ¶
type TodoWhereInput struct { Predicates []predicate.Todo `json:"-"` Not *TodoWhereInput `json:"not,omitempty"` Or []*TodoWhereInput `json:"or,omitempty"` And []*TodoWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` IDNEQ *int `json:"idNEQ,omitempty"` IDIn []int `json:"idIn,omitempty"` IDNotIn []int `json:"idNotIn,omitempty"` IDGT *int `json:"idGT,omitempty"` IDGTE *int `json:"idGTE,omitempty"` IDLT *int `json:"idLT,omitempty"` IDLTE *int `json:"idLTE,omitempty"` // "content" field predicates. Content *string `json:"content,omitempty"` ContentNEQ *string `json:"contentNEQ,omitempty"` ContentIn []string `json:"contentIn,omitempty"` ContentNotIn []string `json:"contentNotIn,omitempty"` ContentGT *string `json:"contentGT,omitempty"` ContentGTE *string `json:"contentGTE,omitempty"` ContentLT *string `json:"contentLT,omitempty"` ContentLTE *string `json:"contentLTE,omitempty"` ContentContains *string `json:"contentContains,omitempty"` ContentHasPrefix *string `json:"contentHasPrefix,omitempty"` ContentHasSuffix *string `json:"contentHasSuffix,omitempty"` ContentEqualFold *string `json:"contentEqualFold,omitempty"` ContentContainsFold *string `json:"contentContainsFold,omitempty"` // "due" field predicates. Due *time.Time `json:"due,omitempty"` DueNEQ *time.Time `json:"dueNEQ,omitempty"` DueIn []time.Time `json:"dueIn,omitempty"` DueNotIn []time.Time `json:"dueNotIn,omitempty"` DueGT *time.Time `json:"dueGT,omitempty"` DueGTE *time.Time `json:"dueGTE,omitempty"` DueLT *time.Time `json:"dueLT,omitempty"` DueLTE *time.Time `json:"dueLTE,omitempty"` DueIsNil bool `json:"dueIsNil,omitempty"` DueNotNil bool `json:"dueNotNil,omitempty"` // "priority" field predicates. Priority *todo.Priority `json:"priority,omitempty"` PriorityNEQ *todo.Priority `json:"priorityNEQ,omitempty"` PriorityIn []todo.Priority `json:"priorityIn,omitempty"` PriorityNotIn []todo.Priority `json:"priorityNotIn,omitempty"` }
TodoWhereInput represents a where input for filtering Todo queries.
func (*TodoWhereInput) AddPredicates ¶
func (i *TodoWhereInput) AddPredicates(predicates ...predicate.Todo)
AddPredicates adds custom predicates to the where input to be used during the filtering phase.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Todo is the client for interacting with the Todo builders. Todo *TodoClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
func (*Tx) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type UpdateTodoInput ¶
type UpdateTodoInput struct { Content *string ClearDue bool Due *time.Time Priority *todo.Priority }
UpdateTodoInput represents a mutation input for updating todos.
func (*UpdateTodoInput) Mutate ¶
func (i *UpdateTodoInput) Mutate(m *TodoMutation)
Mutate applies the UpdateTodoInput on the TodoMutation builder.
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.