Documentation
¶
Index ¶
- Constants
- 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
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Task
- type TaskClient
- func (c *TaskClient) Create() *TaskCreate
- func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk
- func (c *TaskClient) Delete() *TaskDelete
- func (c *TaskClient) DeleteOne(t *Task) *TaskDeleteOne
- func (c *TaskClient) DeleteOneID(id string) *TaskDeleteOne
- func (c *TaskClient) Get(ctx context.Context, id string) (*Task, error)
- func (c *TaskClient) GetX(ctx context.Context, id string) *Task
- func (c *TaskClient) Hooks() []Hook
- func (c *TaskClient) Query() *TaskQuery
- func (c *TaskClient) Update() *TaskUpdate
- func (c *TaskClient) UpdateOne(t *Task) *TaskUpdateOne
- func (c *TaskClient) UpdateOneID(id string) *TaskUpdateOne
- func (c *TaskClient) Use(hooks ...Hook)
- type TaskCreate
- func (tc *TaskCreate) Mutation() *TaskMutation
- func (tc *TaskCreate) Save(ctx context.Context) (*Task, error)
- func (tc *TaskCreate) SaveX(ctx context.Context) *Task
- func (tc *TaskCreate) SetCreatedAt(t time.Time) *TaskCreate
- func (tc *TaskCreate) SetID(s string) *TaskCreate
- func (tc *TaskCreate) SetNillableCreatedAt(t *time.Time) *TaskCreate
- func (tc *TaskCreate) SetNillableStatus(t *task.Status) *TaskCreate
- func (tc *TaskCreate) SetNillableUpdatedAt(t *time.Time) *TaskCreate
- func (tc *TaskCreate) SetOwner(s string) *TaskCreate
- func (tc *TaskCreate) SetStatus(t task.Status) *TaskCreate
- func (tc *TaskCreate) SetText(s string) *TaskCreate
- func (tc *TaskCreate) SetUpdatedAt(t time.Time) *TaskCreate
- type TaskCreateBulk
- type TaskDelete
- type TaskDeleteOne
- type TaskGroupBy
- func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy
- func (tgb *TaskGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (tgb *TaskGroupBy) BoolX(ctx context.Context) bool
- func (tgb *TaskGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TaskGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TaskGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (tgb *TaskGroupBy) Float64X(ctx context.Context) float64
- func (tgb *TaskGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TaskGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TaskGroupBy) Int(ctx context.Context) (_ int, err error)
- func (tgb *TaskGroupBy) IntX(ctx context.Context) int
- func (tgb *TaskGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TaskGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TaskGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TaskGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TaskGroupBy) String(ctx context.Context) (_ string, err error)
- func (tgb *TaskGroupBy) StringX(ctx context.Context) string
- func (tgb *TaskGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *TaskGroupBy) StringsX(ctx context.Context) []string
- type TaskMutation
- func (m *TaskMutation) AddField(name string, value ent.Value) error
- func (m *TaskMutation) AddedEdges() []string
- func (m *TaskMutation) AddedField(name string) (ent.Value, bool)
- func (m *TaskMutation) AddedFields() []string
- func (m *TaskMutation) AddedIDs(name string) []ent.Value
- func (m *TaskMutation) ClearEdge(name string) error
- func (m *TaskMutation) ClearField(name string) error
- func (m *TaskMutation) ClearStatus()
- func (m *TaskMutation) ClearedEdges() []string
- func (m *TaskMutation) ClearedFields() []string
- func (m TaskMutation) Client() *Client
- func (m *TaskMutation) CreatedAt() (r time.Time, exists bool)
- func (m *TaskMutation) EdgeCleared(name string) bool
- func (m *TaskMutation) Field(name string) (ent.Value, bool)
- func (m *TaskMutation) FieldCleared(name string) bool
- func (m *TaskMutation) Fields() []string
- func (m *TaskMutation) ID() (id string, exists bool)
- func (m *TaskMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *TaskMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TaskMutation) OldOwner(ctx context.Context) (v string, err error)
- func (m *TaskMutation) OldStatus(ctx context.Context) (v task.Status, err error)
- func (m *TaskMutation) OldText(ctx context.Context) (v string, err error)
- func (m *TaskMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *TaskMutation) Op() Op
- func (m *TaskMutation) Owner() (r string, exists bool)
- func (m *TaskMutation) RemovedEdges() []string
- func (m *TaskMutation) RemovedIDs(name string) []ent.Value
- func (m *TaskMutation) ResetCreatedAt()
- func (m *TaskMutation) ResetEdge(name string) error
- func (m *TaskMutation) ResetField(name string) error
- func (m *TaskMutation) ResetOwner()
- func (m *TaskMutation) ResetStatus()
- func (m *TaskMutation) ResetText()
- func (m *TaskMutation) ResetUpdatedAt()
- func (m *TaskMutation) SetCreatedAt(t time.Time)
- func (m *TaskMutation) SetField(name string, value ent.Value) error
- func (m *TaskMutation) SetID(id string)
- func (m *TaskMutation) SetOwner(s string)
- func (m *TaskMutation) SetStatus(t task.Status)
- func (m *TaskMutation) SetText(s string)
- func (m *TaskMutation) SetUpdatedAt(t time.Time)
- func (m *TaskMutation) Status() (r task.Status, exists bool)
- func (m *TaskMutation) StatusCleared() bool
- func (m *TaskMutation) Text() (r string, exists bool)
- func (m TaskMutation) Tx() (*Tx, error)
- func (m *TaskMutation) Type() string
- func (m *TaskMutation) UpdatedAt() (r time.Time, exists bool)
- type TaskQuery
- func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error)
- func (tq *TaskQuery) AllX(ctx context.Context) []*Task
- func (tq *TaskQuery) Clone() *TaskQuery
- func (tq *TaskQuery) Count(ctx context.Context) (int, error)
- func (tq *TaskQuery) CountX(ctx context.Context) int
- func (tq *TaskQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TaskQuery) ExistX(ctx context.Context) bool
- func (tq *TaskQuery) First(ctx context.Context) (*Task, error)
- func (tq *TaskQuery) FirstID(ctx context.Context) (id string, err error)
- func (tq *TaskQuery) FirstIDX(ctx context.Context) string
- func (tq *TaskQuery) FirstX(ctx context.Context) *Task
- func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy
- func (tq *TaskQuery) IDs(ctx context.Context) ([]string, error)
- func (tq *TaskQuery) IDsX(ctx context.Context) []string
- func (tq *TaskQuery) Limit(limit int) *TaskQuery
- func (tq *TaskQuery) Offset(offset int) *TaskQuery
- func (tq *TaskQuery) Only(ctx context.Context) (*Task, error)
- func (tq *TaskQuery) OnlyID(ctx context.Context) (id string, err error)
- func (tq *TaskQuery) OnlyIDX(ctx context.Context) string
- func (tq *TaskQuery) OnlyX(ctx context.Context) *Task
- func (tq *TaskQuery) Order(o ...OrderFunc) *TaskQuery
- func (tq *TaskQuery) Select(field string, fields ...string) *TaskSelect
- func (tq *TaskQuery) Where(ps ...predicate.Task) *TaskQuery
- type TaskSelect
- func (ts *TaskSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ts *TaskSelect) BoolX(ctx context.Context) bool
- func (ts *TaskSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TaskSelect) BoolsX(ctx context.Context) []bool
- func (ts *TaskSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ts *TaskSelect) Float64X(ctx context.Context) float64
- func (ts *TaskSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TaskSelect) Float64sX(ctx context.Context) []float64
- func (ts *TaskSelect) Int(ctx context.Context) (_ int, err error)
- func (ts *TaskSelect) IntX(ctx context.Context) int
- func (ts *TaskSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TaskSelect) IntsX(ctx context.Context) []int
- func (ts *TaskSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TaskSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TaskSelect) String(ctx context.Context) (_ string, err error)
- func (ts *TaskSelect) StringX(ctx context.Context) string
- func (ts *TaskSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *TaskSelect) StringsX(ctx context.Context) []string
- type TaskUpdate
- func (tu *TaskUpdate) ClearStatus() *TaskUpdate
- func (tu *TaskUpdate) Exec(ctx context.Context) error
- func (tu *TaskUpdate) ExecX(ctx context.Context)
- func (tu *TaskUpdate) Mutation() *TaskMutation
- func (tu *TaskUpdate) Save(ctx context.Context) (int, error)
- func (tu *TaskUpdate) SaveX(ctx context.Context) int
- func (tu *TaskUpdate) SetNillableStatus(t *task.Status) *TaskUpdate
- func (tu *TaskUpdate) SetOwner(s string) *TaskUpdate
- func (tu *TaskUpdate) SetStatus(t task.Status) *TaskUpdate
- func (tu *TaskUpdate) SetText(s string) *TaskUpdate
- func (tu *TaskUpdate) SetUpdatedAt(t time.Time) *TaskUpdate
- func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate
- type TaskUpdateOne
- func (tuo *TaskUpdateOne) ClearStatus() *TaskUpdateOne
- func (tuo *TaskUpdateOne) Exec(ctx context.Context) error
- func (tuo *TaskUpdateOne) ExecX(ctx context.Context)
- func (tuo *TaskUpdateOne) Mutation() *TaskMutation
- func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error)
- func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task
- func (tuo *TaskUpdateOne) SetNillableStatus(t *task.Status) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetOwner(s string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetStatus(t task.Status) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetText(s string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetUpdatedAt(t time.Time) *TaskUpdateOne
- type Tasks
- type Tx
- 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. TypeTask = "Task" )
Variables ¶
This section 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 validaton error.
func NewContext ¶
NewContext returns a new context with the given Client 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(models.As(models.Sum(field1), "sum_field1"), (models.As(models.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 // 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(). Task. Query(). Count(ctx)
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(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 MutateFunc ¶
type MutateFunc = ent.MutateFunc
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 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(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 Rollbacker method.
type Task ¶
type Task struct { // ID of the ent. ID string `json:"id,omitempty"` // Owner holds the value of the "owner" field. Owner string `json:"owner,omitempty"` // Text holds the value of the "text" field. Text string `json:"text,omitempty"` // Status holds the value of the "status" field. Status task.Status `json:"status,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // contains filtered or unexported fields }
Task is the model entity for the Task schema.
func (*Task) Unwrap ¶
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 create builder for Task.
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 delete builder for the given entity.
func (*TaskClient) DeleteOneID ¶
func (c *TaskClient) DeleteOneID(id string) *TaskDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*TaskClient) GetX ¶
func (c *TaskClient) GetX(ctx context.Context, id string) *Task
GetX is like Get, but panics if an error occurs.
func (*TaskClient) Query ¶
func (c *TaskClient) Query() *TaskQuery
Query returns a query builder for 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 string) *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) 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) SetCreatedAt ¶
func (tc *TaskCreate) SetCreatedAt(t time.Time) *TaskCreate
SetCreatedAt sets the "created_at" field.
func (*TaskCreate) SetID ¶
func (tc *TaskCreate) SetID(s string) *TaskCreate
SetID sets the "id" field.
func (*TaskCreate) SetNillableCreatedAt ¶
func (tc *TaskCreate) SetNillableCreatedAt(t *time.Time) *TaskCreate
SetNillableCreatedAt sets the "created_at" field 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) SetNillableUpdatedAt ¶
func (tc *TaskCreate) SetNillableUpdatedAt(t *time.Time) *TaskCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*TaskCreate) SetOwner ¶
func (tc *TaskCreate) SetOwner(s string) *TaskCreate
SetOwner sets the "owner" field.
func (*TaskCreate) SetStatus ¶
func (tc *TaskCreate) SetStatus(t task.Status) *TaskCreate
SetStatus sets the "status" field.
func (*TaskCreate) SetText ¶
func (tc *TaskCreate) SetText(s string) *TaskCreate
SetText sets the "text" field.
func (*TaskCreate) SetUpdatedAt ¶
func (tc *TaskCreate) SetUpdatedAt(t time.Time) *TaskCreate
SetUpdatedAt sets the "updated_at" field.
type TaskCreateBulk ¶
type TaskCreateBulk struct {
// contains filtered or unexported fields
}
TaskCreateBulk is the builder for creating many Task entities in bulk.
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 adds a new predicate 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.
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 (tgb *TaskGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) BoolX ¶
func (tgb *TaskGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TaskGroupBy) Bools ¶
func (tgb *TaskGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) BoolsX ¶
func (tgb *TaskGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TaskGroupBy) Float64 ¶
func (tgb *TaskGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) Float64X ¶
func (tgb *TaskGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TaskGroupBy) Float64s ¶
func (tgb *TaskGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) Float64sX ¶
func (tgb *TaskGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TaskGroupBy) Int ¶
func (tgb *TaskGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) IntX ¶
func (tgb *TaskGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TaskGroupBy) Ints ¶
func (tgb *TaskGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) IntsX ¶
func (tgb *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 interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*TaskGroupBy) ScanX ¶
func (tgb *TaskGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TaskGroupBy) String ¶
func (tgb *TaskGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TaskGroupBy) StringX ¶
func (tgb *TaskGroupBy) StringX(ctx context.Context) string
StringX is like String, 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) 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) 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) ClearStatus ¶
func (m *TaskMutation) ClearStatus()
ClearStatus clears the value of the "status" 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) CreatedAt ¶
func (m *TaskMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the 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) ID ¶
func (m *TaskMutation) ID() (id string, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*TaskMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" 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 ¶
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) OldOwner ¶
func (m *TaskMutation) OldOwner(ctx context.Context) (v string, err error)
OldOwner returns the old "owner" 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) OldStatus ¶
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) OldText ¶
func (m *TaskMutation) OldText(ctx context.Context) (v string, err error)
OldText returns the old "text" 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) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" 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) Owner ¶
func (m *TaskMutation) Owner() (r string, exists bool)
Owner returns the value of the "owner" field in the mutation.
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) ResetCreatedAt ¶
func (m *TaskMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" 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" field.
func (*TaskMutation) ResetStatus ¶
func (m *TaskMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*TaskMutation) ResetText ¶
func (m *TaskMutation) ResetText()
ResetText resets all changes to the "text" field.
func (*TaskMutation) ResetUpdatedAt ¶
func (m *TaskMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*TaskMutation) SetCreatedAt ¶
func (m *TaskMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" 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) SetID ¶
func (m *TaskMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Task entities.
func (*TaskMutation) SetOwner ¶
func (m *TaskMutation) SetOwner(s string)
SetOwner sets the "owner" field.
func (*TaskMutation) SetStatus ¶
func (m *TaskMutation) SetStatus(t task.Status)
SetStatus sets the "status" field.
func (*TaskMutation) SetText ¶
func (m *TaskMutation) SetText(s string)
SetText sets the "text" field.
func (*TaskMutation) SetUpdatedAt ¶
func (m *TaskMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" 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) StatusCleared ¶
func (m *TaskMutation) StatusCleared() bool
StatusCleared returns if the "status" field was cleared in this mutation.
func (*TaskMutation) Text ¶
func (m *TaskMutation) Text() (r string, exists bool)
Text returns the value of the "text" 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).
type TaskQuery ¶
type TaskQuery struct {
// contains filtered or unexported fields
}
TaskQuery is the builder for querying Task entities.
func (*TaskQuery) Clone ¶
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) First ¶
First returns the first Task entity from the query. Returns a *NotFoundError when no Task was found.
func (*TaskQuery) FirstID ¶
FirstID returns the first Task ID from the query. Returns a *NotFoundError when no Task ID was found.
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 { Owner string `json:"owner,omitempty"` Count int `json:"count,omitempty"` } client.Task.Query(). GroupBy(task.FieldOwner). Aggregate(models.Count()). Scan(ctx, &v)
func (*TaskQuery) Only ¶
Only returns a single Task entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Task entity is not found. Returns a *NotFoundError when no Task entities are found.
func (*TaskQuery) OnlyID ¶
OnlyID is like Only, but returns the only Task ID in the query. Returns a *NotSingularError when exactly one Task ID is not found. Returns a *NotFoundError when no entities are found.
func (*TaskQuery) Select ¶
func (tq *TaskQuery) Select(field string, 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 { Owner string `json:"owner,omitempty"` } client.Task.Query(). Select(task.FieldOwner). Scan(ctx, &v)
type TaskSelect ¶
type TaskSelect struct { *TaskQuery // contains filtered or unexported fields }
TaskSelect is the builder for selecting fields of Task entities.
func (*TaskSelect) Bool ¶
func (ts *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 (ts *TaskSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TaskSelect) Bools ¶
func (ts *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 (ts *TaskSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TaskSelect) Float64 ¶
func (ts *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 (ts *TaskSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TaskSelect) Float64s ¶
func (ts *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 (ts *TaskSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TaskSelect) Int ¶
func (ts *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 (ts *TaskSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TaskSelect) Ints ¶
func (ts *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 (ts *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 interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*TaskSelect) ScanX ¶
func (ts *TaskSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TaskSelect) String ¶
func (ts *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 (ts *TaskSelect) StringX(ctx context.Context) string
StringX is like String, 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) ClearStatus ¶
func (tu *TaskUpdate) ClearStatus() *TaskUpdate
ClearStatus clears the value of the "status" 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) 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) SetNillableStatus ¶
func (tu *TaskUpdate) SetNillableStatus(t *task.Status) *TaskUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*TaskUpdate) SetOwner ¶
func (tu *TaskUpdate) SetOwner(s string) *TaskUpdate
SetOwner sets the "owner" field.
func (*TaskUpdate) SetStatus ¶
func (tu *TaskUpdate) SetStatus(t task.Status) *TaskUpdate
SetStatus sets the "status" field.
func (*TaskUpdate) SetText ¶
func (tu *TaskUpdate) SetText(s string) *TaskUpdate
SetText sets the "text" field.
func (*TaskUpdate) SetUpdatedAt ¶
func (tu *TaskUpdate) SetUpdatedAt(t time.Time) *TaskUpdate
SetUpdatedAt sets the "updated_at" field.
func (*TaskUpdate) Where ¶
func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate
Where adds a new predicate for 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) ClearStatus ¶
func (tuo *TaskUpdateOne) ClearStatus() *TaskUpdateOne
ClearStatus clears the value of the "status" 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) 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) SetNillableStatus ¶
func (tuo *TaskUpdateOne) SetNillableStatus(t *task.Status) *TaskUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*TaskUpdateOne) SetOwner ¶
func (tuo *TaskUpdateOne) SetOwner(s string) *TaskUpdateOne
SetOwner sets the "owner" field.
func (*TaskUpdateOne) SetStatus ¶
func (tuo *TaskUpdateOne) SetStatus(t task.Status) *TaskUpdateOne
SetStatus sets the "status" field.
func (*TaskUpdateOne) SetText ¶
func (tuo *TaskUpdateOne) SetText(s string) *TaskUpdateOne
SetText sets the "text" field.
func (*TaskUpdateOne) SetUpdatedAt ¶
func (tuo *TaskUpdateOne) SetUpdatedAt(t time.Time) *TaskUpdateOne
SetUpdatedAt sets the "updated_at" field.
type Tx ¶
type Tx struct { // Task is the client for interacting with the Task builders. Task *TaskClient // 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) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field 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.