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 Echo
- type EchoClient
- func (c *EchoClient) Create() *EchoCreate
- func (c *EchoClient) CreateBulk(builders ...*EchoCreate) *EchoCreateBulk
- func (c *EchoClient) Delete() *EchoDelete
- func (c *EchoClient) DeleteOne(e *Echo) *EchoDeleteOne
- func (c *EchoClient) DeleteOneID(id int) *EchoDeleteOne
- func (c *EchoClient) Get(ctx context.Context, id int) (*Echo, error)
- func (c *EchoClient) GetX(ctx context.Context, id int) *Echo
- func (c *EchoClient) Hooks() []Hook
- func (c *EchoClient) Query() *EchoQuery
- func (c *EchoClient) Update() *EchoUpdate
- func (c *EchoClient) UpdateOne(e *Echo) *EchoUpdateOne
- func (c *EchoClient) UpdateOneID(id int) *EchoUpdateOne
- func (c *EchoClient) Use(hooks ...Hook)
- type EchoCreate
- func (ec *EchoCreate) Exec(ctx context.Context) error
- func (ec *EchoCreate) ExecX(ctx context.Context)
- func (ec *EchoCreate) Mutation() *EchoMutation
- func (ec *EchoCreate) Save(ctx context.Context) (*Echo, error)
- func (ec *EchoCreate) SaveX(ctx context.Context) *Echo
- func (ec *EchoCreate) SetCreateTime(t time.Time) *EchoCreate
- func (ec *EchoCreate) SetDeleteTime(t time.Time) *EchoCreate
- func (ec *EchoCreate) SetDeleted(b bool) *EchoCreate
- func (ec *EchoCreate) SetEchoMessage(s string) *EchoCreate
- func (ec *EchoCreate) SetMessage(s string) *EchoCreate
- func (ec *EchoCreate) SetNillableCreateTime(t *time.Time) *EchoCreate
- func (ec *EchoCreate) SetNillableDeleteTime(t *time.Time) *EchoCreate
- func (ec *EchoCreate) SetNillableDeleted(b *bool) *EchoCreate
- func (ec *EchoCreate) SetNillableUpdateTime(t *time.Time) *EchoCreate
- func (ec *EchoCreate) SetUpdateTime(t time.Time) *EchoCreate
- type EchoCreateBulk
- type EchoDelete
- type EchoDeleteOne
- type EchoGroupBy
- func (egb *EchoGroupBy) Aggregate(fns ...AggregateFunc) *EchoGroupBy
- func (egb *EchoGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (egb *EchoGroupBy) BoolX(ctx context.Context) bool
- func (egb *EchoGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (egb *EchoGroupBy) BoolsX(ctx context.Context) []bool
- func (egb *EchoGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (egb *EchoGroupBy) Float64X(ctx context.Context) float64
- func (egb *EchoGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (egb *EchoGroupBy) Float64sX(ctx context.Context) []float64
- func (egb *EchoGroupBy) Int(ctx context.Context) (_ int, err error)
- func (egb *EchoGroupBy) IntX(ctx context.Context) int
- func (egb *EchoGroupBy) Ints(ctx context.Context) ([]int, error)
- func (egb *EchoGroupBy) IntsX(ctx context.Context) []int
- func (egb *EchoGroupBy) Scan(ctx context.Context, v interface{}) error
- func (egb *EchoGroupBy) ScanX(ctx context.Context, v interface{})
- func (egb *EchoGroupBy) String(ctx context.Context) (_ string, err error)
- func (egb *EchoGroupBy) StringX(ctx context.Context) string
- func (egb *EchoGroupBy) Strings(ctx context.Context) ([]string, error)
- func (egb *EchoGroupBy) StringsX(ctx context.Context) []string
- type EchoMutation
- func (m *EchoMutation) AddField(name string, value ent.Value) error
- func (m *EchoMutation) AddedEdges() []string
- func (m *EchoMutation) AddedField(name string) (ent.Value, bool)
- func (m *EchoMutation) AddedFields() []string
- func (m *EchoMutation) AddedIDs(name string) []ent.Value
- func (m *EchoMutation) ClearDeleteTime()
- func (m *EchoMutation) ClearEdge(name string) error
- func (m *EchoMutation) ClearField(name string) error
- func (m *EchoMutation) ClearUpdateTime()
- func (m *EchoMutation) ClearedEdges() []string
- func (m *EchoMutation) ClearedFields() []string
- func (m EchoMutation) Client() *Client
- func (m *EchoMutation) CreateTime() (r time.Time, exists bool)
- func (m *EchoMutation) DeleteTime() (r time.Time, exists bool)
- func (m *EchoMutation) DeleteTimeCleared() bool
- func (m *EchoMutation) Deleted() (r bool, exists bool)
- func (m *EchoMutation) EchoMessage() (r string, exists bool)
- func (m *EchoMutation) EdgeCleared(name string) bool
- func (m *EchoMutation) Field(name string) (ent.Value, bool)
- func (m *EchoMutation) FieldCleared(name string) bool
- func (m *EchoMutation) Fields() []string
- func (m *EchoMutation) ID() (id int, exists bool)
- func (m *EchoMutation) IDs(ctx context.Context) ([]int, error)
- func (m *EchoMutation) Message() (r string, exists bool)
- func (m *EchoMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)
- func (m *EchoMutation) OldDeleteTime(ctx context.Context) (v *time.Time, err error)
- func (m *EchoMutation) OldDeleted(ctx context.Context) (v bool, err error)
- func (m *EchoMutation) OldEchoMessage(ctx context.Context) (v string, err error)
- func (m *EchoMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *EchoMutation) OldMessage(ctx context.Context) (v string, err error)
- func (m *EchoMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error)
- func (m *EchoMutation) Op() Op
- func (m *EchoMutation) RemovedEdges() []string
- func (m *EchoMutation) RemovedIDs(name string) []ent.Value
- func (m *EchoMutation) ResetCreateTime()
- func (m *EchoMutation) ResetDeleteTime()
- func (m *EchoMutation) ResetDeleted()
- func (m *EchoMutation) ResetEchoMessage()
- func (m *EchoMutation) ResetEdge(name string) error
- func (m *EchoMutation) ResetField(name string) error
- func (m *EchoMutation) ResetMessage()
- func (m *EchoMutation) ResetUpdateTime()
- func (m *EchoMutation) SetCreateTime(t time.Time)
- func (m *EchoMutation) SetDeleteTime(t time.Time)
- func (m *EchoMutation) SetDeleted(b bool)
- func (m *EchoMutation) SetEchoMessage(s string)
- func (m *EchoMutation) SetField(name string, value ent.Value) error
- func (m *EchoMutation) SetMessage(s string)
- func (m *EchoMutation) SetUpdateTime(t time.Time)
- func (m EchoMutation) Tx() (*Tx, error)
- func (m *EchoMutation) Type() string
- func (m *EchoMutation) UpdateTime() (r time.Time, exists bool)
- func (m *EchoMutation) UpdateTimeCleared() bool
- func (m *EchoMutation) Where(ps ...predicate.Echo)
- type EchoQuery
- func (eq *EchoQuery) All(ctx context.Context) ([]*Echo, error)
- func (eq *EchoQuery) AllX(ctx context.Context) []*Echo
- func (eq *EchoQuery) Clone() *EchoQuery
- func (eq *EchoQuery) Count(ctx context.Context) (int, error)
- func (eq *EchoQuery) CountX(ctx context.Context) int
- func (eq *EchoQuery) Exist(ctx context.Context) (bool, error)
- func (eq *EchoQuery) ExistX(ctx context.Context) bool
- func (eq *EchoQuery) First(ctx context.Context) (*Echo, error)
- func (eq *EchoQuery) FirstID(ctx context.Context) (id int, err error)
- func (eq *EchoQuery) FirstIDX(ctx context.Context) int
- func (eq *EchoQuery) FirstX(ctx context.Context) *Echo
- func (eq *EchoQuery) GroupBy(field string, fields ...string) *EchoGroupBy
- func (eq *EchoQuery) IDs(ctx context.Context) ([]int, error)
- func (eq *EchoQuery) IDsX(ctx context.Context) []int
- func (eq *EchoQuery) Limit(limit int) *EchoQuery
- func (eq *EchoQuery) Offset(offset int) *EchoQuery
- func (eq *EchoQuery) Only(ctx context.Context) (*Echo, error)
- func (eq *EchoQuery) OnlyID(ctx context.Context) (id int, err error)
- func (eq *EchoQuery) OnlyIDX(ctx context.Context) int
- func (eq *EchoQuery) OnlyX(ctx context.Context) *Echo
- func (eq *EchoQuery) Order(o ...OrderFunc) *EchoQuery
- func (eq *EchoQuery) Select(fields ...string) *EchoSelect
- func (eq *EchoQuery) Unique(unique bool) *EchoQuery
- func (eq *EchoQuery) Where(ps ...predicate.Echo) *EchoQuery
- type EchoSelect
- func (es *EchoSelect) Bool(ctx context.Context) (_ bool, err error)
- func (es *EchoSelect) BoolX(ctx context.Context) bool
- func (es *EchoSelect) Bools(ctx context.Context) ([]bool, error)
- func (es *EchoSelect) BoolsX(ctx context.Context) []bool
- func (es *EchoSelect) Float64(ctx context.Context) (_ float64, err error)
- func (es *EchoSelect) Float64X(ctx context.Context) float64
- func (es *EchoSelect) Float64s(ctx context.Context) ([]float64, error)
- func (es *EchoSelect) Float64sX(ctx context.Context) []float64
- func (es *EchoSelect) Int(ctx context.Context) (_ int, err error)
- func (es *EchoSelect) IntX(ctx context.Context) int
- func (es *EchoSelect) Ints(ctx context.Context) ([]int, error)
- func (es *EchoSelect) IntsX(ctx context.Context) []int
- func (es *EchoSelect) Scan(ctx context.Context, v interface{}) error
- func (es *EchoSelect) ScanX(ctx context.Context, v interface{})
- func (es *EchoSelect) String(ctx context.Context) (_ string, err error)
- func (es *EchoSelect) StringX(ctx context.Context) string
- func (es *EchoSelect) Strings(ctx context.Context) ([]string, error)
- func (es *EchoSelect) StringsX(ctx context.Context) []string
- type EchoUpdate
- func (eu *EchoUpdate) ClearDeleteTime() *EchoUpdate
- func (eu *EchoUpdate) ClearUpdateTime() *EchoUpdate
- func (eu *EchoUpdate) Exec(ctx context.Context) error
- func (eu *EchoUpdate) ExecX(ctx context.Context)
- func (eu *EchoUpdate) Mutation() *EchoMutation
- func (eu *EchoUpdate) Save(ctx context.Context) (int, error)
- func (eu *EchoUpdate) SaveX(ctx context.Context) int
- func (eu *EchoUpdate) SetCreateTime(t time.Time) *EchoUpdate
- func (eu *EchoUpdate) SetDeleteTime(t time.Time) *EchoUpdate
- func (eu *EchoUpdate) SetDeleted(b bool) *EchoUpdate
- func (eu *EchoUpdate) SetEchoMessage(s string) *EchoUpdate
- func (eu *EchoUpdate) SetMessage(s string) *EchoUpdate
- func (eu *EchoUpdate) SetNillableCreateTime(t *time.Time) *EchoUpdate
- func (eu *EchoUpdate) SetNillableDeleteTime(t *time.Time) *EchoUpdate
- func (eu *EchoUpdate) SetNillableDeleted(b *bool) *EchoUpdate
- func (eu *EchoUpdate) SetNillableUpdateTime(t *time.Time) *EchoUpdate
- func (eu *EchoUpdate) SetUpdateTime(t time.Time) *EchoUpdate
- func (eu *EchoUpdate) Where(ps ...predicate.Echo) *EchoUpdate
- type EchoUpdateOne
- func (euo *EchoUpdateOne) ClearDeleteTime() *EchoUpdateOne
- func (euo *EchoUpdateOne) ClearUpdateTime() *EchoUpdateOne
- func (euo *EchoUpdateOne) Exec(ctx context.Context) error
- func (euo *EchoUpdateOne) ExecX(ctx context.Context)
- func (euo *EchoUpdateOne) Mutation() *EchoMutation
- func (euo *EchoUpdateOne) Save(ctx context.Context) (*Echo, error)
- func (euo *EchoUpdateOne) SaveX(ctx context.Context) *Echo
- func (euo *EchoUpdateOne) Select(field string, fields ...string) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetCreateTime(t time.Time) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetDeleteTime(t time.Time) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetDeleted(b bool) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetEchoMessage(s string) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetMessage(s string) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetNillableCreateTime(t *time.Time) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetNillableDeleteTime(t *time.Time) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetNillableDeleted(b *bool) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetNillableUpdateTime(t *time.Time) *EchoUpdateOne
- func (euo *EchoUpdateOne) SetUpdateTime(t time.Time) *EchoUpdateOne
- type Echos
- 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 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. TypeEcho = "Echo" )
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 validation 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(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 // Echo is the client for interacting with the Echo builders. Echo *EchoClient // 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(). Echo. 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(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 Echo ¶
type Echo struct { // ID of the ent. ID int `json:"id,omitempty"` // Message holds the value of the "message" field. Message string `json:"message,omitempty"` // EchoMessage holds the value of the "echo_message" field. EchoMessage string `json:"echo_message,omitempty"` // Deleted holds the value of the "deleted" field. Deleted bool `json:"deleted,omitempty"` // CreateTime holds the value of the "create_time" field. CreateTime time.Time `json:"create_time,omitempty"` // UpdateTime holds the value of the "update_time" field. UpdateTime *time.Time `json:"update_time,omitempty"` // DeleteTime holds the value of the "delete_time" field. DeleteTime *time.Time `json:"delete_time,omitempty"` // contains filtered or unexported fields }
Echo is the model entity for the Echo schema.
func (*Echo) Unwrap ¶
Unwrap unwraps the Echo 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 (*Echo) Update ¶
func (e *Echo) Update() *EchoUpdateOne
Update returns a builder for updating this Echo. Note that you need to call Echo.Unwrap() before calling this method if this Echo was returned from a transaction, and the transaction was committed or rolled back.
type EchoClient ¶
type EchoClient struct {
// contains filtered or unexported fields
}
EchoClient is a client for the Echo schema.
func NewEchoClient ¶
func NewEchoClient(c config) *EchoClient
NewEchoClient returns a client for the Echo from the given config.
func (*EchoClient) Create ¶
func (c *EchoClient) Create() *EchoCreate
Create returns a create builder for Echo.
func (*EchoClient) CreateBulk ¶
func (c *EchoClient) CreateBulk(builders ...*EchoCreate) *EchoCreateBulk
CreateBulk returns a builder for creating a bulk of Echo entities.
func (*EchoClient) Delete ¶
func (c *EchoClient) Delete() *EchoDelete
Delete returns a delete builder for Echo.
func (*EchoClient) DeleteOne ¶
func (c *EchoClient) DeleteOne(e *Echo) *EchoDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*EchoClient) DeleteOneID ¶
func (c *EchoClient) DeleteOneID(id int) *EchoDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*EchoClient) GetX ¶
func (c *EchoClient) GetX(ctx context.Context, id int) *Echo
GetX is like Get, but panics if an error occurs.
func (*EchoClient) Query ¶
func (c *EchoClient) Query() *EchoQuery
Query returns a query builder for Echo.
func (*EchoClient) Update ¶
func (c *EchoClient) Update() *EchoUpdate
Update returns an update builder for Echo.
func (*EchoClient) UpdateOne ¶
func (c *EchoClient) UpdateOne(e *Echo) *EchoUpdateOne
UpdateOne returns an update builder for the given entity.
func (*EchoClient) UpdateOneID ¶
func (c *EchoClient) UpdateOneID(id int) *EchoUpdateOne
UpdateOneID returns an update builder for the given id.
func (*EchoClient) Use ¶
func (c *EchoClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `echo.Hooks(f(g(h())))`.
type EchoCreate ¶
type EchoCreate struct {
// contains filtered or unexported fields
}
EchoCreate is the builder for creating a Echo entity.
func (*EchoCreate) Exec ¶
func (ec *EchoCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*EchoCreate) ExecX ¶
func (ec *EchoCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EchoCreate) Mutation ¶
func (ec *EchoCreate) Mutation() *EchoMutation
Mutation returns the EchoMutation object of the builder.
func (*EchoCreate) Save ¶
func (ec *EchoCreate) Save(ctx context.Context) (*Echo, error)
Save creates the Echo in the database.
func (*EchoCreate) SaveX ¶
func (ec *EchoCreate) SaveX(ctx context.Context) *Echo
SaveX calls Save and panics if Save returns an error.
func (*EchoCreate) SetCreateTime ¶
func (ec *EchoCreate) SetCreateTime(t time.Time) *EchoCreate
SetCreateTime sets the "create_time" field.
func (*EchoCreate) SetDeleteTime ¶
func (ec *EchoCreate) SetDeleteTime(t time.Time) *EchoCreate
SetDeleteTime sets the "delete_time" field.
func (*EchoCreate) SetDeleted ¶
func (ec *EchoCreate) SetDeleted(b bool) *EchoCreate
SetDeleted sets the "deleted" field.
func (*EchoCreate) SetEchoMessage ¶
func (ec *EchoCreate) SetEchoMessage(s string) *EchoCreate
SetEchoMessage sets the "echo_message" field.
func (*EchoCreate) SetMessage ¶
func (ec *EchoCreate) SetMessage(s string) *EchoCreate
SetMessage sets the "message" field.
func (*EchoCreate) SetNillableCreateTime ¶
func (ec *EchoCreate) SetNillableCreateTime(t *time.Time) *EchoCreate
SetNillableCreateTime sets the "create_time" field if the given value is not nil.
func (*EchoCreate) SetNillableDeleteTime ¶
func (ec *EchoCreate) SetNillableDeleteTime(t *time.Time) *EchoCreate
SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.
func (*EchoCreate) SetNillableDeleted ¶
func (ec *EchoCreate) SetNillableDeleted(b *bool) *EchoCreate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*EchoCreate) SetNillableUpdateTime ¶
func (ec *EchoCreate) SetNillableUpdateTime(t *time.Time) *EchoCreate
SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
func (*EchoCreate) SetUpdateTime ¶
func (ec *EchoCreate) SetUpdateTime(t time.Time) *EchoCreate
SetUpdateTime sets the "update_time" field.
type EchoCreateBulk ¶
type EchoCreateBulk struct {
// contains filtered or unexported fields
}
EchoCreateBulk is the builder for creating many Echo entities in bulk.
func (*EchoCreateBulk) Exec ¶
func (ecb *EchoCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*EchoCreateBulk) ExecX ¶
func (ecb *EchoCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type EchoDelete ¶
type EchoDelete struct {
// contains filtered or unexported fields
}
EchoDelete is the builder for deleting a Echo entity.
func (*EchoDelete) Exec ¶
func (ed *EchoDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*EchoDelete) ExecX ¶
func (ed *EchoDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*EchoDelete) Where ¶
func (ed *EchoDelete) Where(ps ...predicate.Echo) *EchoDelete
Where appends a list predicates to the EchoDelete builder.
type EchoDeleteOne ¶
type EchoDeleteOne struct {
// contains filtered or unexported fields
}
EchoDeleteOne is the builder for deleting a single Echo entity.
func (*EchoDeleteOne) Exec ¶
func (edo *EchoDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*EchoDeleteOne) ExecX ¶
func (edo *EchoDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type EchoGroupBy ¶
type EchoGroupBy struct {
// contains filtered or unexported fields
}
EchoGroupBy is the group-by builder for Echo entities.
func (*EchoGroupBy) Aggregate ¶
func (egb *EchoGroupBy) Aggregate(fns ...AggregateFunc) *EchoGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*EchoGroupBy) Bool ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) BoolX ¶
func (egb *EchoGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*EchoGroupBy) Bools ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) BoolsX ¶
func (egb *EchoGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*EchoGroupBy) Float64 ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) Float64X ¶
func (egb *EchoGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*EchoGroupBy) Float64s ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) Float64sX ¶
func (egb *EchoGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*EchoGroupBy) Int ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) IntX ¶
func (egb *EchoGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*EchoGroupBy) Ints ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) IntsX ¶
func (egb *EchoGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*EchoGroupBy) Scan ¶
func (egb *EchoGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*EchoGroupBy) ScanX ¶
func (egb *EchoGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*EchoGroupBy) String ¶
func (egb *EchoGroupBy) 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 (*EchoGroupBy) StringX ¶
func (egb *EchoGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type EchoMutation ¶
type EchoMutation struct {
// contains filtered or unexported fields
}
EchoMutation represents an operation that mutates the Echo nodes in the graph.
func (*EchoMutation) AddField ¶
func (m *EchoMutation) 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 (*EchoMutation) AddedEdges ¶
func (m *EchoMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*EchoMutation) AddedField ¶
func (m *EchoMutation) 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 (*EchoMutation) AddedFields ¶
func (m *EchoMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*EchoMutation) AddedIDs ¶
func (m *EchoMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*EchoMutation) ClearDeleteTime ¶
func (m *EchoMutation) ClearDeleteTime()
ClearDeleteTime clears the value of the "delete_time" field.
func (*EchoMutation) ClearEdge ¶
func (m *EchoMutation) 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 (*EchoMutation) ClearField ¶
func (m *EchoMutation) 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 (*EchoMutation) ClearUpdateTime ¶
func (m *EchoMutation) ClearUpdateTime()
ClearUpdateTime clears the value of the "update_time" field.
func (*EchoMutation) ClearedEdges ¶
func (m *EchoMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*EchoMutation) ClearedFields ¶
func (m *EchoMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (EchoMutation) Client ¶
func (m EchoMutation) 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 (*EchoMutation) CreateTime ¶
func (m *EchoMutation) CreateTime() (r time.Time, exists bool)
CreateTime returns the value of the "create_time" field in the mutation.
func (*EchoMutation) DeleteTime ¶
func (m *EchoMutation) DeleteTime() (r time.Time, exists bool)
DeleteTime returns the value of the "delete_time" field in the mutation.
func (*EchoMutation) DeleteTimeCleared ¶
func (m *EchoMutation) DeleteTimeCleared() bool
DeleteTimeCleared returns if the "delete_time" field was cleared in this mutation.
func (*EchoMutation) Deleted ¶
func (m *EchoMutation) Deleted() (r bool, exists bool)
Deleted returns the value of the "deleted" field in the mutation.
func (*EchoMutation) EchoMessage ¶
func (m *EchoMutation) EchoMessage() (r string, exists bool)
EchoMessage returns the value of the "echo_message" field in the mutation.
func (*EchoMutation) EdgeCleared ¶
func (m *EchoMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*EchoMutation) Field ¶
func (m *EchoMutation) 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 (*EchoMutation) FieldCleared ¶
func (m *EchoMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*EchoMutation) Fields ¶
func (m *EchoMutation) 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 (*EchoMutation) ID ¶
func (m *EchoMutation) 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 (*EchoMutation) IDs ¶
func (m *EchoMutation) 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 (*EchoMutation) Message ¶
func (m *EchoMutation) Message() (r string, exists bool)
Message returns the value of the "message" field in the mutation.
func (*EchoMutation) OldCreateTime ¶
OldCreateTime returns the old "create_time" field's value of the Echo entity. If the Echo 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 (*EchoMutation) OldDeleteTime ¶
OldDeleteTime returns the old "delete_time" field's value of the Echo entity. If the Echo 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 (*EchoMutation) OldDeleted ¶
func (m *EchoMutation) OldDeleted(ctx context.Context) (v bool, err error)
OldDeleted returns the old "deleted" field's value of the Echo entity. If the Echo 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 (*EchoMutation) OldEchoMessage ¶
func (m *EchoMutation) OldEchoMessage(ctx context.Context) (v string, err error)
OldEchoMessage returns the old "echo_message" field's value of the Echo entity. If the Echo 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 (*EchoMutation) 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 (*EchoMutation) OldMessage ¶
func (m *EchoMutation) OldMessage(ctx context.Context) (v string, err error)
OldMessage returns the old "message" field's value of the Echo entity. If the Echo 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 (*EchoMutation) OldUpdateTime ¶
OldUpdateTime returns the old "update_time" field's value of the Echo entity. If the Echo 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 (*EchoMutation) RemovedEdges ¶
func (m *EchoMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*EchoMutation) RemovedIDs ¶
func (m *EchoMutation) 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 (*EchoMutation) ResetCreateTime ¶
func (m *EchoMutation) ResetCreateTime()
ResetCreateTime resets all changes to the "create_time" field.
func (*EchoMutation) ResetDeleteTime ¶
func (m *EchoMutation) ResetDeleteTime()
ResetDeleteTime resets all changes to the "delete_time" field.
func (*EchoMutation) ResetDeleted ¶
func (m *EchoMutation) ResetDeleted()
ResetDeleted resets all changes to the "deleted" field.
func (*EchoMutation) ResetEchoMessage ¶
func (m *EchoMutation) ResetEchoMessage()
ResetEchoMessage resets all changes to the "echo_message" field.
func (*EchoMutation) ResetEdge ¶
func (m *EchoMutation) 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 (*EchoMutation) ResetField ¶
func (m *EchoMutation) 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 (*EchoMutation) ResetMessage ¶
func (m *EchoMutation) ResetMessage()
ResetMessage resets all changes to the "message" field.
func (*EchoMutation) ResetUpdateTime ¶
func (m *EchoMutation) ResetUpdateTime()
ResetUpdateTime resets all changes to the "update_time" field.
func (*EchoMutation) SetCreateTime ¶
func (m *EchoMutation) SetCreateTime(t time.Time)
SetCreateTime sets the "create_time" field.
func (*EchoMutation) SetDeleteTime ¶
func (m *EchoMutation) SetDeleteTime(t time.Time)
SetDeleteTime sets the "delete_time" field.
func (*EchoMutation) SetDeleted ¶
func (m *EchoMutation) SetDeleted(b bool)
SetDeleted sets the "deleted" field.
func (*EchoMutation) SetEchoMessage ¶
func (m *EchoMutation) SetEchoMessage(s string)
SetEchoMessage sets the "echo_message" field.
func (*EchoMutation) SetField ¶
func (m *EchoMutation) 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 (*EchoMutation) SetMessage ¶
func (m *EchoMutation) SetMessage(s string)
SetMessage sets the "message" field.
func (*EchoMutation) SetUpdateTime ¶
func (m *EchoMutation) SetUpdateTime(t time.Time)
SetUpdateTime sets the "update_time" field.
func (EchoMutation) Tx ¶
func (m EchoMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*EchoMutation) Type ¶
func (m *EchoMutation) Type() string
Type returns the node type of this mutation (Echo).
func (*EchoMutation) UpdateTime ¶
func (m *EchoMutation) UpdateTime() (r time.Time, exists bool)
UpdateTime returns the value of the "update_time" field in the mutation.
func (*EchoMutation) UpdateTimeCleared ¶
func (m *EchoMutation) UpdateTimeCleared() bool
UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (*EchoMutation) Where ¶
func (m *EchoMutation) Where(ps ...predicate.Echo)
Where appends a list predicates to the EchoMutation builder.
type EchoQuery ¶
type EchoQuery struct {
// contains filtered or unexported fields
}
EchoQuery is the builder for querying Echo entities.
func (*EchoQuery) Clone ¶
Clone returns a duplicate of the EchoQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*EchoQuery) First ¶
First returns the first Echo entity from the query. Returns a *NotFoundError when no Echo was found.
func (*EchoQuery) FirstID ¶
FirstID returns the first Echo ID from the query. Returns a *NotFoundError when no Echo ID was found.
func (*EchoQuery) GroupBy ¶
func (eq *EchoQuery) GroupBy(field string, fields ...string) *EchoGroupBy
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 { Message string `json:"message,omitempty"` Count int `json:"count,omitempty"` } client.Echo.Query(). GroupBy(echo.FieldMessage). Aggregate(ent.Count()). Scan(ctx, &v)
func (*EchoQuery) Only ¶
Only returns a single Echo entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Echo entity is not found. Returns a *NotFoundError when no Echo entities are found.
func (*EchoQuery) OnlyID ¶
OnlyID is like Only, but returns the only Echo ID in the query. Returns a *NotSingularError when exactly one Echo ID is not found. Returns a *NotFoundError when no entities are found.
func (*EchoQuery) Select ¶
func (eq *EchoQuery) Select(fields ...string) *EchoSelect
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 { Message string `json:"message,omitempty"` } client.Echo.Query(). Select(echo.FieldMessage). Scan(ctx, &v)
type EchoSelect ¶
type EchoSelect struct { *EchoQuery // contains filtered or unexported fields }
EchoSelect is the builder for selecting fields of Echo entities.
func (*EchoSelect) Bool ¶
func (es *EchoSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EchoSelect) BoolX ¶
func (es *EchoSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*EchoSelect) Bools ¶
func (es *EchoSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EchoSelect) BoolsX ¶
func (es *EchoSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*EchoSelect) Float64 ¶
func (es *EchoSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EchoSelect) Float64X ¶
func (es *EchoSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*EchoSelect) Float64s ¶
func (es *EchoSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EchoSelect) Float64sX ¶
func (es *EchoSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*EchoSelect) Int ¶
func (es *EchoSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EchoSelect) IntX ¶
func (es *EchoSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*EchoSelect) Ints ¶
func (es *EchoSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*EchoSelect) IntsX ¶
func (es *EchoSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*EchoSelect) Scan ¶
func (es *EchoSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*EchoSelect) ScanX ¶
func (es *EchoSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*EchoSelect) String ¶
func (es *EchoSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*EchoSelect) StringX ¶
func (es *EchoSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type EchoUpdate ¶
type EchoUpdate struct {
// contains filtered or unexported fields
}
EchoUpdate is the builder for updating Echo entities.
func (*EchoUpdate) ClearDeleteTime ¶
func (eu *EchoUpdate) ClearDeleteTime() *EchoUpdate
ClearDeleteTime clears the value of the "delete_time" field.
func (*EchoUpdate) ClearUpdateTime ¶
func (eu *EchoUpdate) ClearUpdateTime() *EchoUpdate
ClearUpdateTime clears the value of the "update_time" field.
func (*EchoUpdate) Exec ¶
func (eu *EchoUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*EchoUpdate) ExecX ¶
func (eu *EchoUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EchoUpdate) Mutation ¶
func (eu *EchoUpdate) Mutation() *EchoMutation
Mutation returns the EchoMutation object of the builder.
func (*EchoUpdate) Save ¶
func (eu *EchoUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*EchoUpdate) SaveX ¶
func (eu *EchoUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*EchoUpdate) SetCreateTime ¶
func (eu *EchoUpdate) SetCreateTime(t time.Time) *EchoUpdate
SetCreateTime sets the "create_time" field.
func (*EchoUpdate) SetDeleteTime ¶
func (eu *EchoUpdate) SetDeleteTime(t time.Time) *EchoUpdate
SetDeleteTime sets the "delete_time" field.
func (*EchoUpdate) SetDeleted ¶
func (eu *EchoUpdate) SetDeleted(b bool) *EchoUpdate
SetDeleted sets the "deleted" field.
func (*EchoUpdate) SetEchoMessage ¶
func (eu *EchoUpdate) SetEchoMessage(s string) *EchoUpdate
SetEchoMessage sets the "echo_message" field.
func (*EchoUpdate) SetMessage ¶
func (eu *EchoUpdate) SetMessage(s string) *EchoUpdate
SetMessage sets the "message" field.
func (*EchoUpdate) SetNillableCreateTime ¶
func (eu *EchoUpdate) SetNillableCreateTime(t *time.Time) *EchoUpdate
SetNillableCreateTime sets the "create_time" field if the given value is not nil.
func (*EchoUpdate) SetNillableDeleteTime ¶
func (eu *EchoUpdate) SetNillableDeleteTime(t *time.Time) *EchoUpdate
SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.
func (*EchoUpdate) SetNillableDeleted ¶
func (eu *EchoUpdate) SetNillableDeleted(b *bool) *EchoUpdate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*EchoUpdate) SetNillableUpdateTime ¶
func (eu *EchoUpdate) SetNillableUpdateTime(t *time.Time) *EchoUpdate
SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
func (*EchoUpdate) SetUpdateTime ¶
func (eu *EchoUpdate) SetUpdateTime(t time.Time) *EchoUpdate
SetUpdateTime sets the "update_time" field.
func (*EchoUpdate) Where ¶
func (eu *EchoUpdate) Where(ps ...predicate.Echo) *EchoUpdate
Where appends a list predicates to the EchoUpdate builder.
type EchoUpdateOne ¶
type EchoUpdateOne struct {
// contains filtered or unexported fields
}
EchoUpdateOne is the builder for updating a single Echo entity.
func (*EchoUpdateOne) ClearDeleteTime ¶
func (euo *EchoUpdateOne) ClearDeleteTime() *EchoUpdateOne
ClearDeleteTime clears the value of the "delete_time" field.
func (*EchoUpdateOne) ClearUpdateTime ¶
func (euo *EchoUpdateOne) ClearUpdateTime() *EchoUpdateOne
ClearUpdateTime clears the value of the "update_time" field.
func (*EchoUpdateOne) Exec ¶
func (euo *EchoUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*EchoUpdateOne) ExecX ¶
func (euo *EchoUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EchoUpdateOne) Mutation ¶
func (euo *EchoUpdateOne) Mutation() *EchoMutation
Mutation returns the EchoMutation object of the builder.
func (*EchoUpdateOne) Save ¶
func (euo *EchoUpdateOne) Save(ctx context.Context) (*Echo, error)
Save executes the query and returns the updated Echo entity.
func (*EchoUpdateOne) SaveX ¶
func (euo *EchoUpdateOne) SaveX(ctx context.Context) *Echo
SaveX is like Save, but panics if an error occurs.
func (*EchoUpdateOne) Select ¶
func (euo *EchoUpdateOne) Select(field string, fields ...string) *EchoUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*EchoUpdateOne) SetCreateTime ¶
func (euo *EchoUpdateOne) SetCreateTime(t time.Time) *EchoUpdateOne
SetCreateTime sets the "create_time" field.
func (*EchoUpdateOne) SetDeleteTime ¶
func (euo *EchoUpdateOne) SetDeleteTime(t time.Time) *EchoUpdateOne
SetDeleteTime sets the "delete_time" field.
func (*EchoUpdateOne) SetDeleted ¶
func (euo *EchoUpdateOne) SetDeleted(b bool) *EchoUpdateOne
SetDeleted sets the "deleted" field.
func (*EchoUpdateOne) SetEchoMessage ¶
func (euo *EchoUpdateOne) SetEchoMessage(s string) *EchoUpdateOne
SetEchoMessage sets the "echo_message" field.
func (*EchoUpdateOne) SetMessage ¶
func (euo *EchoUpdateOne) SetMessage(s string) *EchoUpdateOne
SetMessage sets the "message" field.
func (*EchoUpdateOne) SetNillableCreateTime ¶
func (euo *EchoUpdateOne) SetNillableCreateTime(t *time.Time) *EchoUpdateOne
SetNillableCreateTime sets the "create_time" field if the given value is not nil.
func (*EchoUpdateOne) SetNillableDeleteTime ¶
func (euo *EchoUpdateOne) SetNillableDeleteTime(t *time.Time) *EchoUpdateOne
SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.
func (*EchoUpdateOne) SetNillableDeleted ¶
func (euo *EchoUpdateOne) SetNillableDeleted(b *bool) *EchoUpdateOne
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*EchoUpdateOne) SetNillableUpdateTime ¶
func (euo *EchoUpdateOne) SetNillableUpdateTime(t *time.Time) *EchoUpdateOne
SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
func (*EchoUpdateOne) SetUpdateTime ¶
func (euo *EchoUpdateOne) SetUpdateTime(t time.Time) *EchoUpdateOne
SetUpdateTime sets the "update_time" field.
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(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 Tx ¶
type Tx struct { // Echo is the client for interacting with the Echo builders. Echo *EchoClient // 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 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.