Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- 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) GetConfig() *entutils.RawEntConfig
- func (c *Client) HijackTx(ctx context.Context, opts *sql.TxOptions) (context.Context, *entutils.RawEntConfig, *ExposedTxDriver, error)
- 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 Example2
- type Example2Client
- func (c *Example2Client) Create() *Example2Create
- func (c *Example2Client) CreateBulk(builders ...*Example2Create) *Example2CreateBulk
- func (c *Example2Client) Delete() *Example2Delete
- func (c *Example2Client) DeleteOne(e *Example2) *Example2DeleteOne
- func (c *Example2Client) DeleteOneID(id string) *Example2DeleteOne
- func (c *Example2Client) Get(ctx context.Context, id string) (*Example2, error)
- func (c *Example2Client) GetX(ctx context.Context, id string) *Example2
- func (c *Example2Client) Hooks() []Hook
- func (c *Example2Client) Intercept(interceptors ...Interceptor)
- func (c *Example2Client) Interceptors() []Interceptor
- func (c *Example2Client) MapCreateBulk(slice any, setFunc func(*Example2Create, int)) *Example2CreateBulk
- func (c *Example2Client) Query() *Example2Query
- func (c *Example2Client) Update() *Example2Update
- func (c *Example2Client) UpdateOne(e *Example2) *Example2UpdateOne
- func (c *Example2Client) UpdateOneID(id string) *Example2UpdateOne
- func (c *Example2Client) Use(hooks ...Hook)
- type Example2Create
- func (e *Example2Create) Exec(ctx context.Context) error
- func (e *Example2Create) ExecX(ctx context.Context)
- func (e *Example2Create) Mutation() *Example2Mutation
- func (e *Example2Create) OnConflict(opts ...sql.ConflictOption) *Example2UpsertOne
- func (e *Example2Create) OnConflictColumns(columns ...string) *Example2UpsertOne
- func (e *Example2Create) Save(ctx context.Context) (*Example2, error)
- func (e *Example2Create) SaveX(ctx context.Context) *Example2
- func (e *Example2Create) SetCreatedAt(t time.Time) *Example2Create
- func (e *Example2Create) SetDeletedAt(t time.Time) *Example2Create
- func (e *Example2Create) SetExampleValue2(s string) *Example2Create
- func (e *Example2Create) SetID(s string) *Example2Create
- func (e *Example2Create) SetNillableCreatedAt(t *time.Time) *Example2Create
- func (e *Example2Create) SetNillableDeletedAt(t *time.Time) *Example2Create
- func (e *Example2Create) SetNillableUpdatedAt(t *time.Time) *Example2Create
- func (e *Example2Create) SetUpdatedAt(t time.Time) *Example2Create
- type Example2CreateBulk
- func (eb *Example2CreateBulk) Exec(ctx context.Context) error
- func (eb *Example2CreateBulk) ExecX(ctx context.Context)
- func (eb *Example2CreateBulk) OnConflict(opts ...sql.ConflictOption) *Example2UpsertBulk
- func (eb *Example2CreateBulk) OnConflictColumns(columns ...string) *Example2UpsertBulk
- func (eb *Example2CreateBulk) Save(ctx context.Context) ([]*Example2, error)
- func (eb *Example2CreateBulk) SaveX(ctx context.Context) []*Example2
- type Example2Delete
- type Example2DeleteOne
- type Example2GroupBy
- func (eb *Example2GroupBy) Aggregate(fns ...AggregateFunc) *Example2GroupBy
- func (s *Example2GroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *Example2GroupBy) BoolX(ctx context.Context) bool
- func (s *Example2GroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *Example2GroupBy) BoolsX(ctx context.Context) []bool
- func (s *Example2GroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *Example2GroupBy) Float64X(ctx context.Context) float64
- func (s *Example2GroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *Example2GroupBy) Float64sX(ctx context.Context) []float64
- func (s *Example2GroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *Example2GroupBy) IntX(ctx context.Context) int
- func (s *Example2GroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *Example2GroupBy) IntsX(ctx context.Context) []int
- func (eb *Example2GroupBy) Scan(ctx context.Context, v any) error
- func (s *Example2GroupBy) ScanX(ctx context.Context, v any)
- func (s *Example2GroupBy) String(ctx context.Context) (_ string, err error)
- func (s *Example2GroupBy) StringX(ctx context.Context) string
- func (s *Example2GroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *Example2GroupBy) StringsX(ctx context.Context) []string
- type Example2Mutation
- func (m *Example2Mutation) AddField(name string, value ent.Value) error
- func (m *Example2Mutation) AddedEdges() []string
- func (m *Example2Mutation) AddedField(name string) (ent.Value, bool)
- func (m *Example2Mutation) AddedFields() []string
- func (m *Example2Mutation) AddedIDs(name string) []ent.Value
- func (m *Example2Mutation) ClearDeletedAt()
- func (m *Example2Mutation) ClearEdge(name string) error
- func (m *Example2Mutation) ClearField(name string) error
- func (m *Example2Mutation) ClearedEdges() []string
- func (m *Example2Mutation) ClearedFields() []string
- func (m Example2Mutation) Client() *Client
- func (m *Example2Mutation) CreatedAt() (r time.Time, exists bool)
- func (m *Example2Mutation) DeletedAt() (r time.Time, exists bool)
- func (m *Example2Mutation) DeletedAtCleared() bool
- func (m *Example2Mutation) EdgeCleared(name string) bool
- func (m *Example2Mutation) ExampleValue2() (r string, exists bool)
- func (m *Example2Mutation) Field(name string) (ent.Value, bool)
- func (m *Example2Mutation) FieldCleared(name string) bool
- func (m *Example2Mutation) Fields() []string
- func (m *Example2Mutation) ID() (id string, exists bool)
- func (m *Example2Mutation) IDs(ctx context.Context) ([]string, error)
- func (m *Example2Mutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *Example2Mutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)
- func (m *Example2Mutation) OldExampleValue2(ctx context.Context) (v string, err error)
- func (m *Example2Mutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *Example2Mutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *Example2Mutation) Op() Op
- func (m *Example2Mutation) RemovedEdges() []string
- func (m *Example2Mutation) RemovedIDs(name string) []ent.Value
- func (m *Example2Mutation) ResetCreatedAt()
- func (m *Example2Mutation) ResetDeletedAt()
- func (m *Example2Mutation) ResetEdge(name string) error
- func (m *Example2Mutation) ResetExampleValue2()
- func (m *Example2Mutation) ResetField(name string) error
- func (m *Example2Mutation) ResetUpdatedAt()
- func (m *Example2Mutation) SetCreatedAt(t time.Time)
- func (m *Example2Mutation) SetDeletedAt(t time.Time)
- func (m *Example2Mutation) SetExampleValue2(s string)
- func (m *Example2Mutation) SetField(name string, value ent.Value) error
- func (m *Example2Mutation) SetID(id string)
- func (m *Example2Mutation) SetOp(op Op)
- func (m *Example2Mutation) SetUpdatedAt(t time.Time)
- func (m Example2Mutation) Tx() (*Tx, error)
- func (m *Example2Mutation) Type() string
- func (m *Example2Mutation) UpdatedAt() (r time.Time, exists bool)
- func (m *Example2Mutation) Where(ps ...predicate.Example2)
- func (m *Example2Mutation) WhereP(ps ...func(*sql.Selector))
- type Example2Query
- func (e *Example2Query) Aggregate(fns ...AggregateFunc) *Example2Select
- func (e *Example2Query) All(ctx context.Context) ([]*Example2, error)
- func (e *Example2Query) AllX(ctx context.Context) []*Example2
- func (e *Example2Query) Clone() *Example2Query
- func (e *Example2Query) Count(ctx context.Context) (int, error)
- func (e *Example2Query) CountX(ctx context.Context) int
- func (e *Example2Query) Exist(ctx context.Context) (bool, error)
- func (e *Example2Query) ExistX(ctx context.Context) bool
- func (e *Example2Query) First(ctx context.Context) (*Example2, error)
- func (e *Example2Query) FirstID(ctx context.Context) (id string, err error)
- func (e *Example2Query) FirstIDX(ctx context.Context) string
- func (e *Example2Query) FirstX(ctx context.Context) *Example2
- func (e *Example2Query) ForShare(opts ...sql.LockOption) *Example2Query
- func (e *Example2Query) ForUpdate(opts ...sql.LockOption) *Example2Query
- func (e *Example2Query) GroupBy(field string, fields ...string) *Example2GroupBy
- func (e *Example2Query) IDs(ctx context.Context) (ids []string, err error)
- func (e *Example2Query) IDsX(ctx context.Context) []string
- func (e *Example2Query) Limit(limit int) *Example2Query
- func (e *Example2Query) Offset(offset int) *Example2Query
- func (e *Example2Query) Only(ctx context.Context) (*Example2, error)
- func (e *Example2Query) OnlyID(ctx context.Context) (id string, err error)
- func (e *Example2Query) OnlyIDX(ctx context.Context) string
- func (e *Example2Query) OnlyX(ctx context.Context) *Example2
- func (e *Example2Query) Order(o ...example2.OrderOption) *Example2Query
- func (e *Example2Query) Select(fields ...string) *Example2Select
- func (e *Example2Query) Unique(unique bool) *Example2Query
- func (e *Example2Query) Where(ps ...predicate.Example2) *Example2Query
- type Example2Select
- func (e *Example2Select) Aggregate(fns ...AggregateFunc) *Example2Select
- func (s *Example2Select) Bool(ctx context.Context) (_ bool, err error)
- func (s *Example2Select) BoolX(ctx context.Context) bool
- func (s *Example2Select) Bools(ctx context.Context) ([]bool, error)
- func (s *Example2Select) BoolsX(ctx context.Context) []bool
- func (s *Example2Select) Float64(ctx context.Context) (_ float64, err error)
- func (s *Example2Select) Float64X(ctx context.Context) float64
- func (s *Example2Select) Float64s(ctx context.Context) ([]float64, error)
- func (s *Example2Select) Float64sX(ctx context.Context) []float64
- func (s *Example2Select) Int(ctx context.Context) (_ int, err error)
- func (s *Example2Select) IntX(ctx context.Context) int
- func (s *Example2Select) Ints(ctx context.Context) ([]int, error)
- func (s *Example2Select) IntsX(ctx context.Context) []int
- func (e *Example2Select) Scan(ctx context.Context, v any) error
- func (s *Example2Select) ScanX(ctx context.Context, v any)
- func (s *Example2Select) String(ctx context.Context) (_ string, err error)
- func (s *Example2Select) StringX(ctx context.Context) string
- func (s *Example2Select) Strings(ctx context.Context) ([]string, error)
- func (s *Example2Select) StringsX(ctx context.Context) []string
- type Example2Update
- func (e *Example2Update) ClearDeletedAt() *Example2Update
- func (e *Example2Update) Exec(ctx context.Context) error
- func (e *Example2Update) ExecX(ctx context.Context)
- func (e *Example2Update) Mutation() *Example2Mutation
- func (e *Example2Update) Save(ctx context.Context) (int, error)
- func (e *Example2Update) SaveX(ctx context.Context) int
- func (e *Example2Update) SetDeletedAt(t time.Time) *Example2Update
- func (e *Example2Update) SetExampleValue2(s string) *Example2Update
- func (e *Example2Update) SetNillableDeletedAt(t *time.Time) *Example2Update
- func (e *Example2Update) SetNillableExampleValue2(s *string) *Example2Update
- func (e *Example2Update) SetUpdatedAt(t time.Time) *Example2Update
- func (e *Example2Update) Where(ps ...predicate.Example2) *Example2Update
- type Example2UpdateOne
- func (eo *Example2UpdateOne) ClearDeletedAt() *Example2UpdateOne
- func (eo *Example2UpdateOne) Exec(ctx context.Context) error
- func (eo *Example2UpdateOne) ExecX(ctx context.Context)
- func (eo *Example2UpdateOne) Mutation() *Example2Mutation
- func (eo *Example2UpdateOne) Save(ctx context.Context) (*Example2, error)
- func (eo *Example2UpdateOne) SaveX(ctx context.Context) *Example2
- func (eo *Example2UpdateOne) Select(field string, fields ...string) *Example2UpdateOne
- func (eo *Example2UpdateOne) SetDeletedAt(t time.Time) *Example2UpdateOne
- func (eo *Example2UpdateOne) SetExampleValue2(s string) *Example2UpdateOne
- func (eo *Example2UpdateOne) SetNillableDeletedAt(t *time.Time) *Example2UpdateOne
- func (eo *Example2UpdateOne) SetNillableExampleValue2(s *string) *Example2UpdateOne
- func (eo *Example2UpdateOne) SetUpdatedAt(t time.Time) *Example2UpdateOne
- func (eo *Example2UpdateOne) Where(ps ...predicate.Example2) *Example2UpdateOne
- type Example2Upsert
- func (u *Example2Upsert) ClearDeletedAt() *Example2Upsert
- func (u *Example2Upsert) SetDeletedAt(v time.Time) *Example2Upsert
- func (u *Example2Upsert) SetExampleValue2(v string) *Example2Upsert
- func (u *Example2Upsert) SetUpdatedAt(v time.Time) *Example2Upsert
- func (u *Example2Upsert) UpdateDeletedAt() *Example2Upsert
- func (u *Example2Upsert) UpdateExampleValue2() *Example2Upsert
- func (u *Example2Upsert) UpdateUpdatedAt() *Example2Upsert
- type Example2UpsertBulk
- func (u *Example2UpsertBulk) ClearDeletedAt() *Example2UpsertBulk
- func (u *Example2UpsertBulk) DoNothing() *Example2UpsertBulk
- func (u *Example2UpsertBulk) Exec(ctx context.Context) error
- func (u *Example2UpsertBulk) ExecX(ctx context.Context)
- func (u *Example2UpsertBulk) Ignore() *Example2UpsertBulk
- func (u *Example2UpsertBulk) SetDeletedAt(v time.Time) *Example2UpsertBulk
- func (u *Example2UpsertBulk) SetExampleValue2(v string) *Example2UpsertBulk
- func (u *Example2UpsertBulk) SetUpdatedAt(v time.Time) *Example2UpsertBulk
- func (u *Example2UpsertBulk) Update(set func(*Example2Upsert)) *Example2UpsertBulk
- func (u *Example2UpsertBulk) UpdateDeletedAt() *Example2UpsertBulk
- func (u *Example2UpsertBulk) UpdateExampleValue2() *Example2UpsertBulk
- func (u *Example2UpsertBulk) UpdateNewValues() *Example2UpsertBulk
- func (u *Example2UpsertBulk) UpdateUpdatedAt() *Example2UpsertBulk
- type Example2UpsertOne
- func (u *Example2UpsertOne) ClearDeletedAt() *Example2UpsertOne
- func (u *Example2UpsertOne) DoNothing() *Example2UpsertOne
- func (u *Example2UpsertOne) Exec(ctx context.Context) error
- func (u *Example2UpsertOne) ExecX(ctx context.Context)
- func (u *Example2UpsertOne) ID(ctx context.Context) (id string, err error)
- func (u *Example2UpsertOne) IDX(ctx context.Context) string
- func (u *Example2UpsertOne) Ignore() *Example2UpsertOne
- func (u *Example2UpsertOne) SetDeletedAt(v time.Time) *Example2UpsertOne
- func (u *Example2UpsertOne) SetExampleValue2(v string) *Example2UpsertOne
- func (u *Example2UpsertOne) SetUpdatedAt(v time.Time) *Example2UpsertOne
- func (u *Example2UpsertOne) Update(set func(*Example2Upsert)) *Example2UpsertOne
- func (u *Example2UpsertOne) UpdateDeletedAt() *Example2UpsertOne
- func (u *Example2UpsertOne) UpdateExampleValue2() *Example2UpsertOne
- func (u *Example2UpsertOne) UpdateNewValues() *Example2UpsertOne
- func (u *Example2UpsertOne) UpdateUpdatedAt() *Example2UpsertOne
- type Example2s
- type ExposedTxDriver
- type Hook
- type InterceptFunc
- type Interceptor
- 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. TypeExample2 = "Example2" )
Variables ¶
var ErrTxStarted = errors.New("db: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
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(db.As(db.Sum(field1), "sum_field1"), (db.As(db.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 // Example2 is the client for interacting with the Example2 builders. Example2 *Example2Client // 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(). Example2. Query(). Count(ctx)
func (*Client) GetConfig ¶
func (c *Client) GetConfig() *entutils.RawEntConfig
func (*Client) HijackTx ¶
func (c *Client) HijackTx(ctx context.Context, opts *sql.TxOptions) (context.Context, *entutils.RawEntConfig, *ExposedTxDriver, error)
HijackTx returns a new transaction driver with the provided options. The returned transaction can later be used to instanciate new clients.
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 Example2 ¶
type Example2 struct { // ID of the ent. ID string `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // ExampleValue2 holds the value of the "example_value_2" field. ExampleValue2 string `json:"example_value_2,omitempty"` // contains filtered or unexported fields }
Example2 is the model entity for the Example2 schema.
func (*Example2) Unwrap ¶
Unwrap unwraps the Example2 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 (*Example2) Update ¶
func (e *Example2) Update() *Example2UpdateOne
Update returns a builder for updating this Example2. Note that you need to call Example2.Unwrap() before calling this method if this Example2 was returned from a transaction, and the transaction was committed or rolled back.
type Example2Client ¶
type Example2Client struct {
// contains filtered or unexported fields
}
Example2Client is a client for the Example2 schema.
func NewExample2Client ¶
func NewExample2Client(c config) *Example2Client
NewExample2Client returns a client for the Example2 from the given config.
func (*Example2Client) Create ¶
func (c *Example2Client) Create() *Example2Create
Create returns a builder for creating a Example2 entity.
func (*Example2Client) CreateBulk ¶
func (c *Example2Client) CreateBulk(builders ...*Example2Create) *Example2CreateBulk
CreateBulk returns a builder for creating a bulk of Example2 entities.
func (*Example2Client) Delete ¶
func (c *Example2Client) Delete() *Example2Delete
Delete returns a delete builder for Example2.
func (*Example2Client) DeleteOne ¶
func (c *Example2Client) DeleteOne(e *Example2) *Example2DeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*Example2Client) DeleteOneID ¶
func (c *Example2Client) DeleteOneID(id string) *Example2DeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*Example2Client) GetX ¶
func (c *Example2Client) GetX(ctx context.Context, id string) *Example2
GetX is like Get, but panics if an error occurs.
func (*Example2Client) Hooks ¶
func (c *Example2Client) Hooks() []Hook
Hooks returns the client hooks.
func (*Example2Client) Intercept ¶
func (c *Example2Client) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `example2.Intercept(f(g(h())))`.
func (*Example2Client) Interceptors ¶
func (c *Example2Client) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*Example2Client) MapCreateBulk ¶
func (c *Example2Client) MapCreateBulk(slice any, setFunc func(*Example2Create, int)) *Example2CreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*Example2Client) Query ¶
func (c *Example2Client) Query() *Example2Query
Query returns a query builder for Example2.
func (*Example2Client) Update ¶
func (c *Example2Client) Update() *Example2Update
Update returns an update builder for Example2.
func (*Example2Client) UpdateOne ¶
func (c *Example2Client) UpdateOne(e *Example2) *Example2UpdateOne
UpdateOne returns an update builder for the given entity.
func (*Example2Client) UpdateOneID ¶
func (c *Example2Client) UpdateOneID(id string) *Example2UpdateOne
UpdateOneID returns an update builder for the given id.
func (*Example2Client) Use ¶
func (c *Example2Client) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `example2.Hooks(f(g(h())))`.
type Example2Create ¶
type Example2Create struct {
// contains filtered or unexported fields
}
Example2Create is the builder for creating a Example2 entity.
func (*Example2Create) Exec ¶
func (e *Example2Create) Exec(ctx context.Context) error
Exec executes the query.
func (*Example2Create) ExecX ¶
func (e *Example2Create) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2Create) Mutation ¶
func (e *Example2Create) Mutation() *Example2Mutation
Mutation returns the Example2Mutation object of the builder.
func (*Example2Create) OnConflict ¶
func (e *Example2Create) OnConflict(opts ...sql.ConflictOption) *Example2UpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Example2.Create(). SetCreatedAt(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.Example2Upsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*Example2Create) OnConflictColumns ¶
func (e *Example2Create) OnConflictColumns(columns ...string) *Example2UpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Example2.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*Example2Create) Save ¶
func (e *Example2Create) Save(ctx context.Context) (*Example2, error)
Save creates the Example2 in the database.
func (*Example2Create) SaveX ¶
func (e *Example2Create) SaveX(ctx context.Context) *Example2
SaveX calls Save and panics if Save returns an error.
func (*Example2Create) SetCreatedAt ¶
func (e *Example2Create) SetCreatedAt(t time.Time) *Example2Create
SetCreatedAt sets the "created_at" field.
func (*Example2Create) SetDeletedAt ¶
func (e *Example2Create) SetDeletedAt(t time.Time) *Example2Create
SetDeletedAt sets the "deleted_at" field.
func (*Example2Create) SetExampleValue2 ¶
func (e *Example2Create) SetExampleValue2(s string) *Example2Create
SetExampleValue2 sets the "example_value_2" field.
func (*Example2Create) SetID ¶
func (e *Example2Create) SetID(s string) *Example2Create
SetID sets the "id" field.
func (*Example2Create) SetNillableCreatedAt ¶
func (e *Example2Create) SetNillableCreatedAt(t *time.Time) *Example2Create
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*Example2Create) SetNillableDeletedAt ¶
func (e *Example2Create) SetNillableDeletedAt(t *time.Time) *Example2Create
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*Example2Create) SetNillableUpdatedAt ¶
func (e *Example2Create) SetNillableUpdatedAt(t *time.Time) *Example2Create
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*Example2Create) SetUpdatedAt ¶
func (e *Example2Create) SetUpdatedAt(t time.Time) *Example2Create
SetUpdatedAt sets the "updated_at" field.
type Example2CreateBulk ¶
type Example2CreateBulk struct {
// contains filtered or unexported fields
}
Example2CreateBulk is the builder for creating many Example2 entities in bulk.
func (*Example2CreateBulk) Exec ¶
func (eb *Example2CreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*Example2CreateBulk) ExecX ¶
func (eb *Example2CreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2CreateBulk) OnConflict ¶
func (eb *Example2CreateBulk) OnConflict(opts ...sql.ConflictOption) *Example2UpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Example2.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.Example2Upsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*Example2CreateBulk) OnConflictColumns ¶
func (eb *Example2CreateBulk) OnConflictColumns(columns ...string) *Example2UpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Example2.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type Example2Delete ¶
type Example2Delete struct {
// contains filtered or unexported fields
}
Example2Delete is the builder for deleting a Example2 entity.
func (*Example2Delete) Exec ¶
func (e *Example2Delete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*Example2Delete) ExecX ¶
func (e *Example2Delete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*Example2Delete) Where ¶
func (e *Example2Delete) Where(ps ...predicate.Example2) *Example2Delete
Where appends a list predicates to the Example2Delete builder.
type Example2DeleteOne ¶
type Example2DeleteOne struct {
// contains filtered or unexported fields
}
Example2DeleteOne is the builder for deleting a single Example2 entity.
func (*Example2DeleteOne) Exec ¶
func (eo *Example2DeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*Example2DeleteOne) ExecX ¶
func (eo *Example2DeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2DeleteOne) Where ¶
func (eo *Example2DeleteOne) Where(ps ...predicate.Example2) *Example2DeleteOne
Where appends a list predicates to the Example2Delete builder.
type Example2GroupBy ¶
type Example2GroupBy struct {
// contains filtered or unexported fields
}
Example2GroupBy is the group-by builder for Example2 entities.
func (*Example2GroupBy) Aggregate ¶
func (eb *Example2GroupBy) Aggregate(fns ...AggregateFunc) *Example2GroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*Example2GroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*Example2GroupBy) Scan ¶
func (eb *Example2GroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*Example2GroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type Example2Mutation ¶
type Example2Mutation struct {
// contains filtered or unexported fields
}
Example2Mutation represents an operation that mutates the Example2 nodes in the graph.
func (*Example2Mutation) AddField ¶
func (m *Example2Mutation) 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 (*Example2Mutation) AddedEdges ¶
func (m *Example2Mutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*Example2Mutation) AddedField ¶
func (m *Example2Mutation) 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 (*Example2Mutation) AddedFields ¶
func (m *Example2Mutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*Example2Mutation) AddedIDs ¶
func (m *Example2Mutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*Example2Mutation) ClearDeletedAt ¶
func (m *Example2Mutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2Mutation) ClearEdge ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ClearField ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ClearedEdges ¶
func (m *Example2Mutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*Example2Mutation) ClearedFields ¶
func (m *Example2Mutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (Example2Mutation) Client ¶
func (m Example2Mutation) 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 (*Example2Mutation) CreatedAt ¶
func (m *Example2Mutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*Example2Mutation) DeletedAt ¶
func (m *Example2Mutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*Example2Mutation) DeletedAtCleared ¶
func (m *Example2Mutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*Example2Mutation) EdgeCleared ¶
func (m *Example2Mutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*Example2Mutation) ExampleValue2 ¶
func (m *Example2Mutation) ExampleValue2() (r string, exists bool)
ExampleValue2 returns the value of the "example_value_2" field in the mutation.
func (*Example2Mutation) Field ¶
func (m *Example2Mutation) 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 (*Example2Mutation) FieldCleared ¶
func (m *Example2Mutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*Example2Mutation) Fields ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ID ¶
func (m *Example2Mutation) ID() (id string, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*Example2Mutation) IDs ¶
func (m *Example2Mutation) IDs(ctx context.Context) ([]string, 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 (*Example2Mutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Example2 entity. If the Example2 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 (*Example2Mutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the Example2 entity. If the Example2 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 (*Example2Mutation) OldExampleValue2 ¶
func (m *Example2Mutation) OldExampleValue2(ctx context.Context) (v string, err error)
OldExampleValue2 returns the old "example_value_2" field's value of the Example2 entity. If the Example2 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 (*Example2Mutation) 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 (*Example2Mutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Example2 entity. If the Example2 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 (*Example2Mutation) RemovedEdges ¶
func (m *Example2Mutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*Example2Mutation) RemovedIDs ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ResetCreatedAt ¶
func (m *Example2Mutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*Example2Mutation) ResetDeletedAt ¶
func (m *Example2Mutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*Example2Mutation) ResetEdge ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ResetExampleValue2 ¶
func (m *Example2Mutation) ResetExampleValue2()
ResetExampleValue2 resets all changes to the "example_value_2" field.
func (*Example2Mutation) ResetField ¶
func (m *Example2Mutation) 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 (*Example2Mutation) ResetUpdatedAt ¶
func (m *Example2Mutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*Example2Mutation) SetCreatedAt ¶
func (m *Example2Mutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*Example2Mutation) SetDeletedAt ¶
func (m *Example2Mutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*Example2Mutation) SetExampleValue2 ¶
func (m *Example2Mutation) SetExampleValue2(s string)
SetExampleValue2 sets the "example_value_2" field.
func (*Example2Mutation) SetField ¶
func (m *Example2Mutation) 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 (*Example2Mutation) SetID ¶
func (m *Example2Mutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Example2 entities.
func (*Example2Mutation) SetOp ¶
func (m *Example2Mutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*Example2Mutation) SetUpdatedAt ¶
func (m *Example2Mutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (Example2Mutation) Tx ¶
func (m Example2Mutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*Example2Mutation) Type ¶
func (m *Example2Mutation) Type() string
Type returns the node type of this mutation (Example2).
func (*Example2Mutation) UpdatedAt ¶
func (m *Example2Mutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*Example2Mutation) Where ¶
func (m *Example2Mutation) Where(ps ...predicate.Example2)
Where appends a list predicates to the Example2Mutation builder.
func (*Example2Mutation) WhereP ¶
func (m *Example2Mutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the Example2Mutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type Example2Query ¶
type Example2Query struct {
// contains filtered or unexported fields
}
Example2Query is the builder for querying Example2 entities.
func (*Example2Query) Aggregate ¶
func (e *Example2Query) Aggregate(fns ...AggregateFunc) *Example2Select
Aggregate returns a Example2Select configured with the given aggregations.
func (*Example2Query) All ¶
func (e *Example2Query) All(ctx context.Context) ([]*Example2, error)
All executes the query and returns a list of Example2s.
func (*Example2Query) AllX ¶
func (e *Example2Query) AllX(ctx context.Context) []*Example2
AllX is like All, but panics if an error occurs.
func (*Example2Query) Clone ¶
func (e *Example2Query) Clone() *Example2Query
Clone returns a duplicate of the Example2Query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*Example2Query) Count ¶
func (e *Example2Query) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*Example2Query) CountX ¶
func (e *Example2Query) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*Example2Query) Exist ¶
func (e *Example2Query) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*Example2Query) ExistX ¶
func (e *Example2Query) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*Example2Query) First ¶
func (e *Example2Query) First(ctx context.Context) (*Example2, error)
First returns the first Example2 entity from the query. Returns a *NotFoundError when no Example2 was found.
func (*Example2Query) FirstID ¶
func (e *Example2Query) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Example2 ID from the query. Returns a *NotFoundError when no Example2 ID was found.
func (*Example2Query) FirstIDX ¶
func (e *Example2Query) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*Example2Query) FirstX ¶
func (e *Example2Query) FirstX(ctx context.Context) *Example2
FirstX is like First, but panics if an error occurs.
func (*Example2Query) ForShare ¶
func (e *Example2Query) ForShare(opts ...sql.LockOption) *Example2Query
ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
func (*Example2Query) ForUpdate ¶
func (e *Example2Query) ForUpdate(opts ...sql.LockOption) *Example2Query
ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
func (*Example2Query) GroupBy ¶
func (e *Example2Query) GroupBy(field string, fields ...string) *Example2GroupBy
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 { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Example2.Query(). GroupBy(example2.FieldCreatedAt). Aggregate(db.Count()). Scan(ctx, &v)
func (*Example2Query) IDs ¶
func (e *Example2Query) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of Example2 IDs.
func (*Example2Query) IDsX ¶
func (e *Example2Query) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*Example2Query) Limit ¶
func (e *Example2Query) Limit(limit int) *Example2Query
Limit the number of records to be returned by this query.
func (*Example2Query) Offset ¶
func (e *Example2Query) Offset(offset int) *Example2Query
Offset to start from.
func (*Example2Query) Only ¶
func (e *Example2Query) Only(ctx context.Context) (*Example2, error)
Only returns a single Example2 entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Example2 entity is found. Returns a *NotFoundError when no Example2 entities are found.
func (*Example2Query) OnlyID ¶
func (e *Example2Query) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Example2 ID in the query. Returns a *NotSingularError when more than one Example2 ID is found. Returns a *NotFoundError when no entities are found.
func (*Example2Query) OnlyIDX ¶
func (e *Example2Query) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*Example2Query) OnlyX ¶
func (e *Example2Query) OnlyX(ctx context.Context) *Example2
OnlyX is like Only, but panics if an error occurs.
func (*Example2Query) Order ¶
func (e *Example2Query) Order(o ...example2.OrderOption) *Example2Query
Order specifies how the records should be ordered.
func (*Example2Query) Select ¶
func (e *Example2Query) Select(fields ...string) *Example2Select
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 { CreatedAt time.Time `json:"created_at,omitempty"` } client.Example2.Query(). Select(example2.FieldCreatedAt). Scan(ctx, &v)
func (*Example2Query) Unique ¶
func (e *Example2Query) Unique(unique bool) *Example2Query
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 (*Example2Query) Where ¶
func (e *Example2Query) Where(ps ...predicate.Example2) *Example2Query
Where adds a new predicate for the Example2Query builder.
type Example2Select ¶
type Example2Select struct { *Example2Query // contains filtered or unexported fields }
Example2Select is the builder for selecting fields of Example2 entities.
func (*Example2Select) Aggregate ¶
func (e *Example2Select) Aggregate(fns ...AggregateFunc) *Example2Select
Aggregate adds the given aggregation functions to the selector query.
func (*Example2Select) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*Example2Select) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*Example2Select) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*Example2Select) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*Example2Select) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*Example2Select) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*Example2Select) Scan ¶
func (e *Example2Select) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*Example2Select) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type Example2Update ¶
type Example2Update struct {
// contains filtered or unexported fields
}
Example2Update is the builder for updating Example2 entities.
func (*Example2Update) ClearDeletedAt ¶
func (e *Example2Update) ClearDeletedAt() *Example2Update
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2Update) Exec ¶
func (e *Example2Update) Exec(ctx context.Context) error
Exec executes the query.
func (*Example2Update) ExecX ¶
func (e *Example2Update) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2Update) Mutation ¶
func (e *Example2Update) Mutation() *Example2Mutation
Mutation returns the Example2Mutation object of the builder.
func (*Example2Update) Save ¶
func (e *Example2Update) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*Example2Update) SaveX ¶
func (e *Example2Update) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*Example2Update) SetDeletedAt ¶
func (e *Example2Update) SetDeletedAt(t time.Time) *Example2Update
SetDeletedAt sets the "deleted_at" field.
func (*Example2Update) SetExampleValue2 ¶
func (e *Example2Update) SetExampleValue2(s string) *Example2Update
SetExampleValue2 sets the "example_value_2" field.
func (*Example2Update) SetNillableDeletedAt ¶
func (e *Example2Update) SetNillableDeletedAt(t *time.Time) *Example2Update
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*Example2Update) SetNillableExampleValue2 ¶
func (e *Example2Update) SetNillableExampleValue2(s *string) *Example2Update
SetNillableExampleValue2 sets the "example_value_2" field if the given value is not nil.
func (*Example2Update) SetUpdatedAt ¶
func (e *Example2Update) SetUpdatedAt(t time.Time) *Example2Update
SetUpdatedAt sets the "updated_at" field.
func (*Example2Update) Where ¶
func (e *Example2Update) Where(ps ...predicate.Example2) *Example2Update
Where appends a list predicates to the Example2Update builder.
type Example2UpdateOne ¶
type Example2UpdateOne struct {
// contains filtered or unexported fields
}
Example2UpdateOne is the builder for updating a single Example2 entity.
func (*Example2UpdateOne) ClearDeletedAt ¶
func (eo *Example2UpdateOne) ClearDeletedAt() *Example2UpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2UpdateOne) Exec ¶
func (eo *Example2UpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*Example2UpdateOne) ExecX ¶
func (eo *Example2UpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2UpdateOne) Mutation ¶
func (eo *Example2UpdateOne) Mutation() *Example2Mutation
Mutation returns the Example2Mutation object of the builder.
func (*Example2UpdateOne) Save ¶
func (eo *Example2UpdateOne) Save(ctx context.Context) (*Example2, error)
Save executes the query and returns the updated Example2 entity.
func (*Example2UpdateOne) SaveX ¶
func (eo *Example2UpdateOne) SaveX(ctx context.Context) *Example2
SaveX is like Save, but panics if an error occurs.
func (*Example2UpdateOne) Select ¶
func (eo *Example2UpdateOne) Select(field string, fields ...string) *Example2UpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*Example2UpdateOne) SetDeletedAt ¶
func (eo *Example2UpdateOne) SetDeletedAt(t time.Time) *Example2UpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*Example2UpdateOne) SetExampleValue2 ¶
func (eo *Example2UpdateOne) SetExampleValue2(s string) *Example2UpdateOne
SetExampleValue2 sets the "example_value_2" field.
func (*Example2UpdateOne) SetNillableDeletedAt ¶
func (eo *Example2UpdateOne) SetNillableDeletedAt(t *time.Time) *Example2UpdateOne
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*Example2UpdateOne) SetNillableExampleValue2 ¶
func (eo *Example2UpdateOne) SetNillableExampleValue2(s *string) *Example2UpdateOne
SetNillableExampleValue2 sets the "example_value_2" field if the given value is not nil.
func (*Example2UpdateOne) SetUpdatedAt ¶
func (eo *Example2UpdateOne) SetUpdatedAt(t time.Time) *Example2UpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*Example2UpdateOne) Where ¶
func (eo *Example2UpdateOne) Where(ps ...predicate.Example2) *Example2UpdateOne
Where appends a list predicates to the Example2Update builder.
type Example2Upsert ¶
Example2Upsert is the "OnConflict" setter.
func (*Example2Upsert) ClearDeletedAt ¶
func (u *Example2Upsert) ClearDeletedAt() *Example2Upsert
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2Upsert) SetDeletedAt ¶
func (u *Example2Upsert) SetDeletedAt(v time.Time) *Example2Upsert
SetDeletedAt sets the "deleted_at" field.
func (*Example2Upsert) SetExampleValue2 ¶
func (u *Example2Upsert) SetExampleValue2(v string) *Example2Upsert
SetExampleValue2 sets the "example_value_2" field.
func (*Example2Upsert) SetUpdatedAt ¶
func (u *Example2Upsert) SetUpdatedAt(v time.Time) *Example2Upsert
SetUpdatedAt sets the "updated_at" field.
func (*Example2Upsert) UpdateDeletedAt ¶
func (u *Example2Upsert) UpdateDeletedAt() *Example2Upsert
UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (*Example2Upsert) UpdateExampleValue2 ¶
func (u *Example2Upsert) UpdateExampleValue2() *Example2Upsert
UpdateExampleValue2 sets the "example_value_2" field to the value that was provided on create.
func (*Example2Upsert) UpdateUpdatedAt ¶
func (u *Example2Upsert) UpdateUpdatedAt() *Example2Upsert
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type Example2UpsertBulk ¶
type Example2UpsertBulk struct {
// contains filtered or unexported fields
}
Example2UpsertBulk is the builder for "upsert"-ing a bulk of Example2 nodes.
func (*Example2UpsertBulk) ClearDeletedAt ¶
func (u *Example2UpsertBulk) ClearDeletedAt() *Example2UpsertBulk
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2UpsertBulk) DoNothing ¶
func (u *Example2UpsertBulk) DoNothing() *Example2UpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*Example2UpsertBulk) Exec ¶
func (u *Example2UpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*Example2UpsertBulk) ExecX ¶
func (u *Example2UpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2UpsertBulk) Ignore ¶
func (u *Example2UpsertBulk) Ignore() *Example2UpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Example2.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*Example2UpsertBulk) SetDeletedAt ¶
func (u *Example2UpsertBulk) SetDeletedAt(v time.Time) *Example2UpsertBulk
SetDeletedAt sets the "deleted_at" field.
func (*Example2UpsertBulk) SetExampleValue2 ¶
func (u *Example2UpsertBulk) SetExampleValue2(v string) *Example2UpsertBulk
SetExampleValue2 sets the "example_value_2" field.
func (*Example2UpsertBulk) SetUpdatedAt ¶
func (u *Example2UpsertBulk) SetUpdatedAt(v time.Time) *Example2UpsertBulk
SetUpdatedAt sets the "updated_at" field.
func (*Example2UpsertBulk) Update ¶
func (u *Example2UpsertBulk) Update(set func(*Example2Upsert)) *Example2UpsertBulk
Update allows overriding fields `UPDATE` values. See the Example2CreateBulk.OnConflict documentation for more info.
func (*Example2UpsertBulk) UpdateDeletedAt ¶
func (u *Example2UpsertBulk) UpdateDeletedAt() *Example2UpsertBulk
UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (*Example2UpsertBulk) UpdateExampleValue2 ¶
func (u *Example2UpsertBulk) UpdateExampleValue2() *Example2UpsertBulk
UpdateExampleValue2 sets the "example_value_2" field to the value that was provided on create.
func (*Example2UpsertBulk) UpdateNewValues ¶
func (u *Example2UpsertBulk) UpdateNewValues() *Example2UpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Example2.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(example2.FieldID) }), ). Exec(ctx)
func (*Example2UpsertBulk) UpdateUpdatedAt ¶
func (u *Example2UpsertBulk) UpdateUpdatedAt() *Example2UpsertBulk
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type Example2UpsertOne ¶
type Example2UpsertOne struct {
// contains filtered or unexported fields
}
Example2UpsertOne is the builder for "upsert"-ing
one Example2 node.
func (*Example2UpsertOne) ClearDeletedAt ¶
func (u *Example2UpsertOne) ClearDeletedAt() *Example2UpsertOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*Example2UpsertOne) DoNothing ¶
func (u *Example2UpsertOne) DoNothing() *Example2UpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*Example2UpsertOne) Exec ¶
func (u *Example2UpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*Example2UpsertOne) ExecX ¶
func (u *Example2UpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*Example2UpsertOne) ID ¶
func (u *Example2UpsertOne) ID(ctx context.Context) (id string, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*Example2UpsertOne) IDX ¶
func (u *Example2UpsertOne) IDX(ctx context.Context) string
IDX is like ID, but panics if an error occurs.
func (*Example2UpsertOne) Ignore ¶
func (u *Example2UpsertOne) Ignore() *Example2UpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Example2.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*Example2UpsertOne) SetDeletedAt ¶
func (u *Example2UpsertOne) SetDeletedAt(v time.Time) *Example2UpsertOne
SetDeletedAt sets the "deleted_at" field.
func (*Example2UpsertOne) SetExampleValue2 ¶
func (u *Example2UpsertOne) SetExampleValue2(v string) *Example2UpsertOne
SetExampleValue2 sets the "example_value_2" field.
func (*Example2UpsertOne) SetUpdatedAt ¶
func (u *Example2UpsertOne) SetUpdatedAt(v time.Time) *Example2UpsertOne
SetUpdatedAt sets the "updated_at" field.
func (*Example2UpsertOne) Update ¶
func (u *Example2UpsertOne) Update(set func(*Example2Upsert)) *Example2UpsertOne
Update allows overriding fields `UPDATE` values. See the Example2Create.OnConflict documentation for more info.
func (*Example2UpsertOne) UpdateDeletedAt ¶
func (u *Example2UpsertOne) UpdateDeletedAt() *Example2UpsertOne
UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
func (*Example2UpsertOne) UpdateExampleValue2 ¶
func (u *Example2UpsertOne) UpdateExampleValue2() *Example2UpsertOne
UpdateExampleValue2 sets the "example_value_2" field to the value that was provided on create.
func (*Example2UpsertOne) UpdateNewValues ¶
func (u *Example2UpsertOne) UpdateNewValues() *Example2UpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:
client.Example2.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(example2.FieldID) }), ). Exec(ctx)
func (*Example2UpsertOne) UpdateUpdatedAt ¶
func (u *Example2UpsertOne) UpdateUpdatedAt() *Example2UpsertOne
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type ExposedTxDriver ¶
type ExposedTxDriver struct {
Driver *txDriver
}
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type 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 { // Example2 is the client for interacting with the Example2 builders. Example2 *Example2Client // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func NewTxClientFromRawConfig ¶
func NewTxClientFromRawConfig(ctx context.Context, cfg entutils.RawEntConfig) *Tx
NewTxClientFromConfig creates a new transactional client from a (hijacked) configuration.
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.