Documentation ¶
Index ¶
- Constants
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type LeaderElect
- type LeaderElectClient
- func (c *LeaderElectClient) Create() *LeaderElectCreate
- func (c *LeaderElectClient) CreateBulk(builders ...*LeaderElectCreate) *LeaderElectCreateBulk
- func (c *LeaderElectClient) Delete() *LeaderElectDelete
- func (c *LeaderElectClient) DeleteOne(le *LeaderElect) *LeaderElectDeleteOne
- func (c *LeaderElectClient) DeleteOneID(id string) *LeaderElectDeleteOne
- func (c *LeaderElectClient) Get(ctx context.Context, id string) (*LeaderElect, error)
- func (c *LeaderElectClient) GetX(ctx context.Context, id string) *LeaderElect
- func (c *LeaderElectClient) Hooks() []Hook
- func (c *LeaderElectClient) Intercept(interceptors ...Interceptor)
- func (c *LeaderElectClient) Interceptors() []Interceptor
- func (c *LeaderElectClient) Query() *LeaderElectQuery
- func (c *LeaderElectClient) Update() *LeaderElectUpdate
- func (c *LeaderElectClient) UpdateOne(le *LeaderElect) *LeaderElectUpdateOne
- func (c *LeaderElectClient) UpdateOneID(id string) *LeaderElectUpdateOne
- func (c *LeaderElectClient) Use(hooks ...Hook)
- type LeaderElectCreate
- func (lec *LeaderElectCreate) Exec(ctx context.Context) error
- func (lec *LeaderElectCreate) ExecX(ctx context.Context)
- func (lec *LeaderElectCreate) Mutation() *LeaderElectMutation
- func (lec *LeaderElectCreate) OnConflict(opts ...sql.ConflictOption) *LeaderElectUpsertOne
- func (lec *LeaderElectCreate) OnConflictColumns(columns ...string) *LeaderElectUpsertOne
- func (lec *LeaderElectCreate) Save(ctx context.Context) (*LeaderElect, error)
- func (lec *LeaderElectCreate) SaveX(ctx context.Context) *LeaderElect
- func (lec *LeaderElectCreate) SetAcquireTime(i int64) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetHolderIdentity(s string) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetID(s string) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetLeaderTransitions(i int) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetLeaseDurationSeconds(i int) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetNillableResourceVersion(s *string) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetRenewTime(i int64) *LeaderElectCreate
- func (lec *LeaderElectCreate) SetResourceVersion(s string) *LeaderElectCreate
- type LeaderElectCreateBulk
- func (lecb *LeaderElectCreateBulk) Exec(ctx context.Context) error
- func (lecb *LeaderElectCreateBulk) ExecX(ctx context.Context)
- func (lecb *LeaderElectCreateBulk) OnConflict(opts ...sql.ConflictOption) *LeaderElectUpsertBulk
- func (lecb *LeaderElectCreateBulk) OnConflictColumns(columns ...string) *LeaderElectUpsertBulk
- func (lecb *LeaderElectCreateBulk) Save(ctx context.Context) ([]*LeaderElect, error)
- func (lecb *LeaderElectCreateBulk) SaveX(ctx context.Context) []*LeaderElect
- type LeaderElectDelete
- type LeaderElectDeleteOne
- type LeaderElectGroupBy
- func (legb *LeaderElectGroupBy) Aggregate(fns ...AggregateFunc) *LeaderElectGroupBy
- func (s *LeaderElectGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *LeaderElectGroupBy) BoolX(ctx context.Context) bool
- func (s *LeaderElectGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *LeaderElectGroupBy) BoolsX(ctx context.Context) []bool
- func (s *LeaderElectGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *LeaderElectGroupBy) Float64X(ctx context.Context) float64
- func (s *LeaderElectGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *LeaderElectGroupBy) Float64sX(ctx context.Context) []float64
- func (s *LeaderElectGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *LeaderElectGroupBy) IntX(ctx context.Context) int
- func (s *LeaderElectGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *LeaderElectGroupBy) IntsX(ctx context.Context) []int
- func (legb *LeaderElectGroupBy) Scan(ctx context.Context, v any) error
- func (s *LeaderElectGroupBy) ScanX(ctx context.Context, v any)
- func (s *LeaderElectGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *LeaderElectGroupBy) StringX(ctx context.Context) string
- func (s *LeaderElectGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *LeaderElectGroupBy) StringsX(ctx context.Context) []string
- type LeaderElectMutation
- func (m *LeaderElectMutation) AcquireTime() (r int64, exists bool)
- func (m *LeaderElectMutation) AddAcquireTime(i int64)
- func (m *LeaderElectMutation) AddField(name string, value ent.Value) error
- func (m *LeaderElectMutation) AddLeaderTransitions(i int)
- func (m *LeaderElectMutation) AddLeaseDurationSeconds(i int)
- func (m *LeaderElectMutation) AddRenewTime(i int64)
- func (m *LeaderElectMutation) AddedAcquireTime() (r int64, exists bool)
- func (m *LeaderElectMutation) AddedEdges() []string
- func (m *LeaderElectMutation) AddedField(name string) (ent.Value, bool)
- func (m *LeaderElectMutation) AddedFields() []string
- func (m *LeaderElectMutation) AddedIDs(name string) []ent.Value
- func (m *LeaderElectMutation) AddedLeaderTransitions() (r int, exists bool)
- func (m *LeaderElectMutation) AddedLeaseDurationSeconds() (r int, exists bool)
- func (m *LeaderElectMutation) AddedRenewTime() (r int64, exists bool)
- func (m *LeaderElectMutation) ClearEdge(name string) error
- func (m *LeaderElectMutation) ClearField(name string) error
- func (m *LeaderElectMutation) ClearedEdges() []string
- func (m *LeaderElectMutation) ClearedFields() []string
- func (m LeaderElectMutation) Client() *Client
- func (m *LeaderElectMutation) EdgeCleared(name string) bool
- func (m *LeaderElectMutation) Field(name string) (ent.Value, bool)
- func (m *LeaderElectMutation) FieldCleared(name string) bool
- func (m *LeaderElectMutation) Fields() []string
- func (m *LeaderElectMutation) HolderIdentity() (r string, exists bool)
- func (m *LeaderElectMutation) ID() (id string, exists bool)
- func (m *LeaderElectMutation) IDs(ctx context.Context) ([]string, error)
- func (m *LeaderElectMutation) LeaderTransitions() (r int, exists bool)
- func (m *LeaderElectMutation) LeaseDurationSeconds() (r int, exists bool)
- func (m *LeaderElectMutation) OldAcquireTime(ctx context.Context) (v int64, err error)
- func (m *LeaderElectMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *LeaderElectMutation) OldHolderIdentity(ctx context.Context) (v string, err error)
- func (m *LeaderElectMutation) OldLeaderTransitions(ctx context.Context) (v int, err error)
- func (m *LeaderElectMutation) OldLeaseDurationSeconds(ctx context.Context) (v int, err error)
- func (m *LeaderElectMutation) OldRenewTime(ctx context.Context) (v int64, err error)
- func (m *LeaderElectMutation) OldResourceVersion(ctx context.Context) (v string, err error)
- func (m *LeaderElectMutation) Op() Op
- func (m *LeaderElectMutation) RemovedEdges() []string
- func (m *LeaderElectMutation) RemovedIDs(name string) []ent.Value
- func (m *LeaderElectMutation) RenewTime() (r int64, exists bool)
- func (m *LeaderElectMutation) ResetAcquireTime()
- func (m *LeaderElectMutation) ResetEdge(name string) error
- func (m *LeaderElectMutation) ResetField(name string) error
- func (m *LeaderElectMutation) ResetHolderIdentity()
- func (m *LeaderElectMutation) ResetLeaderTransitions()
- func (m *LeaderElectMutation) ResetLeaseDurationSeconds()
- func (m *LeaderElectMutation) ResetRenewTime()
- func (m *LeaderElectMutation) ResetResourceVersion()
- func (m *LeaderElectMutation) ResourceVersion() (r string, exists bool)
- func (m *LeaderElectMutation) SetAcquireTime(i int64)
- func (m *LeaderElectMutation) SetField(name string, value ent.Value) error
- func (m *LeaderElectMutation) SetHolderIdentity(s string)
- func (m *LeaderElectMutation) SetID(id string)
- func (m *LeaderElectMutation) SetLeaderTransitions(i int)
- func (m *LeaderElectMutation) SetLeaseDurationSeconds(i int)
- func (m *LeaderElectMutation) SetOp(op Op)
- func (m *LeaderElectMutation) SetRenewTime(i int64)
- func (m *LeaderElectMutation) SetResourceVersion(s string)
- func (m LeaderElectMutation) Tx() (*Tx, error)
- func (m *LeaderElectMutation) Type() string
- func (m *LeaderElectMutation) Where(ps ...predicate.LeaderElect)
- func (m *LeaderElectMutation) WhereP(ps ...func(*sql.Selector))
- type LeaderElectQuery
- func (leq *LeaderElectQuery) Aggregate(fns ...AggregateFunc) *LeaderElectSelect
- func (leq *LeaderElectQuery) All(ctx context.Context) ([]*LeaderElect, error)
- func (leq *LeaderElectQuery) AllX(ctx context.Context) []*LeaderElect
- func (leq *LeaderElectQuery) Clone() *LeaderElectQuery
- func (leq *LeaderElectQuery) Count(ctx context.Context) (int, error)
- func (leq *LeaderElectQuery) CountX(ctx context.Context) int
- func (leq *LeaderElectQuery) Exist(ctx context.Context) (bool, error)
- func (leq *LeaderElectQuery) ExistX(ctx context.Context) bool
- func (leq *LeaderElectQuery) First(ctx context.Context) (*LeaderElect, error)
- func (leq *LeaderElectQuery) FirstID(ctx context.Context) (id string, err error)
- func (leq *LeaderElectQuery) FirstIDX(ctx context.Context) string
- func (leq *LeaderElectQuery) FirstX(ctx context.Context) *LeaderElect
- func (leq *LeaderElectQuery) GroupBy(field string, fields ...string) *LeaderElectGroupBy
- func (leq *LeaderElectQuery) IDs(ctx context.Context) (ids []string, err error)
- func (leq *LeaderElectQuery) IDsX(ctx context.Context) []string
- func (leq *LeaderElectQuery) Limit(limit int) *LeaderElectQuery
- func (leq *LeaderElectQuery) Offset(offset int) *LeaderElectQuery
- func (leq *LeaderElectQuery) Only(ctx context.Context) (*LeaderElect, error)
- func (leq *LeaderElectQuery) OnlyID(ctx context.Context) (id string, err error)
- func (leq *LeaderElectQuery) OnlyIDX(ctx context.Context) string
- func (leq *LeaderElectQuery) OnlyX(ctx context.Context) *LeaderElect
- func (leq *LeaderElectQuery) Order(o ...leaderelect.OrderOption) *LeaderElectQuery
- func (leq *LeaderElectQuery) Select(fields ...string) *LeaderElectSelect
- func (leq *LeaderElectQuery) Unique(unique bool) *LeaderElectQuery
- func (leq *LeaderElectQuery) Where(ps ...predicate.LeaderElect) *LeaderElectQuery
- type LeaderElectSelect
- func (les *LeaderElectSelect) Aggregate(fns ...AggregateFunc) *LeaderElectSelect
- func (s *LeaderElectSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *LeaderElectSelect) BoolX(ctx context.Context) bool
- func (s *LeaderElectSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *LeaderElectSelect) BoolsX(ctx context.Context) []bool
- func (s *LeaderElectSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *LeaderElectSelect) Float64X(ctx context.Context) float64
- func (s *LeaderElectSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *LeaderElectSelect) Float64sX(ctx context.Context) []float64
- func (s *LeaderElectSelect) Int(ctx context.Context) (_ int, err error)
- func (s *LeaderElectSelect) IntX(ctx context.Context) int
- func (s *LeaderElectSelect) Ints(ctx context.Context) ([]int, error)
- func (s *LeaderElectSelect) IntsX(ctx context.Context) []int
- func (les *LeaderElectSelect) Scan(ctx context.Context, v any) error
- func (s *LeaderElectSelect) ScanX(ctx context.Context, v any)
- func (s *LeaderElectSelect) String(ctx context.Context) (_ string, err error)
- func (s *LeaderElectSelect) StringX(ctx context.Context) string
- func (s *LeaderElectSelect) Strings(ctx context.Context) ([]string, error)
- func (s *LeaderElectSelect) StringsX(ctx context.Context) []string
- type LeaderElectUpdate
- func (leu *LeaderElectUpdate) AddAcquireTime(i int64) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) AddLeaderTransitions(i int) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) AddLeaseDurationSeconds(i int) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) AddRenewTime(i int64) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) Exec(ctx context.Context) error
- func (leu *LeaderElectUpdate) ExecX(ctx context.Context)
- func (leu *LeaderElectUpdate) Mutation() *LeaderElectMutation
- func (leu *LeaderElectUpdate) Save(ctx context.Context) (int, error)
- func (leu *LeaderElectUpdate) SaveX(ctx context.Context) int
- func (leu *LeaderElectUpdate) SetAcquireTime(i int64) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetHolderIdentity(s string) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetLeaderTransitions(i int) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetLeaseDurationSeconds(i int) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetNillableResourceVersion(s *string) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetRenewTime(i int64) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) SetResourceVersion(s string) *LeaderElectUpdate
- func (leu *LeaderElectUpdate) Where(ps ...predicate.LeaderElect) *LeaderElectUpdate
- type LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) AddAcquireTime(i int64) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) AddLeaderTransitions(i int) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) AddLeaseDurationSeconds(i int) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) AddRenewTime(i int64) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) Exec(ctx context.Context) error
- func (leuo *LeaderElectUpdateOne) ExecX(ctx context.Context)
- func (leuo *LeaderElectUpdateOne) Mutation() *LeaderElectMutation
- func (leuo *LeaderElectUpdateOne) Save(ctx context.Context) (*LeaderElect, error)
- func (leuo *LeaderElectUpdateOne) SaveX(ctx context.Context) *LeaderElect
- func (leuo *LeaderElectUpdateOne) Select(field string, fields ...string) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetAcquireTime(i int64) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetHolderIdentity(s string) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetLeaderTransitions(i int) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetLeaseDurationSeconds(i int) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetNillableResourceVersion(s *string) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetRenewTime(i int64) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) SetResourceVersion(s string) *LeaderElectUpdateOne
- func (leuo *LeaderElectUpdateOne) Where(ps ...predicate.LeaderElect) *LeaderElectUpdateOne
- type LeaderElectUpsert
- func (u *LeaderElectUpsert) AddAcquireTime(v int64) *LeaderElectUpsert
- func (u *LeaderElectUpsert) AddLeaderTransitions(v int) *LeaderElectUpsert
- func (u *LeaderElectUpsert) AddLeaseDurationSeconds(v int) *LeaderElectUpsert
- func (u *LeaderElectUpsert) AddRenewTime(v int64) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetAcquireTime(v int64) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetHolderIdentity(v string) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetLeaderTransitions(v int) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetLeaseDurationSeconds(v int) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetRenewTime(v int64) *LeaderElectUpsert
- func (u *LeaderElectUpsert) SetResourceVersion(v string) *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateAcquireTime() *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateHolderIdentity() *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateLeaderTransitions() *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateLeaseDurationSeconds() *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateRenewTime() *LeaderElectUpsert
- func (u *LeaderElectUpsert) UpdateResourceVersion() *LeaderElectUpsert
- type LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) AddAcquireTime(v int64) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) AddLeaderTransitions(v int) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) AddLeaseDurationSeconds(v int) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) AddRenewTime(v int64) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) DoNothing() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) Exec(ctx context.Context) error
- func (u *LeaderElectUpsertBulk) ExecX(ctx context.Context)
- func (u *LeaderElectUpsertBulk) Ignore() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetAcquireTime(v int64) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetHolderIdentity(v string) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetLeaderTransitions(v int) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetLeaseDurationSeconds(v int) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetRenewTime(v int64) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) SetResourceVersion(v string) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) Update(set func(*LeaderElectUpsert)) *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateAcquireTime() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateHolderIdentity() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateLeaderTransitions() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateLeaseDurationSeconds() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateNewValues() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateRenewTime() *LeaderElectUpsertBulk
- func (u *LeaderElectUpsertBulk) UpdateResourceVersion() *LeaderElectUpsertBulk
- type LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) AddAcquireTime(v int64) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) AddLeaderTransitions(v int) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) AddLeaseDurationSeconds(v int) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) AddRenewTime(v int64) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) DoNothing() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) Exec(ctx context.Context) error
- func (u *LeaderElectUpsertOne) ExecX(ctx context.Context)
- func (u *LeaderElectUpsertOne) ID(ctx context.Context) (id string, err error)
- func (u *LeaderElectUpsertOne) IDX(ctx context.Context) string
- func (u *LeaderElectUpsertOne) Ignore() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetAcquireTime(v int64) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetHolderIdentity(v string) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetLeaderTransitions(v int) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetLeaseDurationSeconds(v int) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetRenewTime(v int64) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) SetResourceVersion(v string) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) Update(set func(*LeaderElectUpsert)) *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateAcquireTime() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateHolderIdentity() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateLeaderTransitions() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateLeaseDurationSeconds() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateNewValues() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateRenewTime() *LeaderElectUpsertOne
- func (u *LeaderElectUpsertOne) UpdateResourceVersion() *LeaderElectUpsertOne
- type LeaderElects
- 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. TypeLeaderElect = "LeaderElect" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // LeaderElect is the client for interacting with the LeaderElect builders. LeaderElect *LeaderElectClient // 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(). LeaderElect. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type LeaderElect ¶
type LeaderElect struct { // ID of the ent. ID string `json:"id,omitempty"` // 版本号 ResourceVersion string `json:"resource_version,omitempty"` // LeaseDurationSeconds holds the value of the "lease_duration_seconds" field. LeaseDurationSeconds int `json:"lease_duration_seconds,omitempty"` // AcquireTime holds the value of the "acquire_time" field. AcquireTime int64 `json:"acquire_time,omitempty"` // RenewTime holds the value of the "renew_time" field. RenewTime int64 `json:"renew_time,omitempty"` // LeaderTransitions holds the value of the "leader_transitions" field. LeaderTransitions int `json:"leader_transitions,omitempty"` // HolderIdentity holds the value of the "holder_identity" field. HolderIdentity string `json:"holder_identity,omitempty"` // contains filtered or unexported fields }
LeaderElect is the model entity for the LeaderElect schema.
func (*LeaderElect) String ¶
func (le *LeaderElect) String() string
String implements the fmt.Stringer.
func (*LeaderElect) Unwrap ¶
func (le *LeaderElect) Unwrap() *LeaderElect
Unwrap unwraps the LeaderElect 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 (*LeaderElect) Update ¶
func (le *LeaderElect) Update() *LeaderElectUpdateOne
Update returns a builder for updating this LeaderElect. Note that you need to call LeaderElect.Unwrap() before calling this method if this LeaderElect was returned from a transaction, and the transaction was committed or rolled back.
type LeaderElectClient ¶
type LeaderElectClient struct {
// contains filtered or unexported fields
}
LeaderElectClient is a client for the LeaderElect schema.
func NewLeaderElectClient ¶
func NewLeaderElectClient(c config) *LeaderElectClient
NewLeaderElectClient returns a client for the LeaderElect from the given config.
func (*LeaderElectClient) Create ¶
func (c *LeaderElectClient) Create() *LeaderElectCreate
Create returns a builder for creating a LeaderElect entity.
func (*LeaderElectClient) CreateBulk ¶
func (c *LeaderElectClient) CreateBulk(builders ...*LeaderElectCreate) *LeaderElectCreateBulk
CreateBulk returns a builder for creating a bulk of LeaderElect entities.
func (*LeaderElectClient) Delete ¶
func (c *LeaderElectClient) Delete() *LeaderElectDelete
Delete returns a delete builder for LeaderElect.
func (*LeaderElectClient) DeleteOne ¶
func (c *LeaderElectClient) DeleteOne(le *LeaderElect) *LeaderElectDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*LeaderElectClient) DeleteOneID ¶
func (c *LeaderElectClient) DeleteOneID(id string) *LeaderElectDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*LeaderElectClient) Get ¶
func (c *LeaderElectClient) Get(ctx context.Context, id string) (*LeaderElect, error)
Get returns a LeaderElect entity by its id.
func (*LeaderElectClient) GetX ¶
func (c *LeaderElectClient) GetX(ctx context.Context, id string) *LeaderElect
GetX is like Get, but panics if an error occurs.
func (*LeaderElectClient) Hooks ¶
func (c *LeaderElectClient) Hooks() []Hook
Hooks returns the client hooks.
func (*LeaderElectClient) Intercept ¶
func (c *LeaderElectClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `leaderelect.Intercept(f(g(h())))`.
func (*LeaderElectClient) Interceptors ¶
func (c *LeaderElectClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*LeaderElectClient) Query ¶
func (c *LeaderElectClient) Query() *LeaderElectQuery
Query returns a query builder for LeaderElect.
func (*LeaderElectClient) Update ¶
func (c *LeaderElectClient) Update() *LeaderElectUpdate
Update returns an update builder for LeaderElect.
func (*LeaderElectClient) UpdateOne ¶
func (c *LeaderElectClient) UpdateOne(le *LeaderElect) *LeaderElectUpdateOne
UpdateOne returns an update builder for the given entity.
func (*LeaderElectClient) UpdateOneID ¶
func (c *LeaderElectClient) UpdateOneID(id string) *LeaderElectUpdateOne
UpdateOneID returns an update builder for the given id.
func (*LeaderElectClient) Use ¶
func (c *LeaderElectClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `leaderelect.Hooks(f(g(h())))`.
type LeaderElectCreate ¶
type LeaderElectCreate struct {
// contains filtered or unexported fields
}
LeaderElectCreate is the builder for creating a LeaderElect entity.
func (*LeaderElectCreate) Exec ¶
func (lec *LeaderElectCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*LeaderElectCreate) ExecX ¶
func (lec *LeaderElectCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectCreate) Mutation ¶
func (lec *LeaderElectCreate) Mutation() *LeaderElectMutation
Mutation returns the LeaderElectMutation object of the builder.
func (*LeaderElectCreate) OnConflict ¶
func (lec *LeaderElectCreate) OnConflict(opts ...sql.ConflictOption) *LeaderElectUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.LeaderElect.Create(). SetResourceVersion(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.LeaderElectUpsert) { SetResourceVersion(v+v). }). Exec(ctx)
func (*LeaderElectCreate) OnConflictColumns ¶
func (lec *LeaderElectCreate) OnConflictColumns(columns ...string) *LeaderElectUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.LeaderElect.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*LeaderElectCreate) Save ¶
func (lec *LeaderElectCreate) Save(ctx context.Context) (*LeaderElect, error)
Save creates the LeaderElect in the database.
func (*LeaderElectCreate) SaveX ¶
func (lec *LeaderElectCreate) SaveX(ctx context.Context) *LeaderElect
SaveX calls Save and panics if Save returns an error.
func (*LeaderElectCreate) SetAcquireTime ¶
func (lec *LeaderElectCreate) SetAcquireTime(i int64) *LeaderElectCreate
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectCreate) SetHolderIdentity ¶
func (lec *LeaderElectCreate) SetHolderIdentity(s string) *LeaderElectCreate
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectCreate) SetID ¶
func (lec *LeaderElectCreate) SetID(s string) *LeaderElectCreate
SetID sets the "id" field.
func (*LeaderElectCreate) SetLeaderTransitions ¶
func (lec *LeaderElectCreate) SetLeaderTransitions(i int) *LeaderElectCreate
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectCreate) SetLeaseDurationSeconds ¶
func (lec *LeaderElectCreate) SetLeaseDurationSeconds(i int) *LeaderElectCreate
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectCreate) SetNillableResourceVersion ¶
func (lec *LeaderElectCreate) SetNillableResourceVersion(s *string) *LeaderElectCreate
SetNillableResourceVersion sets the "resource_version" field if the given value is not nil.
func (*LeaderElectCreate) SetRenewTime ¶
func (lec *LeaderElectCreate) SetRenewTime(i int64) *LeaderElectCreate
SetRenewTime sets the "renew_time" field.
func (*LeaderElectCreate) SetResourceVersion ¶
func (lec *LeaderElectCreate) SetResourceVersion(s string) *LeaderElectCreate
SetResourceVersion sets the "resource_version" field.
type LeaderElectCreateBulk ¶
type LeaderElectCreateBulk struct {
// contains filtered or unexported fields
}
LeaderElectCreateBulk is the builder for creating many LeaderElect entities in bulk.
func (*LeaderElectCreateBulk) Exec ¶
func (lecb *LeaderElectCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*LeaderElectCreateBulk) ExecX ¶
func (lecb *LeaderElectCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectCreateBulk) OnConflict ¶
func (lecb *LeaderElectCreateBulk) OnConflict(opts ...sql.ConflictOption) *LeaderElectUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.LeaderElect.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.LeaderElectUpsert) { SetResourceVersion(v+v). }). Exec(ctx)
func (*LeaderElectCreateBulk) OnConflictColumns ¶
func (lecb *LeaderElectCreateBulk) OnConflictColumns(columns ...string) *LeaderElectUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.LeaderElect.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*LeaderElectCreateBulk) Save ¶
func (lecb *LeaderElectCreateBulk) Save(ctx context.Context) ([]*LeaderElect, error)
Save creates the LeaderElect entities in the database.
func (*LeaderElectCreateBulk) SaveX ¶
func (lecb *LeaderElectCreateBulk) SaveX(ctx context.Context) []*LeaderElect
SaveX is like Save, but panics if an error occurs.
type LeaderElectDelete ¶
type LeaderElectDelete struct {
// contains filtered or unexported fields
}
LeaderElectDelete is the builder for deleting a LeaderElect entity.
func (*LeaderElectDelete) Exec ¶
func (led *LeaderElectDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*LeaderElectDelete) ExecX ¶
func (led *LeaderElectDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectDelete) Where ¶
func (led *LeaderElectDelete) Where(ps ...predicate.LeaderElect) *LeaderElectDelete
Where appends a list predicates to the LeaderElectDelete builder.
type LeaderElectDeleteOne ¶
type LeaderElectDeleteOne struct {
// contains filtered or unexported fields
}
LeaderElectDeleteOne is the builder for deleting a single LeaderElect entity.
func (*LeaderElectDeleteOne) Exec ¶
func (ledo *LeaderElectDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*LeaderElectDeleteOne) ExecX ¶
func (ledo *LeaderElectDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectDeleteOne) Where ¶
func (ledo *LeaderElectDeleteOne) Where(ps ...predicate.LeaderElect) *LeaderElectDeleteOne
Where appends a list predicates to the LeaderElectDelete builder.
type LeaderElectGroupBy ¶
type LeaderElectGroupBy struct {
// contains filtered or unexported fields
}
LeaderElectGroupBy is the group-by builder for LeaderElect entities.
func (*LeaderElectGroupBy) Aggregate ¶
func (legb *LeaderElectGroupBy) Aggregate(fns ...AggregateFunc) *LeaderElectGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*LeaderElectGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*LeaderElectGroupBy) Scan ¶
func (legb *LeaderElectGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*LeaderElectGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type LeaderElectMutation ¶
type LeaderElectMutation struct {
// contains filtered or unexported fields
}
LeaderElectMutation represents an operation that mutates the LeaderElect nodes in the graph.
func (*LeaderElectMutation) AcquireTime ¶
func (m *LeaderElectMutation) AcquireTime() (r int64, exists bool)
AcquireTime returns the value of the "acquire_time" field in the mutation.
func (*LeaderElectMutation) AddAcquireTime ¶
func (m *LeaderElectMutation) AddAcquireTime(i int64)
AddAcquireTime adds i to the "acquire_time" field.
func (*LeaderElectMutation) AddField ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) AddLeaderTransitions ¶
func (m *LeaderElectMutation) AddLeaderTransitions(i int)
AddLeaderTransitions adds i to the "leader_transitions" field.
func (*LeaderElectMutation) AddLeaseDurationSeconds ¶
func (m *LeaderElectMutation) AddLeaseDurationSeconds(i int)
AddLeaseDurationSeconds adds i to the "lease_duration_seconds" field.
func (*LeaderElectMutation) AddRenewTime ¶
func (m *LeaderElectMutation) AddRenewTime(i int64)
AddRenewTime adds i to the "renew_time" field.
func (*LeaderElectMutation) AddedAcquireTime ¶
func (m *LeaderElectMutation) AddedAcquireTime() (r int64, exists bool)
AddedAcquireTime returns the value that was added to the "acquire_time" field in this mutation.
func (*LeaderElectMutation) AddedEdges ¶
func (m *LeaderElectMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*LeaderElectMutation) AddedField ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) AddedFields ¶
func (m *LeaderElectMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*LeaderElectMutation) AddedIDs ¶
func (m *LeaderElectMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*LeaderElectMutation) AddedLeaderTransitions ¶
func (m *LeaderElectMutation) AddedLeaderTransitions() (r int, exists bool)
AddedLeaderTransitions returns the value that was added to the "leader_transitions" field in this mutation.
func (*LeaderElectMutation) AddedLeaseDurationSeconds ¶
func (m *LeaderElectMutation) AddedLeaseDurationSeconds() (r int, exists bool)
AddedLeaseDurationSeconds returns the value that was added to the "lease_duration_seconds" field in this mutation.
func (*LeaderElectMutation) AddedRenewTime ¶
func (m *LeaderElectMutation) AddedRenewTime() (r int64, exists bool)
AddedRenewTime returns the value that was added to the "renew_time" field in this mutation.
func (*LeaderElectMutation) ClearEdge ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) ClearField ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) ClearedEdges ¶
func (m *LeaderElectMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*LeaderElectMutation) ClearedFields ¶
func (m *LeaderElectMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (LeaderElectMutation) Client ¶
func (m LeaderElectMutation) 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 (*LeaderElectMutation) EdgeCleared ¶
func (m *LeaderElectMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*LeaderElectMutation) Field ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) FieldCleared ¶
func (m *LeaderElectMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*LeaderElectMutation) Fields ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) HolderIdentity ¶
func (m *LeaderElectMutation) HolderIdentity() (r string, exists bool)
HolderIdentity returns the value of the "holder_identity" field in the mutation.
func (*LeaderElectMutation) ID ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) IDs ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) LeaderTransitions ¶
func (m *LeaderElectMutation) LeaderTransitions() (r int, exists bool)
LeaderTransitions returns the value of the "leader_transitions" field in the mutation.
func (*LeaderElectMutation) LeaseDurationSeconds ¶
func (m *LeaderElectMutation) LeaseDurationSeconds() (r int, exists bool)
LeaseDurationSeconds returns the value of the "lease_duration_seconds" field in the mutation.
func (*LeaderElectMutation) OldAcquireTime ¶
func (m *LeaderElectMutation) OldAcquireTime(ctx context.Context) (v int64, err error)
OldAcquireTime returns the old "acquire_time" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) 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 (*LeaderElectMutation) OldHolderIdentity ¶
func (m *LeaderElectMutation) OldHolderIdentity(ctx context.Context) (v string, err error)
OldHolderIdentity returns the old "holder_identity" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) OldLeaderTransitions ¶
func (m *LeaderElectMutation) OldLeaderTransitions(ctx context.Context) (v int, err error)
OldLeaderTransitions returns the old "leader_transitions" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) OldLeaseDurationSeconds ¶
func (m *LeaderElectMutation) OldLeaseDurationSeconds(ctx context.Context) (v int, err error)
OldLeaseDurationSeconds returns the old "lease_duration_seconds" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) OldRenewTime ¶
func (m *LeaderElectMutation) OldRenewTime(ctx context.Context) (v int64, err error)
OldRenewTime returns the old "renew_time" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) OldResourceVersion ¶
func (m *LeaderElectMutation) OldResourceVersion(ctx context.Context) (v string, err error)
OldResourceVersion returns the old "resource_version" field's value of the LeaderElect entity. If the LeaderElect 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 (*LeaderElectMutation) Op ¶
func (m *LeaderElectMutation) Op() Op
Op returns the operation name.
func (*LeaderElectMutation) RemovedEdges ¶
func (m *LeaderElectMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*LeaderElectMutation) RemovedIDs ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) RenewTime ¶
func (m *LeaderElectMutation) RenewTime() (r int64, exists bool)
RenewTime returns the value of the "renew_time" field in the mutation.
func (*LeaderElectMutation) ResetAcquireTime ¶
func (m *LeaderElectMutation) ResetAcquireTime()
ResetAcquireTime resets all changes to the "acquire_time" field.
func (*LeaderElectMutation) ResetEdge ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) ResetField ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) ResetHolderIdentity ¶
func (m *LeaderElectMutation) ResetHolderIdentity()
ResetHolderIdentity resets all changes to the "holder_identity" field.
func (*LeaderElectMutation) ResetLeaderTransitions ¶
func (m *LeaderElectMutation) ResetLeaderTransitions()
ResetLeaderTransitions resets all changes to the "leader_transitions" field.
func (*LeaderElectMutation) ResetLeaseDurationSeconds ¶
func (m *LeaderElectMutation) ResetLeaseDurationSeconds()
ResetLeaseDurationSeconds resets all changes to the "lease_duration_seconds" field.
func (*LeaderElectMutation) ResetRenewTime ¶
func (m *LeaderElectMutation) ResetRenewTime()
ResetRenewTime resets all changes to the "renew_time" field.
func (*LeaderElectMutation) ResetResourceVersion ¶
func (m *LeaderElectMutation) ResetResourceVersion()
ResetResourceVersion resets all changes to the "resource_version" field.
func (*LeaderElectMutation) ResourceVersion ¶
func (m *LeaderElectMutation) ResourceVersion() (r string, exists bool)
ResourceVersion returns the value of the "resource_version" field in the mutation.
func (*LeaderElectMutation) SetAcquireTime ¶
func (m *LeaderElectMutation) SetAcquireTime(i int64)
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectMutation) SetField ¶
func (m *LeaderElectMutation) 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 (*LeaderElectMutation) SetHolderIdentity ¶
func (m *LeaderElectMutation) SetHolderIdentity(s string)
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectMutation) SetID ¶
func (m *LeaderElectMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of LeaderElect entities.
func (*LeaderElectMutation) SetLeaderTransitions ¶
func (m *LeaderElectMutation) SetLeaderTransitions(i int)
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectMutation) SetLeaseDurationSeconds ¶
func (m *LeaderElectMutation) SetLeaseDurationSeconds(i int)
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectMutation) SetOp ¶
func (m *LeaderElectMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*LeaderElectMutation) SetRenewTime ¶
func (m *LeaderElectMutation) SetRenewTime(i int64)
SetRenewTime sets the "renew_time" field.
func (*LeaderElectMutation) SetResourceVersion ¶
func (m *LeaderElectMutation) SetResourceVersion(s string)
SetResourceVersion sets the "resource_version" field.
func (LeaderElectMutation) Tx ¶
func (m LeaderElectMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*LeaderElectMutation) Type ¶
func (m *LeaderElectMutation) Type() string
Type returns the node type of this mutation (LeaderElect).
func (*LeaderElectMutation) Where ¶
func (m *LeaderElectMutation) Where(ps ...predicate.LeaderElect)
Where appends a list predicates to the LeaderElectMutation builder.
func (*LeaderElectMutation) WhereP ¶
func (m *LeaderElectMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the LeaderElectMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type LeaderElectQuery ¶
type LeaderElectQuery struct {
// contains filtered or unexported fields
}
LeaderElectQuery is the builder for querying LeaderElect entities.
func (*LeaderElectQuery) Aggregate ¶
func (leq *LeaderElectQuery) Aggregate(fns ...AggregateFunc) *LeaderElectSelect
Aggregate returns a LeaderElectSelect configured with the given aggregations.
func (*LeaderElectQuery) All ¶
func (leq *LeaderElectQuery) All(ctx context.Context) ([]*LeaderElect, error)
All executes the query and returns a list of LeaderElects.
func (*LeaderElectQuery) AllX ¶
func (leq *LeaderElectQuery) AllX(ctx context.Context) []*LeaderElect
AllX is like All, but panics if an error occurs.
func (*LeaderElectQuery) Clone ¶
func (leq *LeaderElectQuery) Clone() *LeaderElectQuery
Clone returns a duplicate of the LeaderElectQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*LeaderElectQuery) Count ¶
func (leq *LeaderElectQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*LeaderElectQuery) CountX ¶
func (leq *LeaderElectQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*LeaderElectQuery) Exist ¶
func (leq *LeaderElectQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*LeaderElectQuery) ExistX ¶
func (leq *LeaderElectQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*LeaderElectQuery) First ¶
func (leq *LeaderElectQuery) First(ctx context.Context) (*LeaderElect, error)
First returns the first LeaderElect entity from the query. Returns a *NotFoundError when no LeaderElect was found.
func (*LeaderElectQuery) FirstID ¶
func (leq *LeaderElectQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first LeaderElect ID from the query. Returns a *NotFoundError when no LeaderElect ID was found.
func (*LeaderElectQuery) FirstIDX ¶
func (leq *LeaderElectQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*LeaderElectQuery) FirstX ¶
func (leq *LeaderElectQuery) FirstX(ctx context.Context) *LeaderElect
FirstX is like First, but panics if an error occurs.
func (*LeaderElectQuery) GroupBy ¶
func (leq *LeaderElectQuery) GroupBy(field string, fields ...string) *LeaderElectGroupBy
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 { ResourceVersion string `json:"resource_version,omitempty"` Count int `json:"count,omitempty"` } client.LeaderElect.Query(). GroupBy(leaderelect.FieldResourceVersion). Aggregate(ent.Count()). Scan(ctx, &v)
func (*LeaderElectQuery) IDs ¶
func (leq *LeaderElectQuery) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of LeaderElect IDs.
func (*LeaderElectQuery) IDsX ¶
func (leq *LeaderElectQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*LeaderElectQuery) Limit ¶
func (leq *LeaderElectQuery) Limit(limit int) *LeaderElectQuery
Limit the number of records to be returned by this query.
func (*LeaderElectQuery) Offset ¶
func (leq *LeaderElectQuery) Offset(offset int) *LeaderElectQuery
Offset to start from.
func (*LeaderElectQuery) Only ¶
func (leq *LeaderElectQuery) Only(ctx context.Context) (*LeaderElect, error)
Only returns a single LeaderElect entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one LeaderElect entity is found. Returns a *NotFoundError when no LeaderElect entities are found.
func (*LeaderElectQuery) OnlyID ¶
func (leq *LeaderElectQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only LeaderElect ID in the query. Returns a *NotSingularError when more than one LeaderElect ID is found. Returns a *NotFoundError when no entities are found.
func (*LeaderElectQuery) OnlyIDX ¶
func (leq *LeaderElectQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*LeaderElectQuery) OnlyX ¶
func (leq *LeaderElectQuery) OnlyX(ctx context.Context) *LeaderElect
OnlyX is like Only, but panics if an error occurs.
func (*LeaderElectQuery) Order ¶
func (leq *LeaderElectQuery) Order(o ...leaderelect.OrderOption) *LeaderElectQuery
Order specifies how the records should be ordered.
func (*LeaderElectQuery) Select ¶
func (leq *LeaderElectQuery) Select(fields ...string) *LeaderElectSelect
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 { ResourceVersion string `json:"resource_version,omitempty"` } client.LeaderElect.Query(). Select(leaderelect.FieldResourceVersion). Scan(ctx, &v)
func (*LeaderElectQuery) Unique ¶
func (leq *LeaderElectQuery) Unique(unique bool) *LeaderElectQuery
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 (*LeaderElectQuery) Where ¶
func (leq *LeaderElectQuery) Where(ps ...predicate.LeaderElect) *LeaderElectQuery
Where adds a new predicate for the LeaderElectQuery builder.
type LeaderElectSelect ¶
type LeaderElectSelect struct { *LeaderElectQuery // contains filtered or unexported fields }
LeaderElectSelect is the builder for selecting fields of LeaderElect entities.
func (*LeaderElectSelect) Aggregate ¶
func (les *LeaderElectSelect) Aggregate(fns ...AggregateFunc) *LeaderElectSelect
Aggregate adds the given aggregation functions to the selector query.
func (*LeaderElectSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*LeaderElectSelect) Scan ¶
func (les *LeaderElectSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*LeaderElectSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type LeaderElectUpdate ¶
type LeaderElectUpdate struct {
// contains filtered or unexported fields
}
LeaderElectUpdate is the builder for updating LeaderElect entities.
func (*LeaderElectUpdate) AddAcquireTime ¶
func (leu *LeaderElectUpdate) AddAcquireTime(i int64) *LeaderElectUpdate
AddAcquireTime adds i to the "acquire_time" field.
func (*LeaderElectUpdate) AddLeaderTransitions ¶
func (leu *LeaderElectUpdate) AddLeaderTransitions(i int) *LeaderElectUpdate
AddLeaderTransitions adds i to the "leader_transitions" field.
func (*LeaderElectUpdate) AddLeaseDurationSeconds ¶
func (leu *LeaderElectUpdate) AddLeaseDurationSeconds(i int) *LeaderElectUpdate
AddLeaseDurationSeconds adds i to the "lease_duration_seconds" field.
func (*LeaderElectUpdate) AddRenewTime ¶
func (leu *LeaderElectUpdate) AddRenewTime(i int64) *LeaderElectUpdate
AddRenewTime adds i to the "renew_time" field.
func (*LeaderElectUpdate) Exec ¶
func (leu *LeaderElectUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*LeaderElectUpdate) ExecX ¶
func (leu *LeaderElectUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectUpdate) Mutation ¶
func (leu *LeaderElectUpdate) Mutation() *LeaderElectMutation
Mutation returns the LeaderElectMutation object of the builder.
func (*LeaderElectUpdate) Save ¶
func (leu *LeaderElectUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*LeaderElectUpdate) SaveX ¶
func (leu *LeaderElectUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*LeaderElectUpdate) SetAcquireTime ¶
func (leu *LeaderElectUpdate) SetAcquireTime(i int64) *LeaderElectUpdate
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectUpdate) SetHolderIdentity ¶
func (leu *LeaderElectUpdate) SetHolderIdentity(s string) *LeaderElectUpdate
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectUpdate) SetLeaderTransitions ¶
func (leu *LeaderElectUpdate) SetLeaderTransitions(i int) *LeaderElectUpdate
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectUpdate) SetLeaseDurationSeconds ¶
func (leu *LeaderElectUpdate) SetLeaseDurationSeconds(i int) *LeaderElectUpdate
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectUpdate) SetNillableResourceVersion ¶
func (leu *LeaderElectUpdate) SetNillableResourceVersion(s *string) *LeaderElectUpdate
SetNillableResourceVersion sets the "resource_version" field if the given value is not nil.
func (*LeaderElectUpdate) SetRenewTime ¶
func (leu *LeaderElectUpdate) SetRenewTime(i int64) *LeaderElectUpdate
SetRenewTime sets the "renew_time" field.
func (*LeaderElectUpdate) SetResourceVersion ¶
func (leu *LeaderElectUpdate) SetResourceVersion(s string) *LeaderElectUpdate
SetResourceVersion sets the "resource_version" field.
func (*LeaderElectUpdate) Where ¶
func (leu *LeaderElectUpdate) Where(ps ...predicate.LeaderElect) *LeaderElectUpdate
Where appends a list predicates to the LeaderElectUpdate builder.
type LeaderElectUpdateOne ¶
type LeaderElectUpdateOne struct {
// contains filtered or unexported fields
}
LeaderElectUpdateOne is the builder for updating a single LeaderElect entity.
func (*LeaderElectUpdateOne) AddAcquireTime ¶
func (leuo *LeaderElectUpdateOne) AddAcquireTime(i int64) *LeaderElectUpdateOne
AddAcquireTime adds i to the "acquire_time" field.
func (*LeaderElectUpdateOne) AddLeaderTransitions ¶
func (leuo *LeaderElectUpdateOne) AddLeaderTransitions(i int) *LeaderElectUpdateOne
AddLeaderTransitions adds i to the "leader_transitions" field.
func (*LeaderElectUpdateOne) AddLeaseDurationSeconds ¶
func (leuo *LeaderElectUpdateOne) AddLeaseDurationSeconds(i int) *LeaderElectUpdateOne
AddLeaseDurationSeconds adds i to the "lease_duration_seconds" field.
func (*LeaderElectUpdateOne) AddRenewTime ¶
func (leuo *LeaderElectUpdateOne) AddRenewTime(i int64) *LeaderElectUpdateOne
AddRenewTime adds i to the "renew_time" field.
func (*LeaderElectUpdateOne) Exec ¶
func (leuo *LeaderElectUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*LeaderElectUpdateOne) ExecX ¶
func (leuo *LeaderElectUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectUpdateOne) Mutation ¶
func (leuo *LeaderElectUpdateOne) Mutation() *LeaderElectMutation
Mutation returns the LeaderElectMutation object of the builder.
func (*LeaderElectUpdateOne) Save ¶
func (leuo *LeaderElectUpdateOne) Save(ctx context.Context) (*LeaderElect, error)
Save executes the query and returns the updated LeaderElect entity.
func (*LeaderElectUpdateOne) SaveX ¶
func (leuo *LeaderElectUpdateOne) SaveX(ctx context.Context) *LeaderElect
SaveX is like Save, but panics if an error occurs.
func (*LeaderElectUpdateOne) Select ¶
func (leuo *LeaderElectUpdateOne) Select(field string, fields ...string) *LeaderElectUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*LeaderElectUpdateOne) SetAcquireTime ¶
func (leuo *LeaderElectUpdateOne) SetAcquireTime(i int64) *LeaderElectUpdateOne
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectUpdateOne) SetHolderIdentity ¶
func (leuo *LeaderElectUpdateOne) SetHolderIdentity(s string) *LeaderElectUpdateOne
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectUpdateOne) SetLeaderTransitions ¶
func (leuo *LeaderElectUpdateOne) SetLeaderTransitions(i int) *LeaderElectUpdateOne
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectUpdateOne) SetLeaseDurationSeconds ¶
func (leuo *LeaderElectUpdateOne) SetLeaseDurationSeconds(i int) *LeaderElectUpdateOne
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectUpdateOne) SetNillableResourceVersion ¶
func (leuo *LeaderElectUpdateOne) SetNillableResourceVersion(s *string) *LeaderElectUpdateOne
SetNillableResourceVersion sets the "resource_version" field if the given value is not nil.
func (*LeaderElectUpdateOne) SetRenewTime ¶
func (leuo *LeaderElectUpdateOne) SetRenewTime(i int64) *LeaderElectUpdateOne
SetRenewTime sets the "renew_time" field.
func (*LeaderElectUpdateOne) SetResourceVersion ¶
func (leuo *LeaderElectUpdateOne) SetResourceVersion(s string) *LeaderElectUpdateOne
SetResourceVersion sets the "resource_version" field.
func (*LeaderElectUpdateOne) Where ¶
func (leuo *LeaderElectUpdateOne) Where(ps ...predicate.LeaderElect) *LeaderElectUpdateOne
Where appends a list predicates to the LeaderElectUpdate builder.
type LeaderElectUpsert ¶
LeaderElectUpsert is the "OnConflict" setter.
func (*LeaderElectUpsert) AddAcquireTime ¶
func (u *LeaderElectUpsert) AddAcquireTime(v int64) *LeaderElectUpsert
AddAcquireTime adds v to the "acquire_time" field.
func (*LeaderElectUpsert) AddLeaderTransitions ¶
func (u *LeaderElectUpsert) AddLeaderTransitions(v int) *LeaderElectUpsert
AddLeaderTransitions adds v to the "leader_transitions" field.
func (*LeaderElectUpsert) AddLeaseDurationSeconds ¶
func (u *LeaderElectUpsert) AddLeaseDurationSeconds(v int) *LeaderElectUpsert
AddLeaseDurationSeconds adds v to the "lease_duration_seconds" field.
func (*LeaderElectUpsert) AddRenewTime ¶
func (u *LeaderElectUpsert) AddRenewTime(v int64) *LeaderElectUpsert
AddRenewTime adds v to the "renew_time" field.
func (*LeaderElectUpsert) SetAcquireTime ¶
func (u *LeaderElectUpsert) SetAcquireTime(v int64) *LeaderElectUpsert
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectUpsert) SetHolderIdentity ¶
func (u *LeaderElectUpsert) SetHolderIdentity(v string) *LeaderElectUpsert
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectUpsert) SetLeaderTransitions ¶
func (u *LeaderElectUpsert) SetLeaderTransitions(v int) *LeaderElectUpsert
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectUpsert) SetLeaseDurationSeconds ¶
func (u *LeaderElectUpsert) SetLeaseDurationSeconds(v int) *LeaderElectUpsert
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectUpsert) SetRenewTime ¶
func (u *LeaderElectUpsert) SetRenewTime(v int64) *LeaderElectUpsert
SetRenewTime sets the "renew_time" field.
func (*LeaderElectUpsert) SetResourceVersion ¶
func (u *LeaderElectUpsert) SetResourceVersion(v string) *LeaderElectUpsert
SetResourceVersion sets the "resource_version" field.
func (*LeaderElectUpsert) UpdateAcquireTime ¶
func (u *LeaderElectUpsert) UpdateAcquireTime() *LeaderElectUpsert
UpdateAcquireTime sets the "acquire_time" field to the value that was provided on create.
func (*LeaderElectUpsert) UpdateHolderIdentity ¶
func (u *LeaderElectUpsert) UpdateHolderIdentity() *LeaderElectUpsert
UpdateHolderIdentity sets the "holder_identity" field to the value that was provided on create.
func (*LeaderElectUpsert) UpdateLeaderTransitions ¶
func (u *LeaderElectUpsert) UpdateLeaderTransitions() *LeaderElectUpsert
UpdateLeaderTransitions sets the "leader_transitions" field to the value that was provided on create.
func (*LeaderElectUpsert) UpdateLeaseDurationSeconds ¶
func (u *LeaderElectUpsert) UpdateLeaseDurationSeconds() *LeaderElectUpsert
UpdateLeaseDurationSeconds sets the "lease_duration_seconds" field to the value that was provided on create.
func (*LeaderElectUpsert) UpdateRenewTime ¶
func (u *LeaderElectUpsert) UpdateRenewTime() *LeaderElectUpsert
UpdateRenewTime sets the "renew_time" field to the value that was provided on create.
func (*LeaderElectUpsert) UpdateResourceVersion ¶
func (u *LeaderElectUpsert) UpdateResourceVersion() *LeaderElectUpsert
UpdateResourceVersion sets the "resource_version" field to the value that was provided on create.
type LeaderElectUpsertBulk ¶
type LeaderElectUpsertBulk struct {
// contains filtered or unexported fields
}
LeaderElectUpsertBulk is the builder for "upsert"-ing a bulk of LeaderElect nodes.
func (*LeaderElectUpsertBulk) AddAcquireTime ¶
func (u *LeaderElectUpsertBulk) AddAcquireTime(v int64) *LeaderElectUpsertBulk
AddAcquireTime adds v to the "acquire_time" field.
func (*LeaderElectUpsertBulk) AddLeaderTransitions ¶
func (u *LeaderElectUpsertBulk) AddLeaderTransitions(v int) *LeaderElectUpsertBulk
AddLeaderTransitions adds v to the "leader_transitions" field.
func (*LeaderElectUpsertBulk) AddLeaseDurationSeconds ¶
func (u *LeaderElectUpsertBulk) AddLeaseDurationSeconds(v int) *LeaderElectUpsertBulk
AddLeaseDurationSeconds adds v to the "lease_duration_seconds" field.
func (*LeaderElectUpsertBulk) AddRenewTime ¶
func (u *LeaderElectUpsertBulk) AddRenewTime(v int64) *LeaderElectUpsertBulk
AddRenewTime adds v to the "renew_time" field.
func (*LeaderElectUpsertBulk) DoNothing ¶
func (u *LeaderElectUpsertBulk) DoNothing() *LeaderElectUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*LeaderElectUpsertBulk) Exec ¶
func (u *LeaderElectUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*LeaderElectUpsertBulk) ExecX ¶
func (u *LeaderElectUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectUpsertBulk) Ignore ¶
func (u *LeaderElectUpsertBulk) Ignore() *LeaderElectUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.LeaderElect.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*LeaderElectUpsertBulk) SetAcquireTime ¶
func (u *LeaderElectUpsertBulk) SetAcquireTime(v int64) *LeaderElectUpsertBulk
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectUpsertBulk) SetHolderIdentity ¶
func (u *LeaderElectUpsertBulk) SetHolderIdentity(v string) *LeaderElectUpsertBulk
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectUpsertBulk) SetLeaderTransitions ¶
func (u *LeaderElectUpsertBulk) SetLeaderTransitions(v int) *LeaderElectUpsertBulk
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectUpsertBulk) SetLeaseDurationSeconds ¶
func (u *LeaderElectUpsertBulk) SetLeaseDurationSeconds(v int) *LeaderElectUpsertBulk
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectUpsertBulk) SetRenewTime ¶
func (u *LeaderElectUpsertBulk) SetRenewTime(v int64) *LeaderElectUpsertBulk
SetRenewTime sets the "renew_time" field.
func (*LeaderElectUpsertBulk) SetResourceVersion ¶
func (u *LeaderElectUpsertBulk) SetResourceVersion(v string) *LeaderElectUpsertBulk
SetResourceVersion sets the "resource_version" field.
func (*LeaderElectUpsertBulk) Update ¶
func (u *LeaderElectUpsertBulk) Update(set func(*LeaderElectUpsert)) *LeaderElectUpsertBulk
Update allows overriding fields `UPDATE` values. See the LeaderElectCreateBulk.OnConflict documentation for more info.
func (*LeaderElectUpsertBulk) UpdateAcquireTime ¶
func (u *LeaderElectUpsertBulk) UpdateAcquireTime() *LeaderElectUpsertBulk
UpdateAcquireTime sets the "acquire_time" field to the value that was provided on create.
func (*LeaderElectUpsertBulk) UpdateHolderIdentity ¶
func (u *LeaderElectUpsertBulk) UpdateHolderIdentity() *LeaderElectUpsertBulk
UpdateHolderIdentity sets the "holder_identity" field to the value that was provided on create.
func (*LeaderElectUpsertBulk) UpdateLeaderTransitions ¶
func (u *LeaderElectUpsertBulk) UpdateLeaderTransitions() *LeaderElectUpsertBulk
UpdateLeaderTransitions sets the "leader_transitions" field to the value that was provided on create.
func (*LeaderElectUpsertBulk) UpdateLeaseDurationSeconds ¶
func (u *LeaderElectUpsertBulk) UpdateLeaseDurationSeconds() *LeaderElectUpsertBulk
UpdateLeaseDurationSeconds sets the "lease_duration_seconds" field to the value that was provided on create.
func (*LeaderElectUpsertBulk) UpdateNewValues ¶
func (u *LeaderElectUpsertBulk) UpdateNewValues() *LeaderElectUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.LeaderElect.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(leaderelect.FieldID) }), ). Exec(ctx)
func (*LeaderElectUpsertBulk) UpdateRenewTime ¶
func (u *LeaderElectUpsertBulk) UpdateRenewTime() *LeaderElectUpsertBulk
UpdateRenewTime sets the "renew_time" field to the value that was provided on create.
func (*LeaderElectUpsertBulk) UpdateResourceVersion ¶
func (u *LeaderElectUpsertBulk) UpdateResourceVersion() *LeaderElectUpsertBulk
UpdateResourceVersion sets the "resource_version" field to the value that was provided on create.
type LeaderElectUpsertOne ¶
type LeaderElectUpsertOne struct {
// contains filtered or unexported fields
}
LeaderElectUpsertOne is the builder for "upsert"-ing
one LeaderElect node.
func (*LeaderElectUpsertOne) AddAcquireTime ¶
func (u *LeaderElectUpsertOne) AddAcquireTime(v int64) *LeaderElectUpsertOne
AddAcquireTime adds v to the "acquire_time" field.
func (*LeaderElectUpsertOne) AddLeaderTransitions ¶
func (u *LeaderElectUpsertOne) AddLeaderTransitions(v int) *LeaderElectUpsertOne
AddLeaderTransitions adds v to the "leader_transitions" field.
func (*LeaderElectUpsertOne) AddLeaseDurationSeconds ¶
func (u *LeaderElectUpsertOne) AddLeaseDurationSeconds(v int) *LeaderElectUpsertOne
AddLeaseDurationSeconds adds v to the "lease_duration_seconds" field.
func (*LeaderElectUpsertOne) AddRenewTime ¶
func (u *LeaderElectUpsertOne) AddRenewTime(v int64) *LeaderElectUpsertOne
AddRenewTime adds v to the "renew_time" field.
func (*LeaderElectUpsertOne) DoNothing ¶
func (u *LeaderElectUpsertOne) DoNothing() *LeaderElectUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*LeaderElectUpsertOne) Exec ¶
func (u *LeaderElectUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*LeaderElectUpsertOne) ExecX ¶
func (u *LeaderElectUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*LeaderElectUpsertOne) ID ¶
func (u *LeaderElectUpsertOne) ID(ctx context.Context) (id string, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*LeaderElectUpsertOne) IDX ¶
func (u *LeaderElectUpsertOne) IDX(ctx context.Context) string
IDX is like ID, but panics if an error occurs.
func (*LeaderElectUpsertOne) Ignore ¶
func (u *LeaderElectUpsertOne) Ignore() *LeaderElectUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.LeaderElect.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*LeaderElectUpsertOne) SetAcquireTime ¶
func (u *LeaderElectUpsertOne) SetAcquireTime(v int64) *LeaderElectUpsertOne
SetAcquireTime sets the "acquire_time" field.
func (*LeaderElectUpsertOne) SetHolderIdentity ¶
func (u *LeaderElectUpsertOne) SetHolderIdentity(v string) *LeaderElectUpsertOne
SetHolderIdentity sets the "holder_identity" field.
func (*LeaderElectUpsertOne) SetLeaderTransitions ¶
func (u *LeaderElectUpsertOne) SetLeaderTransitions(v int) *LeaderElectUpsertOne
SetLeaderTransitions sets the "leader_transitions" field.
func (*LeaderElectUpsertOne) SetLeaseDurationSeconds ¶
func (u *LeaderElectUpsertOne) SetLeaseDurationSeconds(v int) *LeaderElectUpsertOne
SetLeaseDurationSeconds sets the "lease_duration_seconds" field.
func (*LeaderElectUpsertOne) SetRenewTime ¶
func (u *LeaderElectUpsertOne) SetRenewTime(v int64) *LeaderElectUpsertOne
SetRenewTime sets the "renew_time" field.
func (*LeaderElectUpsertOne) SetResourceVersion ¶
func (u *LeaderElectUpsertOne) SetResourceVersion(v string) *LeaderElectUpsertOne
SetResourceVersion sets the "resource_version" field.
func (*LeaderElectUpsertOne) Update ¶
func (u *LeaderElectUpsertOne) Update(set func(*LeaderElectUpsert)) *LeaderElectUpsertOne
Update allows overriding fields `UPDATE` values. See the LeaderElectCreate.OnConflict documentation for more info.
func (*LeaderElectUpsertOne) UpdateAcquireTime ¶
func (u *LeaderElectUpsertOne) UpdateAcquireTime() *LeaderElectUpsertOne
UpdateAcquireTime sets the "acquire_time" field to the value that was provided on create.
func (*LeaderElectUpsertOne) UpdateHolderIdentity ¶
func (u *LeaderElectUpsertOne) UpdateHolderIdentity() *LeaderElectUpsertOne
UpdateHolderIdentity sets the "holder_identity" field to the value that was provided on create.
func (*LeaderElectUpsertOne) UpdateLeaderTransitions ¶
func (u *LeaderElectUpsertOne) UpdateLeaderTransitions() *LeaderElectUpsertOne
UpdateLeaderTransitions sets the "leader_transitions" field to the value that was provided on create.
func (*LeaderElectUpsertOne) UpdateLeaseDurationSeconds ¶
func (u *LeaderElectUpsertOne) UpdateLeaseDurationSeconds() *LeaderElectUpsertOne
UpdateLeaseDurationSeconds sets the "lease_duration_seconds" field to the value that was provided on create.
func (*LeaderElectUpsertOne) UpdateNewValues ¶
func (u *LeaderElectUpsertOne) UpdateNewValues() *LeaderElectUpsertOne
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.LeaderElect.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(leaderelect.FieldID) }), ). Exec(ctx)
func (*LeaderElectUpsertOne) UpdateRenewTime ¶
func (u *LeaderElectUpsertOne) UpdateRenewTime() *LeaderElectUpsertOne
UpdateRenewTime sets the "renew_time" field to the value that was provided on create.
func (*LeaderElectUpsertOne) UpdateResourceVersion ¶
func (u *LeaderElectUpsertOne) UpdateResourceVersion() *LeaderElectUpsertOne
UpdateResourceVersion sets the "resource_version" field to the value that was provided on create.
type LeaderElects ¶
type LeaderElects []*LeaderElect
LeaderElects is a parsable slice of LeaderElect.
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 { // LeaderElect is the client for interacting with the LeaderElect builders. LeaderElect *LeaderElectClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.