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) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type Lock
- func (c *Lock) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *Lock) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (l *Lock) String() string
- func (l *Lock) Unwrap() *Lock
- func (l *Lock) Update() *LockUpdateOne
- func (l *Lock) Value(name string) (ent.Value, error)
- type LockClient
- func (c *LockClient) Create() *LockCreate
- func (c *LockClient) CreateBulk(builders ...*LockCreate) *LockCreateBulk
- func (c *LockClient) Delete() *LockDelete
- func (c *LockClient) DeleteOne(l *Lock) *LockDeleteOne
- func (c *LockClient) DeleteOneID(id string) *LockDeleteOne
- func (c *LockClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *LockClient) Get(ctx context.Context, id string) (*Lock, error)
- func (c *LockClient) GetX(ctx context.Context, id string) *Lock
- func (c *LockClient) Hooks() []Hook
- func (c *LockClient) Intercept(interceptors ...Interceptor)
- func (c *LockClient) Interceptors() []Interceptor
- func (c *LockClient) MapCreateBulk(slice any, setFunc func(*LockCreate, int)) *LockCreateBulk
- func (c *LockClient) Query() *LockQuery
- func (c *LockClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *LockClient) Update() *LockUpdate
- func (c *LockClient) UpdateOne(l *Lock) *LockUpdateOne
- func (c *LockClient) UpdateOneID(id string) *LockUpdateOne
- func (c *LockClient) Use(hooks ...Hook)
- type LockCreate
- func (lc *LockCreate) Exec(ctx context.Context) error
- func (c *LockCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (lc *LockCreate) ExecX(ctx context.Context)
- func (lc *LockCreate) Mutation() *LockMutation
- func (lc *LockCreate) OnConflict(opts ...sql.ConflictOption) *LockUpsertOne
- func (lc *LockCreate) OnConflictColumns(columns ...string) *LockUpsertOne
- func (c *LockCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (lc *LockCreate) Save(ctx context.Context) (*Lock, error)
- func (lc *LockCreate) SaveX(ctx context.Context) *Lock
- func (lc *LockCreate) SetID(s string) *LockCreate
- func (lc *LockCreate) SetNillableVersion(u *uuid.UUID) *LockCreate
- func (lc *LockCreate) SetOwner(s string) *LockCreate
- func (lc *LockCreate) SetVersion(u uuid.UUID) *LockCreate
- type LockCreateBulk
- func (lcb *LockCreateBulk) Exec(ctx context.Context) error
- func (c *LockCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (lcb *LockCreateBulk) ExecX(ctx context.Context)
- func (lcb *LockCreateBulk) OnConflict(opts ...sql.ConflictOption) *LockUpsertBulk
- func (lcb *LockCreateBulk) OnConflictColumns(columns ...string) *LockUpsertBulk
- func (c *LockCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (lcb *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error)
- func (lcb *LockCreateBulk) SaveX(ctx context.Context) []*Lock
- type LockDelete
- func (ld *LockDelete) Exec(ctx context.Context) (int, error)
- func (c *LockDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (ld *LockDelete) ExecX(ctx context.Context) int
- func (c *LockDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ld *LockDelete) Where(ps ...predicate.Lock) *LockDelete
- type LockDeleteOne
- type LockGroupBy
- func (lgb *LockGroupBy) Aggregate(fns ...AggregateFunc) *LockGroupBy
- func (s *LockGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *LockGroupBy) BoolX(ctx context.Context) bool
- func (s *LockGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *LockGroupBy) BoolsX(ctx context.Context) []bool
- func (s *LockGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *LockGroupBy) Float64X(ctx context.Context) float64
- func (s *LockGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *LockGroupBy) Float64sX(ctx context.Context) []float64
- func (s *LockGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *LockGroupBy) IntX(ctx context.Context) int
- func (s *LockGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *LockGroupBy) IntsX(ctx context.Context) []int
- func (lgb *LockGroupBy) Scan(ctx context.Context, v any) error
- func (s *LockGroupBy) ScanX(ctx context.Context, v any)
- func (s *LockGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *LockGroupBy) StringX(ctx context.Context) string
- func (s *LockGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *LockGroupBy) StringsX(ctx context.Context) []string
- type LockMutation
- func (m *LockMutation) AddField(name string, value ent.Value) error
- func (m *LockMutation) AddedEdges() []string
- func (m *LockMutation) AddedField(name string) (ent.Value, bool)
- func (m *LockMutation) AddedFields() []string
- func (m *LockMutation) AddedIDs(name string) []ent.Value
- func (m *LockMutation) ClearEdge(name string) error
- func (m *LockMutation) ClearField(name string) error
- func (m *LockMutation) ClearVersion()
- func (m *LockMutation) ClearedEdges() []string
- func (m *LockMutation) ClearedFields() []string
- func (m LockMutation) Client() *Client
- func (m *LockMutation) EdgeCleared(name string) bool
- func (c *LockMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (m *LockMutation) Field(name string) (ent.Value, bool)
- func (m *LockMutation) FieldCleared(name string) bool
- func (m *LockMutation) Fields() []string
- func (m *LockMutation) ID() (id string, exists bool)
- func (m *LockMutation) IDs(ctx context.Context) ([]string, error)
- func (m *LockMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *LockMutation) OldOwner(ctx context.Context) (v string, err error)
- func (m *LockMutation) OldVersion(ctx context.Context) (v uuid.UUID, err error)
- func (m *LockMutation) Op() Op
- func (m *LockMutation) Owner() (r string, exists bool)
- func (c *LockMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (m *LockMutation) RemovedEdges() []string
- func (m *LockMutation) RemovedIDs(name string) []ent.Value
- func (m *LockMutation) ResetEdge(name string) error
- func (m *LockMutation) ResetField(name string) error
- func (m *LockMutation) ResetOwner()
- func (m *LockMutation) ResetVersion()
- func (m *LockMutation) SetField(name string, value ent.Value) error
- func (m *LockMutation) SetID(id string)
- func (m *LockMutation) SetOp(op Op)
- func (m *LockMutation) SetOwner(s string)
- func (m *LockMutation) SetVersion(u uuid.UUID)
- func (m LockMutation) Tx() (*Tx, error)
- func (m *LockMutation) Type() string
- func (m *LockMutation) Version() (r uuid.UUID, exists bool)
- func (m *LockMutation) VersionCleared() bool
- func (m *LockMutation) Where(ps ...predicate.Lock)
- func (m *LockMutation) WhereP(ps ...func(*sql.Selector))
- type LockQuery
- func (lq *LockQuery) Aggregate(fns ...AggregateFunc) *LockSelect
- func (lq *LockQuery) All(ctx context.Context) ([]*Lock, error)
- func (lq *LockQuery) AllX(ctx context.Context) []*Lock
- func (lq *LockQuery) Clone() *LockQuery
- func (lq *LockQuery) Count(ctx context.Context) (int, error)
- func (lq *LockQuery) CountX(ctx context.Context) int
- func (c *LockQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (lq *LockQuery) Exist(ctx context.Context) (bool, error)
- func (lq *LockQuery) ExistX(ctx context.Context) bool
- func (lq *LockQuery) First(ctx context.Context) (*Lock, error)
- func (lq *LockQuery) FirstID(ctx context.Context) (id string, err error)
- func (lq *LockQuery) FirstIDX(ctx context.Context) string
- func (lq *LockQuery) FirstX(ctx context.Context) *Lock
- func (lq *LockQuery) GroupBy(field string, fields ...string) *LockGroupBy
- func (lq *LockQuery) IDs(ctx context.Context) (ids []string, err error)
- func (lq *LockQuery) IDsX(ctx context.Context) []string
- func (lq *LockQuery) Limit(limit int) *LockQuery
- func (lq *LockQuery) Modify(modifiers ...func(s *sql.Selector)) *LockSelect
- func (lq *LockQuery) Offset(offset int) *LockQuery
- func (lq *LockQuery) Only(ctx context.Context) (*Lock, error)
- func (lq *LockQuery) OnlyID(ctx context.Context) (id string, err error)
- func (lq *LockQuery) OnlyIDX(ctx context.Context) string
- func (lq *LockQuery) OnlyX(ctx context.Context) *Lock
- func (lq *LockQuery) Order(o ...lock.OrderOption) *LockQuery
- func (c *LockQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (lq *LockQuery) Select(fields ...string) *LockSelect
- func (lq *LockQuery) Unique(unique bool) *LockQuery
- func (lq *LockQuery) Where(ps ...predicate.Lock) *LockQuery
- type LockSelect
- func (ls *LockSelect) Aggregate(fns ...AggregateFunc) *LockSelect
- func (s *LockSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *LockSelect) BoolX(ctx context.Context) bool
- func (s *LockSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *LockSelect) BoolsX(ctx context.Context) []bool
- func (c LockSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (s *LockSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *LockSelect) Float64X(ctx context.Context) float64
- func (s *LockSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *LockSelect) Float64sX(ctx context.Context) []float64
- func (s *LockSelect) Int(ctx context.Context) (_ int, err error)
- func (s *LockSelect) IntX(ctx context.Context) int
- func (s *LockSelect) Ints(ctx context.Context) ([]int, error)
- func (s *LockSelect) IntsX(ctx context.Context) []int
- func (ls *LockSelect) Modify(modifiers ...func(s *sql.Selector)) *LockSelect
- func (c LockSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ls *LockSelect) Scan(ctx context.Context, v any) error
- func (s *LockSelect) ScanX(ctx context.Context, v any)
- func (s *LockSelect) String(ctx context.Context) (_ string, err error)
- func (s *LockSelect) StringX(ctx context.Context) string
- func (s *LockSelect) Strings(ctx context.Context) ([]string, error)
- func (s *LockSelect) StringsX(ctx context.Context) []string
- type LockUpdate
- func (lu *LockUpdate) ClearVersion() *LockUpdate
- func (lu *LockUpdate) Exec(ctx context.Context) error
- func (c *LockUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (lu *LockUpdate) ExecX(ctx context.Context)
- func (lu *LockUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LockUpdate
- func (lu *LockUpdate) Mutation() *LockMutation
- func (c *LockUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (lu *LockUpdate) Save(ctx context.Context) (int, error)
- func (lu *LockUpdate) SaveX(ctx context.Context) int
- func (lu *LockUpdate) SetNillableOwner(s *string) *LockUpdate
- func (lu *LockUpdate) SetNillableVersion(u *uuid.UUID) *LockUpdate
- func (lu *LockUpdate) SetOwner(s string) *LockUpdate
- func (lu *LockUpdate) SetVersion(u uuid.UUID) *LockUpdate
- func (lu *LockUpdate) Where(ps ...predicate.Lock) *LockUpdate
- type LockUpdateOne
- func (luo *LockUpdateOne) ClearVersion() *LockUpdateOne
- func (luo *LockUpdateOne) Exec(ctx context.Context) error
- func (c *LockUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (luo *LockUpdateOne) ExecX(ctx context.Context)
- func (luo *LockUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LockUpdateOne
- func (luo *LockUpdateOne) Mutation() *LockMutation
- func (c *LockUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (luo *LockUpdateOne) Save(ctx context.Context) (*Lock, error)
- func (luo *LockUpdateOne) SaveX(ctx context.Context) *Lock
- func (luo *LockUpdateOne) Select(field string, fields ...string) *LockUpdateOne
- func (luo *LockUpdateOne) SetNillableOwner(s *string) *LockUpdateOne
- func (luo *LockUpdateOne) SetNillableVersion(u *uuid.UUID) *LockUpdateOne
- func (luo *LockUpdateOne) SetOwner(s string) *LockUpdateOne
- func (luo *LockUpdateOne) SetVersion(u uuid.UUID) *LockUpdateOne
- func (luo *LockUpdateOne) Where(ps ...predicate.Lock) *LockUpdateOne
- type LockUpsert
- type LockUpsertBulk
- func (u *LockUpsertBulk) ClearVersion() *LockUpsertBulk
- func (u *LockUpsertBulk) DoNothing() *LockUpsertBulk
- func (u *LockUpsertBulk) Exec(ctx context.Context) error
- func (u *LockUpsertBulk) ExecX(ctx context.Context)
- func (u *LockUpsertBulk) Ignore() *LockUpsertBulk
- func (u *LockUpsertBulk) SetOwner(v string) *LockUpsertBulk
- func (u *LockUpsertBulk) SetVersion(v uuid.UUID) *LockUpsertBulk
- func (u *LockUpsertBulk) Update(set func(*LockUpsert)) *LockUpsertBulk
- func (u *LockUpsertBulk) UpdateNewValues() *LockUpsertBulk
- func (u *LockUpsertBulk) UpdateOwner() *LockUpsertBulk
- func (u *LockUpsertBulk) UpdateVersion() *LockUpsertBulk
- type LockUpsertOne
- func (u *LockUpsertOne) ClearVersion() *LockUpsertOne
- func (u *LockUpsertOne) DoNothing() *LockUpsertOne
- func (u *LockUpsertOne) Exec(ctx context.Context) error
- func (u *LockUpsertOne) ExecX(ctx context.Context)
- func (u *LockUpsertOne) ID(ctx context.Context) (id string, err error)
- func (u *LockUpsertOne) IDX(ctx context.Context) string
- func (u *LockUpsertOne) Ignore() *LockUpsertOne
- func (u *LockUpsertOne) SetOwner(v string) *LockUpsertOne
- func (u *LockUpsertOne) SetVersion(v uuid.UUID) *LockUpsertOne
- func (u *LockUpsertOne) Update(set func(*LockUpsert)) *LockUpsertOne
- func (u *LockUpsertOne) UpdateNewValues() *LockUpsertOne
- func (u *LockUpsertOne) UpdateOwner() *LockUpsertOne
- func (u *LockUpsertOne) UpdateVersion() *LockUpsertOne
- type Locks
- 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
- func (tx *Tx) Client() *Client
- func (tx *Tx) Commit() error
- func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tx *Tx) OnCommit(f CommitHook)
- func (tx *Tx) OnRollback(f RollbackHook)
- func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tx *Tx) Rollback() error
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeLock = "Lock" )
Variables ¶
var ErrTxStarted = errors.New("ent: 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(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 // Lock is the client for interacting with the Lock builders. Lock *LockClient // 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(). Lock. Query(). Count(ctx)
func (*Client) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (*Client) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type 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 Lock ¶
type Lock struct { // ID of the ent. ID string `json:"id,omitempty"` // Version holds the value of the "version" field. Version uuid.UUID `json:"version,omitempty"` // Owner holds the value of the "owner" field. Owner string `json:"owner,omitempty"` // contains filtered or unexported fields }
Lock is the model entity for the Lock schema.
func (*Lock) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Lock) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*Lock) Unwrap ¶
Unwrap unwraps the Lock 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 (*Lock) Update ¶
func (l *Lock) Update() *LockUpdateOne
Update returns a builder for updating this Lock. Note that you need to call Lock.Unwrap() before calling this method if this Lock was returned from a transaction, and the transaction was committed or rolled back.
type LockClient ¶
type LockClient struct {
// contains filtered or unexported fields
}
LockClient is a client for the Lock schema.
func NewLockClient ¶
func NewLockClient(c config) *LockClient
NewLockClient returns a client for the Lock from the given config.
func (*LockClient) Create ¶
func (c *LockClient) Create() *LockCreate
Create returns a builder for creating a Lock entity.
func (*LockClient) CreateBulk ¶
func (c *LockClient) CreateBulk(builders ...*LockCreate) *LockCreateBulk
CreateBulk returns a builder for creating a bulk of Lock entities.
func (*LockClient) Delete ¶
func (c *LockClient) Delete() *LockDelete
Delete returns a delete builder for Lock.
func (*LockClient) DeleteOne ¶
func (c *LockClient) DeleteOne(l *Lock) *LockDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*LockClient) DeleteOneID ¶
func (c *LockClient) DeleteOneID(id string) *LockDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*LockClient) ExecContext ¶
func (c *LockClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockClient) GetX ¶
func (c *LockClient) GetX(ctx context.Context, id string) *Lock
GetX is like Get, but panics if an error occurs.
func (*LockClient) Intercept ¶
func (c *LockClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `lock.Intercept(f(g(h())))`.
func (*LockClient) Interceptors ¶
func (c *LockClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*LockClient) MapCreateBulk ¶
func (c *LockClient) MapCreateBulk(slice any, setFunc func(*LockCreate, int)) *LockCreateBulk
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 (*LockClient) Query ¶
func (c *LockClient) Query() *LockQuery
Query returns a query builder for Lock.
func (*LockClient) QueryContext ¶
func (c *LockClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockClient) Update ¶
func (c *LockClient) Update() *LockUpdate
Update returns an update builder for Lock.
func (*LockClient) UpdateOne ¶
func (c *LockClient) UpdateOne(l *Lock) *LockUpdateOne
UpdateOne returns an update builder for the given entity.
func (*LockClient) UpdateOneID ¶
func (c *LockClient) UpdateOneID(id string) *LockUpdateOne
UpdateOneID returns an update builder for the given id.
func (*LockClient) Use ¶
func (c *LockClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `lock.Hooks(f(g(h())))`.
type LockCreate ¶
type LockCreate struct {
// contains filtered or unexported fields
}
LockCreate is the builder for creating a Lock entity.
func (*LockCreate) Exec ¶
func (lc *LockCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*LockCreate) ExecContext ¶
func (c *LockCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockCreate) ExecX ¶
func (lc *LockCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockCreate) Mutation ¶
func (lc *LockCreate) Mutation() *LockMutation
Mutation returns the LockMutation object of the builder.
func (*LockCreate) OnConflict ¶
func (lc *LockCreate) OnConflict(opts ...sql.ConflictOption) *LockUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Lock.Create(). SetVersion(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.LockUpsert) { SetVersion(v+v). }). Exec(ctx)
func (*LockCreate) OnConflictColumns ¶
func (lc *LockCreate) OnConflictColumns(columns ...string) *LockUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Lock.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*LockCreate) QueryContext ¶
func (c *LockCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockCreate) Save ¶
func (lc *LockCreate) Save(ctx context.Context) (*Lock, error)
Save creates the Lock in the database.
func (*LockCreate) SaveX ¶
func (lc *LockCreate) SaveX(ctx context.Context) *Lock
SaveX calls Save and panics if Save returns an error.
func (*LockCreate) SetID ¶ added in v0.1.1
func (lc *LockCreate) SetID(s string) *LockCreate
SetID sets the "id" field.
func (*LockCreate) SetNillableVersion ¶ added in v0.1.1
func (lc *LockCreate) SetNillableVersion(u *uuid.UUID) *LockCreate
SetNillableVersion sets the "version" field if the given value is not nil.
func (*LockCreate) SetOwner ¶
func (lc *LockCreate) SetOwner(s string) *LockCreate
SetOwner sets the "owner" field.
func (*LockCreate) SetVersion ¶ added in v0.1.1
func (lc *LockCreate) SetVersion(u uuid.UUID) *LockCreate
SetVersion sets the "version" field.
type LockCreateBulk ¶
type LockCreateBulk struct {
// contains filtered or unexported fields
}
LockCreateBulk is the builder for creating many Lock entities in bulk.
func (*LockCreateBulk) Exec ¶
func (lcb *LockCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*LockCreateBulk) ExecContext ¶
func (c *LockCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockCreateBulk) ExecX ¶
func (lcb *LockCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockCreateBulk) OnConflict ¶
func (lcb *LockCreateBulk) OnConflict(opts ...sql.ConflictOption) *LockUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Lock.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.LockUpsert) { SetVersion(v+v). }). Exec(ctx)
func (*LockCreateBulk) OnConflictColumns ¶
func (lcb *LockCreateBulk) OnConflictColumns(columns ...string) *LockUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Lock.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*LockCreateBulk) QueryContext ¶
func (c *LockCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type LockDelete ¶
type LockDelete struct {
// contains filtered or unexported fields
}
LockDelete is the builder for deleting a Lock entity.
func (*LockDelete) Exec ¶
func (ld *LockDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*LockDelete) ExecContext ¶
func (c *LockDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockDelete) ExecX ¶
func (ld *LockDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*LockDelete) QueryContext ¶
func (c *LockDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockDelete) Where ¶
func (ld *LockDelete) Where(ps ...predicate.Lock) *LockDelete
Where appends a list predicates to the LockDelete builder.
type LockDeleteOne ¶
type LockDeleteOne struct {
// contains filtered or unexported fields
}
LockDeleteOne is the builder for deleting a single Lock entity.
func (*LockDeleteOne) Exec ¶
func (ldo *LockDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*LockDeleteOne) ExecX ¶
func (ldo *LockDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockDeleteOne) Where ¶
func (ldo *LockDeleteOne) Where(ps ...predicate.Lock) *LockDeleteOne
Where appends a list predicates to the LockDelete builder.
type LockGroupBy ¶
type LockGroupBy struct {
// contains filtered or unexported fields
}
LockGroupBy is the group-by builder for Lock entities.
func (*LockGroupBy) Aggregate ¶
func (lgb *LockGroupBy) Aggregate(fns ...AggregateFunc) *LockGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*LockGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*LockGroupBy) Scan ¶
func (lgb *LockGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*LockGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type LockMutation ¶
type LockMutation struct {
// contains filtered or unexported fields
}
LockMutation represents an operation that mutates the Lock nodes in the graph.
func (*LockMutation) AddField ¶
func (m *LockMutation) 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 (*LockMutation) AddedEdges ¶
func (m *LockMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*LockMutation) AddedField ¶
func (m *LockMutation) 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 (*LockMutation) AddedFields ¶
func (m *LockMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*LockMutation) AddedIDs ¶
func (m *LockMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*LockMutation) ClearEdge ¶
func (m *LockMutation) 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 (*LockMutation) ClearField ¶
func (m *LockMutation) 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 (*LockMutation) ClearVersion ¶ added in v0.1.1
func (m *LockMutation) ClearVersion()
ClearVersion clears the value of the "version" field.
func (*LockMutation) ClearedEdges ¶
func (m *LockMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*LockMutation) ClearedFields ¶
func (m *LockMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (LockMutation) Client ¶
func (m LockMutation) 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 (*LockMutation) EdgeCleared ¶
func (m *LockMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*LockMutation) ExecContext ¶
func (c *LockMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockMutation) Field ¶
func (m *LockMutation) 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 (*LockMutation) FieldCleared ¶
func (m *LockMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*LockMutation) Fields ¶
func (m *LockMutation) 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 (*LockMutation) ID ¶
func (m *LockMutation) 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 (*LockMutation) IDs ¶
func (m *LockMutation) 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 (*LockMutation) 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 (*LockMutation) OldOwner ¶
func (m *LockMutation) OldOwner(ctx context.Context) (v string, err error)
OldOwner returns the old "owner" field's value of the Lock entity. If the Lock 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 (*LockMutation) OldVersion ¶ added in v0.1.1
OldVersion returns the old "version" field's value of the Lock entity. If the Lock 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 (*LockMutation) Owner ¶
func (m *LockMutation) Owner() (r string, exists bool)
Owner returns the value of the "owner" field in the mutation.
func (*LockMutation) QueryContext ¶
func (c *LockMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockMutation) RemovedEdges ¶
func (m *LockMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*LockMutation) RemovedIDs ¶
func (m *LockMutation) 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 (*LockMutation) ResetEdge ¶
func (m *LockMutation) 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 (*LockMutation) ResetField ¶
func (m *LockMutation) 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 (*LockMutation) ResetOwner ¶
func (m *LockMutation) ResetOwner()
ResetOwner resets all changes to the "owner" field.
func (*LockMutation) ResetVersion ¶ added in v0.1.1
func (m *LockMutation) ResetVersion()
ResetVersion resets all changes to the "version" field.
func (*LockMutation) SetField ¶
func (m *LockMutation) 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 (*LockMutation) SetID ¶ added in v0.1.1
func (m *LockMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Lock entities.
func (*LockMutation) SetOp ¶
func (m *LockMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*LockMutation) SetOwner ¶
func (m *LockMutation) SetOwner(s string)
SetOwner sets the "owner" field.
func (*LockMutation) SetVersion ¶ added in v0.1.1
func (m *LockMutation) SetVersion(u uuid.UUID)
SetVersion sets the "version" field.
func (LockMutation) Tx ¶
func (m LockMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*LockMutation) Type ¶
func (m *LockMutation) Type() string
Type returns the node type of this mutation (Lock).
func (*LockMutation) Version ¶ added in v0.1.1
func (m *LockMutation) Version() (r uuid.UUID, exists bool)
Version returns the value of the "version" field in the mutation.
func (*LockMutation) VersionCleared ¶ added in v0.1.1
func (m *LockMutation) VersionCleared() bool
VersionCleared returns if the "version" field was cleared in this mutation.
func (*LockMutation) Where ¶
func (m *LockMutation) Where(ps ...predicate.Lock)
Where appends a list predicates to the LockMutation builder.
func (*LockMutation) WhereP ¶
func (m *LockMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the LockMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type LockQuery ¶
type LockQuery struct {
// contains filtered or unexported fields
}
LockQuery is the builder for querying Lock entities.
func (*LockQuery) Aggregate ¶
func (lq *LockQuery) Aggregate(fns ...AggregateFunc) *LockSelect
Aggregate returns a LockSelect configured with the given aggregations.
func (*LockQuery) Clone ¶
Clone returns a duplicate of the LockQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*LockQuery) ExecContext ¶
func (c *LockQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockQuery) First ¶
First returns the first Lock entity from the query. Returns a *NotFoundError when no Lock was found.
func (*LockQuery) FirstID ¶
FirstID returns the first Lock ID from the query. Returns a *NotFoundError when no Lock ID was found.
func (*LockQuery) GroupBy ¶
func (lq *LockQuery) GroupBy(field string, fields ...string) *LockGroupBy
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 { Version uuid.UUID `json:"version,omitempty"` Count int `json:"count,omitempty"` } client.Lock.Query(). GroupBy(lock.FieldVersion). Aggregate(ent.Count()). Scan(ctx, &v)
func (*LockQuery) Modify ¶
func (lq *LockQuery) Modify(modifiers ...func(s *sql.Selector)) *LockSelect
Modify adds a query modifier for attaching custom logic to queries.
func (*LockQuery) Only ¶
Only returns a single Lock entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Lock entity is found. Returns a *NotFoundError when no Lock entities are found.
func (*LockQuery) OnlyID ¶
OnlyID is like Only, but returns the only Lock ID in the query. Returns a *NotSingularError when more than one Lock ID is found. Returns a *NotFoundError when no entities are found.
func (*LockQuery) Order ¶
func (lq *LockQuery) Order(o ...lock.OrderOption) *LockQuery
Order specifies how the records should be ordered.
func (*LockQuery) QueryContext ¶
func (c *LockQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockQuery) Select ¶
func (lq *LockQuery) Select(fields ...string) *LockSelect
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 { Version uuid.UUID `json:"version,omitempty"` } client.Lock.Query(). Select(lock.FieldVersion). Scan(ctx, &v)
type LockSelect ¶
type LockSelect struct { *LockQuery // contains filtered or unexported fields }
LockSelect is the builder for selecting fields of Lock entities.
func (*LockSelect) Aggregate ¶
func (ls *LockSelect) Aggregate(fns ...AggregateFunc) *LockSelect
Aggregate adds the given aggregation functions to the selector query.
func (*LockSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LockSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (LockSelect) ExecContext ¶
func (c LockSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LockSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LockSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LockSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*LockSelect) Modify ¶
func (ls *LockSelect) Modify(modifiers ...func(s *sql.Selector)) *LockSelect
Modify adds a query modifier for attaching custom logic to queries.
func (LockSelect) QueryContext ¶
func (c LockSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockSelect) Scan ¶
func (ls *LockSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*LockSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type LockUpdate ¶
type LockUpdate struct {
// contains filtered or unexported fields
}
LockUpdate is the builder for updating Lock entities.
func (*LockUpdate) ClearVersion ¶ added in v0.1.1
func (lu *LockUpdate) ClearVersion() *LockUpdate
ClearVersion clears the value of the "version" field.
func (*LockUpdate) Exec ¶
func (lu *LockUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*LockUpdate) ExecContext ¶
func (c *LockUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockUpdate) ExecX ¶
func (lu *LockUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockUpdate) Modify ¶
func (lu *LockUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LockUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*LockUpdate) Mutation ¶
func (lu *LockUpdate) Mutation() *LockMutation
Mutation returns the LockMutation object of the builder.
func (*LockUpdate) QueryContext ¶
func (c *LockUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockUpdate) Save ¶
func (lu *LockUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*LockUpdate) SaveX ¶
func (lu *LockUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*LockUpdate) SetNillableOwner ¶
func (lu *LockUpdate) SetNillableOwner(s *string) *LockUpdate
SetNillableOwner sets the "owner" field if the given value is not nil.
func (*LockUpdate) SetNillableVersion ¶ added in v0.1.1
func (lu *LockUpdate) SetNillableVersion(u *uuid.UUID) *LockUpdate
SetNillableVersion sets the "version" field if the given value is not nil.
func (*LockUpdate) SetOwner ¶
func (lu *LockUpdate) SetOwner(s string) *LockUpdate
SetOwner sets the "owner" field.
func (*LockUpdate) SetVersion ¶ added in v0.1.1
func (lu *LockUpdate) SetVersion(u uuid.UUID) *LockUpdate
SetVersion sets the "version" field.
func (*LockUpdate) Where ¶
func (lu *LockUpdate) Where(ps ...predicate.Lock) *LockUpdate
Where appends a list predicates to the LockUpdate builder.
type LockUpdateOne ¶
type LockUpdateOne struct {
// contains filtered or unexported fields
}
LockUpdateOne is the builder for updating a single Lock entity.
func (*LockUpdateOne) ClearVersion ¶ added in v0.1.1
func (luo *LockUpdateOne) ClearVersion() *LockUpdateOne
ClearVersion clears the value of the "version" field.
func (*LockUpdateOne) Exec ¶
func (luo *LockUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*LockUpdateOne) ExecContext ¶
func (c *LockUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*LockUpdateOne) ExecX ¶
func (luo *LockUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockUpdateOne) Modify ¶
func (luo *LockUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LockUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*LockUpdateOne) Mutation ¶
func (luo *LockUpdateOne) Mutation() *LockMutation
Mutation returns the LockMutation object of the builder.
func (*LockUpdateOne) QueryContext ¶
func (c *LockUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
func (*LockUpdateOne) Save ¶
func (luo *LockUpdateOne) Save(ctx context.Context) (*Lock, error)
Save executes the query and returns the updated Lock entity.
func (*LockUpdateOne) SaveX ¶
func (luo *LockUpdateOne) SaveX(ctx context.Context) *Lock
SaveX is like Save, but panics if an error occurs.
func (*LockUpdateOne) Select ¶
func (luo *LockUpdateOne) Select(field string, fields ...string) *LockUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*LockUpdateOne) SetNillableOwner ¶
func (luo *LockUpdateOne) SetNillableOwner(s *string) *LockUpdateOne
SetNillableOwner sets the "owner" field if the given value is not nil.
func (*LockUpdateOne) SetNillableVersion ¶ added in v0.1.1
func (luo *LockUpdateOne) SetNillableVersion(u *uuid.UUID) *LockUpdateOne
SetNillableVersion sets the "version" field if the given value is not nil.
func (*LockUpdateOne) SetOwner ¶
func (luo *LockUpdateOne) SetOwner(s string) *LockUpdateOne
SetOwner sets the "owner" field.
func (*LockUpdateOne) SetVersion ¶ added in v0.1.1
func (luo *LockUpdateOne) SetVersion(u uuid.UUID) *LockUpdateOne
SetVersion sets the "version" field.
func (*LockUpdateOne) Where ¶
func (luo *LockUpdateOne) Where(ps ...predicate.Lock) *LockUpdateOne
Where appends a list predicates to the LockUpdate builder.
type LockUpsert ¶
LockUpsert is the "OnConflict" setter.
func (*LockUpsert) ClearVersion ¶ added in v0.1.1
func (u *LockUpsert) ClearVersion() *LockUpsert
ClearVersion clears the value of the "version" field.
func (*LockUpsert) SetOwner ¶
func (u *LockUpsert) SetOwner(v string) *LockUpsert
SetOwner sets the "owner" field.
func (*LockUpsert) SetVersion ¶ added in v0.1.1
func (u *LockUpsert) SetVersion(v uuid.UUID) *LockUpsert
SetVersion sets the "version" field.
func (*LockUpsert) UpdateOwner ¶
func (u *LockUpsert) UpdateOwner() *LockUpsert
UpdateOwner sets the "owner" field to the value that was provided on create.
func (*LockUpsert) UpdateVersion ¶ added in v0.1.1
func (u *LockUpsert) UpdateVersion() *LockUpsert
UpdateVersion sets the "version" field to the value that was provided on create.
type LockUpsertBulk ¶
type LockUpsertBulk struct {
// contains filtered or unexported fields
}
LockUpsertBulk is the builder for "upsert"-ing a bulk of Lock nodes.
func (*LockUpsertBulk) ClearVersion ¶ added in v0.1.1
func (u *LockUpsertBulk) ClearVersion() *LockUpsertBulk
ClearVersion clears the value of the "version" field.
func (*LockUpsertBulk) DoNothing ¶
func (u *LockUpsertBulk) DoNothing() *LockUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*LockUpsertBulk) Exec ¶
func (u *LockUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*LockUpsertBulk) ExecX ¶
func (u *LockUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockUpsertBulk) Ignore ¶
func (u *LockUpsertBulk) Ignore() *LockUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Lock.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*LockUpsertBulk) SetOwner ¶
func (u *LockUpsertBulk) SetOwner(v string) *LockUpsertBulk
SetOwner sets the "owner" field.
func (*LockUpsertBulk) SetVersion ¶ added in v0.1.1
func (u *LockUpsertBulk) SetVersion(v uuid.UUID) *LockUpsertBulk
SetVersion sets the "version" field.
func (*LockUpsertBulk) Update ¶
func (u *LockUpsertBulk) Update(set func(*LockUpsert)) *LockUpsertBulk
Update allows overriding fields `UPDATE` values. See the LockCreateBulk.OnConflict documentation for more info.
func (*LockUpsertBulk) UpdateNewValues ¶
func (u *LockUpsertBulk) UpdateNewValues() *LockUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Lock.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(lock.FieldID) }), ). Exec(ctx)
func (*LockUpsertBulk) UpdateOwner ¶
func (u *LockUpsertBulk) UpdateOwner() *LockUpsertBulk
UpdateOwner sets the "owner" field to the value that was provided on create.
func (*LockUpsertBulk) UpdateVersion ¶ added in v0.1.1
func (u *LockUpsertBulk) UpdateVersion() *LockUpsertBulk
UpdateVersion sets the "version" field to the value that was provided on create.
type LockUpsertOne ¶
type LockUpsertOne struct {
// contains filtered or unexported fields
}
LockUpsertOne is the builder for "upsert"-ing
one Lock node.
func (*LockUpsertOne) ClearVersion ¶ added in v0.1.1
func (u *LockUpsertOne) ClearVersion() *LockUpsertOne
ClearVersion clears the value of the "version" field.
func (*LockUpsertOne) DoNothing ¶
func (u *LockUpsertOne) DoNothing() *LockUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*LockUpsertOne) Exec ¶
func (u *LockUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*LockUpsertOne) ExecX ¶
func (u *LockUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LockUpsertOne) ID ¶
func (u *LockUpsertOne) ID(ctx context.Context) (id string, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*LockUpsertOne) IDX ¶
func (u *LockUpsertOne) IDX(ctx context.Context) string
IDX is like ID, but panics if an error occurs.
func (*LockUpsertOne) Ignore ¶
func (u *LockUpsertOne) Ignore() *LockUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Lock.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*LockUpsertOne) SetOwner ¶
func (u *LockUpsertOne) SetOwner(v string) *LockUpsertOne
SetOwner sets the "owner" field.
func (*LockUpsertOne) SetVersion ¶ added in v0.1.1
func (u *LockUpsertOne) SetVersion(v uuid.UUID) *LockUpsertOne
SetVersion sets the "version" field.
func (*LockUpsertOne) Update ¶
func (u *LockUpsertOne) Update(set func(*LockUpsert)) *LockUpsertOne
Update allows overriding fields `UPDATE` values. See the LockCreate.OnConflict documentation for more info.
func (*LockUpsertOne) UpdateNewValues ¶
func (u *LockUpsertOne) UpdateNewValues() *LockUpsertOne
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.Lock.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(lock.FieldID) }), ). Exec(ctx)
func (*LockUpsertOne) UpdateOwner ¶
func (u *LockUpsertOne) UpdateOwner() *LockUpsertOne
UpdateOwner sets the "owner" field to the value that was provided on create.
func (*LockUpsertOne) UpdateVersion ¶ added in v0.1.1
func (u *LockUpsertOne) UpdateVersion() *LockUpsertOne
UpdateVersion sets the "version" field to the value that was provided on create.
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 { // Lock is the client for interacting with the Lock builders. Lock *LockClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) ExecContext ¶
ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
func (*Tx) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type 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.