Documentation ¶
Index ¶
- Constants
- 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
- 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) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, 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 Hook
- type InterceptFunc
- type Interceptor
- type Model
- type ModelClient
- func (c *ModelClient) Create() *ModelCreate
- func (c *ModelClient) CreateBulk(builders ...*ModelCreate) *ModelCreateBulk
- func (c *ModelClient) Delete() *ModelDelete
- func (c *ModelClient) DeleteOne(m *Model) *ModelDeleteOne
- func (c *ModelClient) DeleteOneID(id int) *ModelDeleteOne
- func (c *ModelClient) Get(ctx context.Context, id int) (*Model, error)
- func (c *ModelClient) GetX(ctx context.Context, id int) *Model
- func (c *ModelClient) Hooks() []Hook
- func (c *ModelClient) Intercept(interceptors ...Interceptor)
- func (c *ModelClient) Interceptors() []Interceptor
- func (c *ModelClient) Query() *ModelQuery
- func (c *ModelClient) Update() *ModelUpdate
- func (c *ModelClient) UpdateOne(m *Model) *ModelUpdateOne
- func (c *ModelClient) UpdateOneID(id int) *ModelUpdateOne
- func (c *ModelClient) Use(hooks ...Hook)
- type ModelCreate
- func (mc *ModelCreate) Exec(ctx context.Context) error
- func (mc *ModelCreate) ExecX(ctx context.Context)
- func (mc *ModelCreate) Mutation() *ModelMutation
- func (mc *ModelCreate) Save(ctx context.Context) (*Model, error)
- func (mc *ModelCreate) SaveX(ctx context.Context) *Model
- func (mc *ModelCreate) SetAge(i int) *ModelCreate
- func (mc *ModelCreate) SetCounter(i int64) *ModelCreate
- func (mc *ModelCreate) SetFax(s string) *ModelCreate
- func (mc *ModelCreate) SetName(s string) *ModelCreate
- func (mc *ModelCreate) SetRight(b bool) *ModelCreate
- func (mc *ModelCreate) SetTitle(s string) *ModelCreate
- func (mc *ModelCreate) SetWeb(s string) *ModelCreate
- type ModelCreateBulk
- type ModelDelete
- type ModelDeleteOne
- type ModelGroupBy
- func (mgb *ModelGroupBy) Aggregate(fns ...AggregateFunc) *ModelGroupBy
- func (s *ModelGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ModelGroupBy) BoolX(ctx context.Context) bool
- func (s *ModelGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ModelGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ModelGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ModelGroupBy) Float64X(ctx context.Context) float64
- func (s *ModelGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ModelGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ModelGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ModelGroupBy) IntX(ctx context.Context) int
- func (s *ModelGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ModelGroupBy) IntsX(ctx context.Context) []int
- func (mgb *ModelGroupBy) Scan(ctx context.Context, v any) error
- func (s *ModelGroupBy) ScanX(ctx context.Context, v any)
- func (s *ModelGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ModelGroupBy) StringX(ctx context.Context) string
- func (s *ModelGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ModelGroupBy) StringsX(ctx context.Context) []string
- type ModelMutation
- func (m *ModelMutation) AddAge(i int)
- func (m *ModelMutation) AddCounter(i int64)
- func (m *ModelMutation) AddField(name string, value ent.Value) error
- func (m *ModelMutation) AddedAge() (r int, exists bool)
- func (m *ModelMutation) AddedCounter() (r int64, exists bool)
- func (m *ModelMutation) AddedEdges() []string
- func (m *ModelMutation) AddedField(name string) (ent.Value, bool)
- func (m *ModelMutation) AddedFields() []string
- func (m *ModelMutation) AddedIDs(name string) []ent.Value
- func (m *ModelMutation) Age() (r int, exists bool)
- func (m *ModelMutation) ClearEdge(name string) error
- func (m *ModelMutation) ClearField(name string) error
- func (m *ModelMutation) ClearedEdges() []string
- func (m *ModelMutation) ClearedFields() []string
- func (m ModelMutation) Client() *Client
- func (m *ModelMutation) Counter() (r int64, exists bool)
- func (m *ModelMutation) EdgeCleared(name string) bool
- func (m *ModelMutation) Fax() (r string, exists bool)
- func (m *ModelMutation) Field(name string) (ent.Value, bool)
- func (m *ModelMutation) FieldCleared(name string) bool
- func (m *ModelMutation) Fields() []string
- func (m *ModelMutation) ID() (id int, exists bool)
- func (m *ModelMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ModelMutation) Name() (r string, exists bool)
- func (m *ModelMutation) OldAge(ctx context.Context) (v int, err error)
- func (m *ModelMutation) OldCounter(ctx context.Context) (v int64, err error)
- func (m *ModelMutation) OldFax(ctx context.Context) (v string, err error)
- func (m *ModelMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ModelMutation) OldName(ctx context.Context) (v string, err error)
- func (m *ModelMutation) OldRight(ctx context.Context) (v bool, err error)
- func (m *ModelMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *ModelMutation) OldWeb(ctx context.Context) (v string, err error)
- func (m *ModelMutation) Op() Op
- func (m *ModelMutation) RemovedEdges() []string
- func (m *ModelMutation) RemovedIDs(name string) []ent.Value
- func (m *ModelMutation) ResetAge()
- func (m *ModelMutation) ResetCounter()
- func (m *ModelMutation) ResetEdge(name string) error
- func (m *ModelMutation) ResetFax()
- func (m *ModelMutation) ResetField(name string) error
- func (m *ModelMutation) ResetName()
- func (m *ModelMutation) ResetRight()
- func (m *ModelMutation) ResetTitle()
- func (m *ModelMutation) ResetWeb()
- func (m *ModelMutation) Right() (r bool, exists bool)
- func (m *ModelMutation) SetAge(i int)
- func (m *ModelMutation) SetCounter(i int64)
- func (m *ModelMutation) SetFax(s string)
- func (m *ModelMutation) SetField(name string, value ent.Value) error
- func (m *ModelMutation) SetName(s string)
- func (m *ModelMutation) SetOp(op Op)
- func (m *ModelMutation) SetRight(b bool)
- func (m *ModelMutation) SetTitle(s string)
- func (m *ModelMutation) SetWeb(s string)
- func (m *ModelMutation) Title() (r string, exists bool)
- func (m ModelMutation) Tx() (*Tx, error)
- func (m *ModelMutation) Type() string
- func (m *ModelMutation) Web() (r string, exists bool)
- func (m *ModelMutation) Where(ps ...predicate.Model)
- func (m *ModelMutation) WhereP(ps ...func(*sql.Selector))
- type ModelQuery
- func (mq *ModelQuery) Aggregate(fns ...AggregateFunc) *ModelSelect
- func (mq *ModelQuery) All(ctx context.Context) ([]*Model, error)
- func (mq *ModelQuery) AllX(ctx context.Context) []*Model
- func (mq *ModelQuery) Clone() *ModelQuery
- func (mq *ModelQuery) Count(ctx context.Context) (int, error)
- func (mq *ModelQuery) CountX(ctx context.Context) int
- func (mq *ModelQuery) Exist(ctx context.Context) (bool, error)
- func (mq *ModelQuery) ExistX(ctx context.Context) bool
- func (mq *ModelQuery) First(ctx context.Context) (*Model, error)
- func (mq *ModelQuery) FirstID(ctx context.Context) (id int, err error)
- func (mq *ModelQuery) FirstIDX(ctx context.Context) int
- func (mq *ModelQuery) FirstX(ctx context.Context) *Model
- func (mq *ModelQuery) GroupBy(field string, fields ...string) *ModelGroupBy
- func (mq *ModelQuery) IDs(ctx context.Context) (ids []int, err error)
- func (mq *ModelQuery) IDsX(ctx context.Context) []int
- func (mq *ModelQuery) Limit(limit int) *ModelQuery
- func (mq *ModelQuery) Offset(offset int) *ModelQuery
- func (mq *ModelQuery) Only(ctx context.Context) (*Model, error)
- func (mq *ModelQuery) OnlyID(ctx context.Context) (id int, err error)
- func (mq *ModelQuery) OnlyIDX(ctx context.Context) int
- func (mq *ModelQuery) OnlyX(ctx context.Context) *Model
- func (mq *ModelQuery) Order(o ...model.OrderOption) *ModelQuery
- func (mq *ModelQuery) Select(fields ...string) *ModelSelect
- func (mq *ModelQuery) Unique(unique bool) *ModelQuery
- func (mq *ModelQuery) Where(ps ...predicate.Model) *ModelQuery
- type ModelSelect
- func (ms *ModelSelect) Aggregate(fns ...AggregateFunc) *ModelSelect
- func (s *ModelSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ModelSelect) BoolX(ctx context.Context) bool
- func (s *ModelSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ModelSelect) BoolsX(ctx context.Context) []bool
- func (s *ModelSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ModelSelect) Float64X(ctx context.Context) float64
- func (s *ModelSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ModelSelect) Float64sX(ctx context.Context) []float64
- func (s *ModelSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ModelSelect) IntX(ctx context.Context) int
- func (s *ModelSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ModelSelect) IntsX(ctx context.Context) []int
- func (ms *ModelSelect) Scan(ctx context.Context, v any) error
- func (s *ModelSelect) ScanX(ctx context.Context, v any)
- func (s *ModelSelect) String(ctx context.Context) (_ string, err error)
- func (s *ModelSelect) StringX(ctx context.Context) string
- func (s *ModelSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ModelSelect) StringsX(ctx context.Context) []string
- type ModelUpdate
- func (mu *ModelUpdate) AddAge(i int) *ModelUpdate
- func (mu *ModelUpdate) AddCounter(i int64) *ModelUpdate
- func (mu *ModelUpdate) Exec(ctx context.Context) error
- func (mu *ModelUpdate) ExecX(ctx context.Context)
- func (mu *ModelUpdate) Mutation() *ModelMutation
- func (mu *ModelUpdate) Save(ctx context.Context) (int, error)
- func (mu *ModelUpdate) SaveX(ctx context.Context) int
- func (mu *ModelUpdate) SetAge(i int) *ModelUpdate
- func (mu *ModelUpdate) SetCounter(i int64) *ModelUpdate
- func (mu *ModelUpdate) SetFax(s string) *ModelUpdate
- func (mu *ModelUpdate) SetName(s string) *ModelUpdate
- func (mu *ModelUpdate) SetRight(b bool) *ModelUpdate
- func (mu *ModelUpdate) SetTitle(s string) *ModelUpdate
- func (mu *ModelUpdate) SetWeb(s string) *ModelUpdate
- func (mu *ModelUpdate) Where(ps ...predicate.Model) *ModelUpdate
- type ModelUpdateOne
- func (muo *ModelUpdateOne) AddAge(i int) *ModelUpdateOne
- func (muo *ModelUpdateOne) AddCounter(i int64) *ModelUpdateOne
- func (muo *ModelUpdateOne) Exec(ctx context.Context) error
- func (muo *ModelUpdateOne) ExecX(ctx context.Context)
- func (muo *ModelUpdateOne) Mutation() *ModelMutation
- func (muo *ModelUpdateOne) Save(ctx context.Context) (*Model, error)
- func (muo *ModelUpdateOne) SaveX(ctx context.Context) *Model
- func (muo *ModelUpdateOne) Select(field string, fields ...string) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetAge(i int) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetCounter(i int64) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetFax(s string) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetRight(b bool) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetTitle(s string) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetWeb(s string) *ModelUpdateOne
- func (muo *ModelUpdateOne) Where(ps ...predicate.Model) *ModelUpdateOne
- type Models
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- 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. TypeModel = "Model" )
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 // Model is the client for interacting with the Model builders. Model *ModelClient // 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(). Model. Query(). Count(ctx)
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(...)`.
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 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 Model ¶
type Model struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // Fax holds the value of the "fax" field. Fax string `json:"fax,omitempty"` // Web holds the value of the "web" field. Web string `json:"web,omitempty"` // Age holds the value of the "age" field. Age int `json:"age,omitempty"` // Right holds the value of the "right" field. Right bool `json:"right,omitempty"` // Counter holds the value of the "counter" field. Counter int64 `json:"counter,omitempty"` // contains filtered or unexported fields }
Model is the model entity for the Model schema.
func (*Model) Unwrap ¶
Unwrap unwraps the Model 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 (*Model) Update ¶
func (m *Model) Update() *ModelUpdateOne
Update returns a builder for updating this Model. Note that you need to call Model.Unwrap() before calling this method if this Model was returned from a transaction, and the transaction was committed or rolled back.
type ModelClient ¶
type ModelClient struct {
// contains filtered or unexported fields
}
ModelClient is a client for the Model schema.
func NewModelClient ¶
func NewModelClient(c config) *ModelClient
NewModelClient returns a client for the Model from the given config.
func (*ModelClient) Create ¶
func (c *ModelClient) Create() *ModelCreate
Create returns a builder for creating a Model entity.
func (*ModelClient) CreateBulk ¶
func (c *ModelClient) CreateBulk(builders ...*ModelCreate) *ModelCreateBulk
CreateBulk returns a builder for creating a bulk of Model entities.
func (*ModelClient) Delete ¶
func (c *ModelClient) Delete() *ModelDelete
Delete returns a delete builder for Model.
func (*ModelClient) DeleteOne ¶
func (c *ModelClient) DeleteOne(m *Model) *ModelDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*ModelClient) DeleteOneID ¶
func (c *ModelClient) DeleteOneID(id int) *ModelDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*ModelClient) GetX ¶
func (c *ModelClient) GetX(ctx context.Context, id int) *Model
GetX is like Get, but panics if an error occurs.
func (*ModelClient) Intercept ¶
func (c *ModelClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `model.Intercept(f(g(h())))`.
func (*ModelClient) Interceptors ¶
func (c *ModelClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*ModelClient) Query ¶
func (c *ModelClient) Query() *ModelQuery
Query returns a query builder for Model.
func (*ModelClient) Update ¶
func (c *ModelClient) Update() *ModelUpdate
Update returns an update builder for Model.
func (*ModelClient) UpdateOne ¶
func (c *ModelClient) UpdateOne(m *Model) *ModelUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ModelClient) UpdateOneID ¶
func (c *ModelClient) UpdateOneID(id int) *ModelUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ModelClient) Use ¶
func (c *ModelClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `model.Hooks(f(g(h())))`.
type ModelCreate ¶
type ModelCreate struct {
// contains filtered or unexported fields
}
ModelCreate is the builder for creating a Model entity.
func (*ModelCreate) Exec ¶
func (mc *ModelCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ModelCreate) ExecX ¶
func (mc *ModelCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelCreate) Mutation ¶
func (mc *ModelCreate) Mutation() *ModelMutation
Mutation returns the ModelMutation object of the builder.
func (*ModelCreate) Save ¶
func (mc *ModelCreate) Save(ctx context.Context) (*Model, error)
Save creates the Model in the database.
func (*ModelCreate) SaveX ¶
func (mc *ModelCreate) SaveX(ctx context.Context) *Model
SaveX calls Save and panics if Save returns an error.
func (*ModelCreate) SetAge ¶
func (mc *ModelCreate) SetAge(i int) *ModelCreate
SetAge sets the "age" field.
func (*ModelCreate) SetCounter ¶
func (mc *ModelCreate) SetCounter(i int64) *ModelCreate
SetCounter sets the "counter" field.
func (*ModelCreate) SetFax ¶
func (mc *ModelCreate) SetFax(s string) *ModelCreate
SetFax sets the "fax" field.
func (*ModelCreate) SetName ¶
func (mc *ModelCreate) SetName(s string) *ModelCreate
SetName sets the "name" field.
func (*ModelCreate) SetRight ¶
func (mc *ModelCreate) SetRight(b bool) *ModelCreate
SetRight sets the "right" field.
func (*ModelCreate) SetTitle ¶
func (mc *ModelCreate) SetTitle(s string) *ModelCreate
SetTitle sets the "title" field.
func (*ModelCreate) SetWeb ¶
func (mc *ModelCreate) SetWeb(s string) *ModelCreate
SetWeb sets the "web" field.
type ModelCreateBulk ¶
type ModelCreateBulk struct {
// contains filtered or unexported fields
}
ModelCreateBulk is the builder for creating many Model entities in bulk.
func (*ModelCreateBulk) Exec ¶
func (mcb *ModelCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ModelCreateBulk) ExecX ¶
func (mcb *ModelCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ModelDelete ¶
type ModelDelete struct {
// contains filtered or unexported fields
}
ModelDelete is the builder for deleting a Model entity.
func (*ModelDelete) Exec ¶
func (md *ModelDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ModelDelete) ExecX ¶
func (md *ModelDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ModelDelete) Where ¶
func (md *ModelDelete) Where(ps ...predicate.Model) *ModelDelete
Where appends a list predicates to the ModelDelete builder.
type ModelDeleteOne ¶
type ModelDeleteOne struct {
// contains filtered or unexported fields
}
ModelDeleteOne is the builder for deleting a single Model entity.
func (*ModelDeleteOne) Exec ¶
func (mdo *ModelDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ModelDeleteOne) ExecX ¶
func (mdo *ModelDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelDeleteOne) Where ¶
func (mdo *ModelDeleteOne) Where(ps ...predicate.Model) *ModelDeleteOne
Where appends a list predicates to the ModelDelete builder.
type ModelGroupBy ¶
type ModelGroupBy struct {
// contains filtered or unexported fields
}
ModelGroupBy is the group-by builder for Model entities.
func (*ModelGroupBy) Aggregate ¶
func (mgb *ModelGroupBy) Aggregate(fns ...AggregateFunc) *ModelGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ModelGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ModelGroupBy) Scan ¶
func (mgb *ModelGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ModelGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ModelMutation ¶
type ModelMutation struct {
// contains filtered or unexported fields
}
ModelMutation represents an operation that mutates the Model nodes in the graph.
func (*ModelMutation) AddAge ¶
func (m *ModelMutation) AddAge(i int)
AddAge adds i to the "age" field.
func (*ModelMutation) AddCounter ¶
func (m *ModelMutation) AddCounter(i int64)
AddCounter adds i to the "counter" field.
func (*ModelMutation) AddField ¶
func (m *ModelMutation) 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 (*ModelMutation) AddedAge ¶
func (m *ModelMutation) AddedAge() (r int, exists bool)
AddedAge returns the value that was added to the "age" field in this mutation.
func (*ModelMutation) AddedCounter ¶
func (m *ModelMutation) AddedCounter() (r int64, exists bool)
AddedCounter returns the value that was added to the "counter" field in this mutation.
func (*ModelMutation) AddedEdges ¶
func (m *ModelMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ModelMutation) AddedField ¶
func (m *ModelMutation) 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 (*ModelMutation) AddedFields ¶
func (m *ModelMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ModelMutation) AddedIDs ¶
func (m *ModelMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ModelMutation) Age ¶
func (m *ModelMutation) Age() (r int, exists bool)
Age returns the value of the "age" field in the mutation.
func (*ModelMutation) ClearEdge ¶
func (m *ModelMutation) 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 (*ModelMutation) ClearField ¶
func (m *ModelMutation) 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 (*ModelMutation) ClearedEdges ¶
func (m *ModelMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ModelMutation) ClearedFields ¶
func (m *ModelMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ModelMutation) Client ¶
func (m ModelMutation) 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 (*ModelMutation) Counter ¶
func (m *ModelMutation) Counter() (r int64, exists bool)
Counter returns the value of the "counter" field in the mutation.
func (*ModelMutation) EdgeCleared ¶
func (m *ModelMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ModelMutation) Fax ¶
func (m *ModelMutation) Fax() (r string, exists bool)
Fax returns the value of the "fax" field in the mutation.
func (*ModelMutation) Field ¶
func (m *ModelMutation) 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 (*ModelMutation) FieldCleared ¶
func (m *ModelMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ModelMutation) Fields ¶
func (m *ModelMutation) 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 (*ModelMutation) ID ¶
func (m *ModelMutation) 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 (*ModelMutation) IDs ¶
func (m *ModelMutation) 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 (*ModelMutation) Name ¶
func (m *ModelMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*ModelMutation) OldAge ¶
func (m *ModelMutation) OldAge(ctx context.Context) (v int, err error)
OldAge returns the old "age" field's value of the Model entity. If the Model 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 (*ModelMutation) OldCounter ¶
func (m *ModelMutation) OldCounter(ctx context.Context) (v int64, err error)
OldCounter returns the old "counter" field's value of the Model entity. If the Model 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 (*ModelMutation) OldFax ¶
func (m *ModelMutation) OldFax(ctx context.Context) (v string, err error)
OldFax returns the old "fax" field's value of the Model entity. If the Model 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 (*ModelMutation) 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 (*ModelMutation) OldName ¶
func (m *ModelMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Model entity. If the Model 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 (*ModelMutation) OldRight ¶
func (m *ModelMutation) OldRight(ctx context.Context) (v bool, err error)
OldRight returns the old "right" field's value of the Model entity. If the Model 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 (*ModelMutation) OldTitle ¶
func (m *ModelMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Model entity. If the Model 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 (*ModelMutation) OldWeb ¶
func (m *ModelMutation) OldWeb(ctx context.Context) (v string, err error)
OldWeb returns the old "web" field's value of the Model entity. If the Model 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 (*ModelMutation) RemovedEdges ¶
func (m *ModelMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ModelMutation) RemovedIDs ¶
func (m *ModelMutation) 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 (*ModelMutation) ResetAge ¶
func (m *ModelMutation) ResetAge()
ResetAge resets all changes to the "age" field.
func (*ModelMutation) ResetCounter ¶
func (m *ModelMutation) ResetCounter()
ResetCounter resets all changes to the "counter" field.
func (*ModelMutation) ResetEdge ¶
func (m *ModelMutation) 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 (*ModelMutation) ResetFax ¶
func (m *ModelMutation) ResetFax()
ResetFax resets all changes to the "fax" field.
func (*ModelMutation) ResetField ¶
func (m *ModelMutation) 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 (*ModelMutation) ResetName ¶
func (m *ModelMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*ModelMutation) ResetRight ¶
func (m *ModelMutation) ResetRight()
ResetRight resets all changes to the "right" field.
func (*ModelMutation) ResetTitle ¶
func (m *ModelMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*ModelMutation) ResetWeb ¶
func (m *ModelMutation) ResetWeb()
ResetWeb resets all changes to the "web" field.
func (*ModelMutation) Right ¶
func (m *ModelMutation) Right() (r bool, exists bool)
Right returns the value of the "right" field in the mutation.
func (*ModelMutation) SetCounter ¶
func (m *ModelMutation) SetCounter(i int64)
SetCounter sets the "counter" field.
func (*ModelMutation) SetFax ¶
func (m *ModelMutation) SetFax(s string)
SetFax sets the "fax" field.
func (*ModelMutation) SetField ¶
func (m *ModelMutation) 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 (*ModelMutation) SetName ¶
func (m *ModelMutation) SetName(s string)
SetName sets the "name" field.
func (*ModelMutation) SetOp ¶
func (m *ModelMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*ModelMutation) SetRight ¶
func (m *ModelMutation) SetRight(b bool)
SetRight sets the "right" field.
func (*ModelMutation) SetTitle ¶
func (m *ModelMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*ModelMutation) SetWeb ¶
func (m *ModelMutation) SetWeb(s string)
SetWeb sets the "web" field.
func (*ModelMutation) Title ¶
func (m *ModelMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (ModelMutation) Tx ¶
func (m ModelMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ModelMutation) Type ¶
func (m *ModelMutation) Type() string
Type returns the node type of this mutation (Model).
func (*ModelMutation) Web ¶
func (m *ModelMutation) Web() (r string, exists bool)
Web returns the value of the "web" field in the mutation.
func (*ModelMutation) Where ¶
func (m *ModelMutation) Where(ps ...predicate.Model)
Where appends a list predicates to the ModelMutation builder.
func (*ModelMutation) WhereP ¶
func (m *ModelMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the ModelMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type ModelQuery ¶
type ModelQuery struct {
// contains filtered or unexported fields
}
ModelQuery is the builder for querying Model entities.
func (*ModelQuery) Aggregate ¶
func (mq *ModelQuery) Aggregate(fns ...AggregateFunc) *ModelSelect
Aggregate returns a ModelSelect configured with the given aggregations.
func (*ModelQuery) All ¶
func (mq *ModelQuery) All(ctx context.Context) ([]*Model, error)
All executes the query and returns a list of Models.
func (*ModelQuery) AllX ¶
func (mq *ModelQuery) AllX(ctx context.Context) []*Model
AllX is like All, but panics if an error occurs.
func (*ModelQuery) Clone ¶
func (mq *ModelQuery) Clone() *ModelQuery
Clone returns a duplicate of the ModelQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ModelQuery) Count ¶
func (mq *ModelQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ModelQuery) CountX ¶
func (mq *ModelQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ModelQuery) Exist ¶
func (mq *ModelQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ModelQuery) ExistX ¶
func (mq *ModelQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ModelQuery) First ¶
func (mq *ModelQuery) First(ctx context.Context) (*Model, error)
First returns the first Model entity from the query. Returns a *NotFoundError when no Model was found.
func (*ModelQuery) FirstID ¶
func (mq *ModelQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Model ID from the query. Returns a *NotFoundError when no Model ID was found.
func (*ModelQuery) FirstIDX ¶
func (mq *ModelQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*ModelQuery) FirstX ¶
func (mq *ModelQuery) FirstX(ctx context.Context) *Model
FirstX is like First, but panics if an error occurs.
func (*ModelQuery) GroupBy ¶
func (mq *ModelQuery) GroupBy(field string, fields ...string) *ModelGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Model.Query(). GroupBy(model.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ModelQuery) IDs ¶
func (mq *ModelQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Model IDs.
func (*ModelQuery) IDsX ¶
func (mq *ModelQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ModelQuery) Limit ¶
func (mq *ModelQuery) Limit(limit int) *ModelQuery
Limit the number of records to be returned by this query.
func (*ModelQuery) Offset ¶
func (mq *ModelQuery) Offset(offset int) *ModelQuery
Offset to start from.
func (*ModelQuery) Only ¶
func (mq *ModelQuery) Only(ctx context.Context) (*Model, error)
Only returns a single Model entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Model entity is found. Returns a *NotFoundError when no Model entities are found.
func (*ModelQuery) OnlyID ¶
func (mq *ModelQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Model ID in the query. Returns a *NotSingularError when more than one Model ID is found. Returns a *NotFoundError when no entities are found.
func (*ModelQuery) OnlyIDX ¶
func (mq *ModelQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ModelQuery) OnlyX ¶
func (mq *ModelQuery) OnlyX(ctx context.Context) *Model
OnlyX is like Only, but panics if an error occurs.
func (*ModelQuery) Order ¶
func (mq *ModelQuery) Order(o ...model.OrderOption) *ModelQuery
Order specifies how the records should be ordered.
func (*ModelQuery) Select ¶
func (mq *ModelQuery) Select(fields ...string) *ModelSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Model.Query(). Select(model.FieldName). Scan(ctx, &v)
func (*ModelQuery) Unique ¶
func (mq *ModelQuery) Unique(unique bool) *ModelQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*ModelQuery) Where ¶
func (mq *ModelQuery) Where(ps ...predicate.Model) *ModelQuery
Where adds a new predicate for the ModelQuery builder.
type ModelSelect ¶
type ModelSelect struct { *ModelQuery // contains filtered or unexported fields }
ModelSelect is the builder for selecting fields of Model entities.
func (*ModelSelect) Aggregate ¶
func (ms *ModelSelect) Aggregate(fns ...AggregateFunc) *ModelSelect
Aggregate adds the given aggregation functions to the selector query.
func (*ModelSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ModelSelect) Scan ¶
func (ms *ModelSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ModelSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ModelUpdate ¶
type ModelUpdate struct {
// contains filtered or unexported fields
}
ModelUpdate is the builder for updating Model entities.
func (*ModelUpdate) AddAge ¶
func (mu *ModelUpdate) AddAge(i int) *ModelUpdate
AddAge adds i to the "age" field.
func (*ModelUpdate) AddCounter ¶
func (mu *ModelUpdate) AddCounter(i int64) *ModelUpdate
AddCounter adds i to the "counter" field.
func (*ModelUpdate) Exec ¶
func (mu *ModelUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ModelUpdate) ExecX ¶
func (mu *ModelUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelUpdate) Mutation ¶
func (mu *ModelUpdate) Mutation() *ModelMutation
Mutation returns the ModelMutation object of the builder.
func (*ModelUpdate) Save ¶
func (mu *ModelUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ModelUpdate) SaveX ¶
func (mu *ModelUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ModelUpdate) SetAge ¶
func (mu *ModelUpdate) SetAge(i int) *ModelUpdate
SetAge sets the "age" field.
func (*ModelUpdate) SetCounter ¶
func (mu *ModelUpdate) SetCounter(i int64) *ModelUpdate
SetCounter sets the "counter" field.
func (*ModelUpdate) SetFax ¶
func (mu *ModelUpdate) SetFax(s string) *ModelUpdate
SetFax sets the "fax" field.
func (*ModelUpdate) SetName ¶
func (mu *ModelUpdate) SetName(s string) *ModelUpdate
SetName sets the "name" field.
func (*ModelUpdate) SetRight ¶
func (mu *ModelUpdate) SetRight(b bool) *ModelUpdate
SetRight sets the "right" field.
func (*ModelUpdate) SetTitle ¶
func (mu *ModelUpdate) SetTitle(s string) *ModelUpdate
SetTitle sets the "title" field.
func (*ModelUpdate) SetWeb ¶
func (mu *ModelUpdate) SetWeb(s string) *ModelUpdate
SetWeb sets the "web" field.
func (*ModelUpdate) Where ¶
func (mu *ModelUpdate) Where(ps ...predicate.Model) *ModelUpdate
Where appends a list predicates to the ModelUpdate builder.
type ModelUpdateOne ¶
type ModelUpdateOne struct {
// contains filtered or unexported fields
}
ModelUpdateOne is the builder for updating a single Model entity.
func (*ModelUpdateOne) AddAge ¶
func (muo *ModelUpdateOne) AddAge(i int) *ModelUpdateOne
AddAge adds i to the "age" field.
func (*ModelUpdateOne) AddCounter ¶
func (muo *ModelUpdateOne) AddCounter(i int64) *ModelUpdateOne
AddCounter adds i to the "counter" field.
func (*ModelUpdateOne) Exec ¶
func (muo *ModelUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ModelUpdateOne) ExecX ¶
func (muo *ModelUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelUpdateOne) Mutation ¶
func (muo *ModelUpdateOne) Mutation() *ModelMutation
Mutation returns the ModelMutation object of the builder.
func (*ModelUpdateOne) Save ¶
func (muo *ModelUpdateOne) Save(ctx context.Context) (*Model, error)
Save executes the query and returns the updated Model entity.
func (*ModelUpdateOne) SaveX ¶
func (muo *ModelUpdateOne) SaveX(ctx context.Context) *Model
SaveX is like Save, but panics if an error occurs.
func (*ModelUpdateOne) Select ¶
func (muo *ModelUpdateOne) Select(field string, fields ...string) *ModelUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ModelUpdateOne) SetAge ¶
func (muo *ModelUpdateOne) SetAge(i int) *ModelUpdateOne
SetAge sets the "age" field.
func (*ModelUpdateOne) SetCounter ¶
func (muo *ModelUpdateOne) SetCounter(i int64) *ModelUpdateOne
SetCounter sets the "counter" field.
func (*ModelUpdateOne) SetFax ¶
func (muo *ModelUpdateOne) SetFax(s string) *ModelUpdateOne
SetFax sets the "fax" field.
func (*ModelUpdateOne) SetName ¶
func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne
SetName sets the "name" field.
func (*ModelUpdateOne) SetRight ¶
func (muo *ModelUpdateOne) SetRight(b bool) *ModelUpdateOne
SetRight sets the "right" field.
func (*ModelUpdateOne) SetTitle ¶
func (muo *ModelUpdateOne) SetTitle(s string) *ModelUpdateOne
SetTitle sets the "title" field.
func (*ModelUpdateOne) SetWeb ¶
func (muo *ModelUpdateOne) SetWeb(s string) *ModelUpdateOne
SetWeb sets the "web" field.
func (*ModelUpdateOne) Where ¶
func (muo *ModelUpdateOne) Where(ps ...predicate.Model) *ModelUpdateOne
Where appends a list predicates to the ModelUpdate builder.
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 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 TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Model is the client for interacting with the Model builders. Model *ModelClient // 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.