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 Cluster
- type ClusterClient
- func (c *ClusterClient) Create() *ClusterCreate
- func (c *ClusterClient) CreateBulk(builders ...*ClusterCreate) *ClusterCreateBulk
- func (c *ClusterClient) Delete() *ClusterDelete
- func (c *ClusterClient) DeleteOne(cl *Cluster) *ClusterDeleteOne
- func (c *ClusterClient) DeleteOneID(id int64) *ClusterDeleteOne
- func (c *ClusterClient) Get(ctx context.Context, id int64) (*Cluster, error)
- func (c *ClusterClient) GetX(ctx context.Context, id int64) *Cluster
- func (c *ClusterClient) Hooks() []Hook
- func (c *ClusterClient) Intercept(interceptors ...Interceptor)
- func (c *ClusterClient) Interceptors() []Interceptor
- func (c *ClusterClient) Query() *ClusterQuery
- func (c *ClusterClient) Update() *ClusterUpdate
- func (c *ClusterClient) UpdateOne(cl *Cluster) *ClusterUpdateOne
- func (c *ClusterClient) UpdateOneID(id int64) *ClusterUpdateOne
- func (c *ClusterClient) Use(hooks ...Hook)
- type ClusterCreate
- func (cc *ClusterCreate) Exec(ctx context.Context) error
- func (cc *ClusterCreate) ExecX(ctx context.Context)
- func (cc *ClusterCreate) Mutation() *ClusterMutation
- func (cc *ClusterCreate) Save(ctx context.Context) (*Cluster, error)
- func (cc *ClusterCreate) SaveX(ctx context.Context) *Cluster
- func (cc *ClusterCreate) SetDisplayName(s string) *ClusterCreate
- func (cc *ClusterCreate) SetID(i int64) *ClusterCreate
- func (cc *ClusterCreate) SetMachineType(i int32) *ClusterCreate
- func (cc *ClusterCreate) SetName(s string) *ClusterCreate
- func (cc *ClusterCreate) SetNumNodes(i int32) *ClusterCreate
- type ClusterCreateBulk
- type ClusterDelete
- type ClusterDeleteOne
- type ClusterGroupBy
- func (cgb *ClusterGroupBy) Aggregate(fns ...AggregateFunc) *ClusterGroupBy
- func (s *ClusterGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ClusterGroupBy) BoolX(ctx context.Context) bool
- func (s *ClusterGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ClusterGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ClusterGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ClusterGroupBy) Float64X(ctx context.Context) float64
- func (s *ClusterGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ClusterGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ClusterGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ClusterGroupBy) IntX(ctx context.Context) int
- func (s *ClusterGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ClusterGroupBy) IntsX(ctx context.Context) []int
- func (cgb *ClusterGroupBy) Scan(ctx context.Context, v any) error
- func (s *ClusterGroupBy) ScanX(ctx context.Context, v any)
- func (s *ClusterGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ClusterGroupBy) StringX(ctx context.Context) string
- func (s *ClusterGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ClusterGroupBy) StringsX(ctx context.Context) []string
- type ClusterMutation
- func (m *ClusterMutation) AddField(name string, value ent.Value) error
- func (m *ClusterMutation) AddMachineType(i int32)
- func (m *ClusterMutation) AddNumNodes(i int32)
- func (m *ClusterMutation) AddedEdges() []string
- func (m *ClusterMutation) AddedField(name string) (ent.Value, bool)
- func (m *ClusterMutation) AddedFields() []string
- func (m *ClusterMutation) AddedIDs(name string) []ent.Value
- func (m *ClusterMutation) AddedMachineType() (r int32, exists bool)
- func (m *ClusterMutation) AddedNumNodes() (r int32, exists bool)
- func (m *ClusterMutation) ClearEdge(name string) error
- func (m *ClusterMutation) ClearField(name string) error
- func (m *ClusterMutation) ClearedEdges() []string
- func (m *ClusterMutation) ClearedFields() []string
- func (m ClusterMutation) Client() *Client
- func (m *ClusterMutation) DisplayName() (r string, exists bool)
- func (m *ClusterMutation) EdgeCleared(name string) bool
- func (m *ClusterMutation) Field(name string) (ent.Value, bool)
- func (m *ClusterMutation) FieldCleared(name string) bool
- func (m *ClusterMutation) Fields() []string
- func (m *ClusterMutation) ID() (id int64, exists bool)
- func (m *ClusterMutation) IDs(ctx context.Context) ([]int64, error)
- func (m *ClusterMutation) MachineType() (r int32, exists bool)
- func (m *ClusterMutation) Name() (r string, exists bool)
- func (m *ClusterMutation) NumNodes() (r int32, exists bool)
- func (m *ClusterMutation) OldDisplayName(ctx context.Context) (v string, err error)
- func (m *ClusterMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ClusterMutation) OldMachineType(ctx context.Context) (v int32, err error)
- func (m *ClusterMutation) OldName(ctx context.Context) (v string, err error)
- func (m *ClusterMutation) OldNumNodes(ctx context.Context) (v int32, err error)
- func (m *ClusterMutation) Op() Op
- func (m *ClusterMutation) RemovedEdges() []string
- func (m *ClusterMutation) RemovedIDs(name string) []ent.Value
- func (m *ClusterMutation) ResetDisplayName()
- func (m *ClusterMutation) ResetEdge(name string) error
- func (m *ClusterMutation) ResetField(name string) error
- func (m *ClusterMutation) ResetMachineType()
- func (m *ClusterMutation) ResetName()
- func (m *ClusterMutation) ResetNumNodes()
- func (m *ClusterMutation) SetDisplayName(s string)
- func (m *ClusterMutation) SetField(name string, value ent.Value) error
- func (m *ClusterMutation) SetID(id int64)
- func (m *ClusterMutation) SetMachineType(i int32)
- func (m *ClusterMutation) SetName(s string)
- func (m *ClusterMutation) SetNumNodes(i int32)
- func (m *ClusterMutation) SetOp(op Op)
- func (m ClusterMutation) Tx() (*Tx, error)
- func (m *ClusterMutation) Type() string
- func (m *ClusterMutation) Where(ps ...predicate.Cluster)
- func (m *ClusterMutation) WhereP(ps ...func(*sql.Selector))
- type ClusterQuery
- func (cq *ClusterQuery) Aggregate(fns ...AggregateFunc) *ClusterSelect
- func (cq *ClusterQuery) All(ctx context.Context) ([]*Cluster, error)
- func (cq *ClusterQuery) AllX(ctx context.Context) []*Cluster
- func (cq *ClusterQuery) Clone() *ClusterQuery
- func (cq *ClusterQuery) Count(ctx context.Context) (int, error)
- func (cq *ClusterQuery) CountX(ctx context.Context) int
- func (cq *ClusterQuery) Exist(ctx context.Context) (bool, error)
- func (cq *ClusterQuery) ExistX(ctx context.Context) bool
- func (cq *ClusterQuery) First(ctx context.Context) (*Cluster, error)
- func (cq *ClusterQuery) FirstID(ctx context.Context) (id int64, err error)
- func (cq *ClusterQuery) FirstIDX(ctx context.Context) int64
- func (cq *ClusterQuery) FirstX(ctx context.Context) *Cluster
- func (cq *ClusterQuery) GroupBy(field string, fields ...string) *ClusterGroupBy
- func (cq *ClusterQuery) IDs(ctx context.Context) (ids []int64, err error)
- func (cq *ClusterQuery) IDsX(ctx context.Context) []int64
- func (cq *ClusterQuery) Limit(limit int) *ClusterQuery
- func (cq *ClusterQuery) Offset(offset int) *ClusterQuery
- func (cq *ClusterQuery) Only(ctx context.Context) (*Cluster, error)
- func (cq *ClusterQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (cq *ClusterQuery) OnlyIDX(ctx context.Context) int64
- func (cq *ClusterQuery) OnlyX(ctx context.Context) *Cluster
- func (cq *ClusterQuery) Order(o ...cluster.OrderOption) *ClusterQuery
- func (cq *ClusterQuery) Select(fields ...string) *ClusterSelect
- func (cq *ClusterQuery) Unique(unique bool) *ClusterQuery
- func (cq *ClusterQuery) Where(ps ...predicate.Cluster) *ClusterQuery
- type ClusterSelect
- func (cs *ClusterSelect) Aggregate(fns ...AggregateFunc) *ClusterSelect
- func (s *ClusterSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ClusterSelect) BoolX(ctx context.Context) bool
- func (s *ClusterSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ClusterSelect) BoolsX(ctx context.Context) []bool
- func (s *ClusterSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ClusterSelect) Float64X(ctx context.Context) float64
- func (s *ClusterSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ClusterSelect) Float64sX(ctx context.Context) []float64
- func (s *ClusterSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ClusterSelect) IntX(ctx context.Context) int
- func (s *ClusterSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ClusterSelect) IntsX(ctx context.Context) []int
- func (cs *ClusterSelect) Scan(ctx context.Context, v any) error
- func (s *ClusterSelect) ScanX(ctx context.Context, v any)
- func (s *ClusterSelect) String(ctx context.Context) (_ string, err error)
- func (s *ClusterSelect) StringX(ctx context.Context) string
- func (s *ClusterSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ClusterSelect) StringsX(ctx context.Context) []string
- type ClusterUpdate
- func (cu *ClusterUpdate) AddMachineType(i int32) *ClusterUpdate
- func (cu *ClusterUpdate) AddNumNodes(i int32) *ClusterUpdate
- func (cu *ClusterUpdate) Exec(ctx context.Context) error
- func (cu *ClusterUpdate) ExecX(ctx context.Context)
- func (cu *ClusterUpdate) Mutation() *ClusterMutation
- func (cu *ClusterUpdate) Save(ctx context.Context) (int, error)
- func (cu *ClusterUpdate) SaveX(ctx context.Context) int
- func (cu *ClusterUpdate) SetDisplayName(s string) *ClusterUpdate
- func (cu *ClusterUpdate) SetMachineType(i int32) *ClusterUpdate
- func (cu *ClusterUpdate) SetName(s string) *ClusterUpdate
- func (cu *ClusterUpdate) SetNumNodes(i int32) *ClusterUpdate
- func (cu *ClusterUpdate) Where(ps ...predicate.Cluster) *ClusterUpdate
- type ClusterUpdateOne
- func (cuo *ClusterUpdateOne) AddMachineType(i int32) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) AddNumNodes(i int32) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) Exec(ctx context.Context) error
- func (cuo *ClusterUpdateOne) ExecX(ctx context.Context)
- func (cuo *ClusterUpdateOne) Mutation() *ClusterMutation
- func (cuo *ClusterUpdateOne) Save(ctx context.Context) (*Cluster, error)
- func (cuo *ClusterUpdateOne) SaveX(ctx context.Context) *Cluster
- func (cuo *ClusterUpdateOne) Select(field string, fields ...string) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) SetDisplayName(s string) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) SetMachineType(i int32) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) SetName(s string) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) SetNumNodes(i int32) *ClusterUpdateOne
- func (cuo *ClusterUpdateOne) Where(ps ...predicate.Cluster) *ClusterUpdateOne
- type Clusters
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeCluster = "Cluster" )
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 // Cluster is the client for interacting with the Cluster builders. Cluster *ClusterClient // 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(). Cluster. 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 Cluster ¶
type Cluster struct { // ID of the ent. ID int64 `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // DisplayName holds the value of the "display_name" field. DisplayName string `json:"display_name,omitempty"` // NumNodes holds the value of the "num_nodes" field. NumNodes int32 `json:"num_nodes,omitempty"` // MachineType holds the value of the "machine_type" field. MachineType int32 `json:"machine_type,omitempty"` // contains filtered or unexported fields }
Cluster is the model entity for the Cluster schema.
func (*Cluster) Unwrap ¶
Unwrap unwraps the Cluster 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 (*Cluster) Update ¶
func (c *Cluster) Update() *ClusterUpdateOne
Update returns a builder for updating this Cluster. Note that you need to call Cluster.Unwrap() before calling this method if this Cluster was returned from a transaction, and the transaction was committed or rolled back.
type ClusterClient ¶
type ClusterClient struct {
// contains filtered or unexported fields
}
ClusterClient is a client for the Cluster schema.
func NewClusterClient ¶
func NewClusterClient(c config) *ClusterClient
NewClusterClient returns a client for the Cluster from the given config.
func (*ClusterClient) Create ¶
func (c *ClusterClient) Create() *ClusterCreate
Create returns a builder for creating a Cluster entity.
func (*ClusterClient) CreateBulk ¶
func (c *ClusterClient) CreateBulk(builders ...*ClusterCreate) *ClusterCreateBulk
CreateBulk returns a builder for creating a bulk of Cluster entities.
func (*ClusterClient) Delete ¶
func (c *ClusterClient) Delete() *ClusterDelete
Delete returns a delete builder for Cluster.
func (*ClusterClient) DeleteOne ¶
func (c *ClusterClient) DeleteOne(cl *Cluster) *ClusterDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*ClusterClient) DeleteOneID ¶
func (c *ClusterClient) DeleteOneID(id int64) *ClusterDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*ClusterClient) GetX ¶
func (c *ClusterClient) GetX(ctx context.Context, id int64) *Cluster
GetX is like Get, but panics if an error occurs.
func (*ClusterClient) Hooks ¶
func (c *ClusterClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ClusterClient) Intercept ¶
func (c *ClusterClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `cluster.Intercept(f(g(h())))`.
func (*ClusterClient) Interceptors ¶
func (c *ClusterClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*ClusterClient) Query ¶
func (c *ClusterClient) Query() *ClusterQuery
Query returns a query builder for Cluster.
func (*ClusterClient) Update ¶
func (c *ClusterClient) Update() *ClusterUpdate
Update returns an update builder for Cluster.
func (*ClusterClient) UpdateOne ¶
func (c *ClusterClient) UpdateOne(cl *Cluster) *ClusterUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ClusterClient) UpdateOneID ¶
func (c *ClusterClient) UpdateOneID(id int64) *ClusterUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ClusterClient) Use ¶
func (c *ClusterClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `cluster.Hooks(f(g(h())))`.
type ClusterCreate ¶
type ClusterCreate struct {
// contains filtered or unexported fields
}
ClusterCreate is the builder for creating a Cluster entity.
func (*ClusterCreate) Exec ¶
func (cc *ClusterCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ClusterCreate) ExecX ¶
func (cc *ClusterCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ClusterCreate) Mutation ¶
func (cc *ClusterCreate) Mutation() *ClusterMutation
Mutation returns the ClusterMutation object of the builder.
func (*ClusterCreate) Save ¶
func (cc *ClusterCreate) Save(ctx context.Context) (*Cluster, error)
Save creates the Cluster in the database.
func (*ClusterCreate) SaveX ¶
func (cc *ClusterCreate) SaveX(ctx context.Context) *Cluster
SaveX calls Save and panics if Save returns an error.
func (*ClusterCreate) SetDisplayName ¶
func (cc *ClusterCreate) SetDisplayName(s string) *ClusterCreate
SetDisplayName sets the "display_name" field.
func (*ClusterCreate) SetID ¶
func (cc *ClusterCreate) SetID(i int64) *ClusterCreate
SetID sets the "id" field.
func (*ClusterCreate) SetMachineType ¶
func (cc *ClusterCreate) SetMachineType(i int32) *ClusterCreate
SetMachineType sets the "machine_type" field.
func (*ClusterCreate) SetName ¶
func (cc *ClusterCreate) SetName(s string) *ClusterCreate
SetName sets the "name" field.
func (*ClusterCreate) SetNumNodes ¶
func (cc *ClusterCreate) SetNumNodes(i int32) *ClusterCreate
SetNumNodes sets the "num_nodes" field.
type ClusterCreateBulk ¶
type ClusterCreateBulk struct {
// contains filtered or unexported fields
}
ClusterCreateBulk is the builder for creating many Cluster entities in bulk.
func (*ClusterCreateBulk) Exec ¶
func (ccb *ClusterCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ClusterCreateBulk) ExecX ¶
func (ccb *ClusterCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ClusterDelete ¶
type ClusterDelete struct {
// contains filtered or unexported fields
}
ClusterDelete is the builder for deleting a Cluster entity.
func (*ClusterDelete) Exec ¶
func (cd *ClusterDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ClusterDelete) ExecX ¶
func (cd *ClusterDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ClusterDelete) Where ¶
func (cd *ClusterDelete) Where(ps ...predicate.Cluster) *ClusterDelete
Where appends a list predicates to the ClusterDelete builder.
type ClusterDeleteOne ¶
type ClusterDeleteOne struct {
// contains filtered or unexported fields
}
ClusterDeleteOne is the builder for deleting a single Cluster entity.
func (*ClusterDeleteOne) Exec ¶
func (cdo *ClusterDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ClusterDeleteOne) ExecX ¶
func (cdo *ClusterDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ClusterDeleteOne) Where ¶
func (cdo *ClusterDeleteOne) Where(ps ...predicate.Cluster) *ClusterDeleteOne
Where appends a list predicates to the ClusterDelete builder.
type ClusterGroupBy ¶
type ClusterGroupBy struct {
// contains filtered or unexported fields
}
ClusterGroupBy is the group-by builder for Cluster entities.
func (*ClusterGroupBy) Aggregate ¶
func (cgb *ClusterGroupBy) Aggregate(fns ...AggregateFunc) *ClusterGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ClusterGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ClusterGroupBy) Scan ¶
func (cgb *ClusterGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ClusterGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ClusterMutation ¶
type ClusterMutation struct {
// contains filtered or unexported fields
}
ClusterMutation represents an operation that mutates the Cluster nodes in the graph.
func (*ClusterMutation) AddField ¶
func (m *ClusterMutation) 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 (*ClusterMutation) AddMachineType ¶
func (m *ClusterMutation) AddMachineType(i int32)
AddMachineType adds i to the "machine_type" field.
func (*ClusterMutation) AddNumNodes ¶
func (m *ClusterMutation) AddNumNodes(i int32)
AddNumNodes adds i to the "num_nodes" field.
func (*ClusterMutation) AddedEdges ¶
func (m *ClusterMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ClusterMutation) AddedField ¶
func (m *ClusterMutation) 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 (*ClusterMutation) AddedFields ¶
func (m *ClusterMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ClusterMutation) AddedIDs ¶
func (m *ClusterMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ClusterMutation) AddedMachineType ¶
func (m *ClusterMutation) AddedMachineType() (r int32, exists bool)
AddedMachineType returns the value that was added to the "machine_type" field in this mutation.
func (*ClusterMutation) AddedNumNodes ¶
func (m *ClusterMutation) AddedNumNodes() (r int32, exists bool)
AddedNumNodes returns the value that was added to the "num_nodes" field in this mutation.
func (*ClusterMutation) ClearEdge ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ClearField ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ClearedEdges ¶
func (m *ClusterMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ClusterMutation) ClearedFields ¶
func (m *ClusterMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ClusterMutation) Client ¶
func (m ClusterMutation) 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 (*ClusterMutation) DisplayName ¶
func (m *ClusterMutation) DisplayName() (r string, exists bool)
DisplayName returns the value of the "display_name" field in the mutation.
func (*ClusterMutation) EdgeCleared ¶
func (m *ClusterMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ClusterMutation) Field ¶
func (m *ClusterMutation) 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 (*ClusterMutation) FieldCleared ¶
func (m *ClusterMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ClusterMutation) Fields ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ID ¶
func (m *ClusterMutation) ID() (id int64, 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 (*ClusterMutation) IDs ¶
func (m *ClusterMutation) IDs(ctx context.Context) ([]int64, 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 (*ClusterMutation) MachineType ¶
func (m *ClusterMutation) MachineType() (r int32, exists bool)
MachineType returns the value of the "machine_type" field in the mutation.
func (*ClusterMutation) Name ¶
func (m *ClusterMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*ClusterMutation) NumNodes ¶
func (m *ClusterMutation) NumNodes() (r int32, exists bool)
NumNodes returns the value of the "num_nodes" field in the mutation.
func (*ClusterMutation) OldDisplayName ¶
func (m *ClusterMutation) OldDisplayName(ctx context.Context) (v string, err error)
OldDisplayName returns the old "display_name" field's value of the Cluster entity. If the Cluster 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 (*ClusterMutation) 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 (*ClusterMutation) OldMachineType ¶
func (m *ClusterMutation) OldMachineType(ctx context.Context) (v int32, err error)
OldMachineType returns the old "machine_type" field's value of the Cluster entity. If the Cluster 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 (*ClusterMutation) OldName ¶
func (m *ClusterMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Cluster entity. If the Cluster 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 (*ClusterMutation) OldNumNodes ¶
func (m *ClusterMutation) OldNumNodes(ctx context.Context) (v int32, err error)
OldNumNodes returns the old "num_nodes" field's value of the Cluster entity. If the Cluster 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 (*ClusterMutation) RemovedEdges ¶
func (m *ClusterMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ClusterMutation) RemovedIDs ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ResetDisplayName ¶
func (m *ClusterMutation) ResetDisplayName()
ResetDisplayName resets all changes to the "display_name" field.
func (*ClusterMutation) ResetEdge ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ResetField ¶
func (m *ClusterMutation) 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 (*ClusterMutation) ResetMachineType ¶
func (m *ClusterMutation) ResetMachineType()
ResetMachineType resets all changes to the "machine_type" field.
func (*ClusterMutation) ResetName ¶
func (m *ClusterMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*ClusterMutation) ResetNumNodes ¶
func (m *ClusterMutation) ResetNumNodes()
ResetNumNodes resets all changes to the "num_nodes" field.
func (*ClusterMutation) SetDisplayName ¶
func (m *ClusterMutation) SetDisplayName(s string)
SetDisplayName sets the "display_name" field.
func (*ClusterMutation) SetField ¶
func (m *ClusterMutation) 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 (*ClusterMutation) SetID ¶
func (m *ClusterMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Cluster entities.
func (*ClusterMutation) SetMachineType ¶
func (m *ClusterMutation) SetMachineType(i int32)
SetMachineType sets the "machine_type" field.
func (*ClusterMutation) SetName ¶
func (m *ClusterMutation) SetName(s string)
SetName sets the "name" field.
func (*ClusterMutation) SetNumNodes ¶
func (m *ClusterMutation) SetNumNodes(i int32)
SetNumNodes sets the "num_nodes" field.
func (*ClusterMutation) SetOp ¶
func (m *ClusterMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (ClusterMutation) Tx ¶
func (m ClusterMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ClusterMutation) Type ¶
func (m *ClusterMutation) Type() string
Type returns the node type of this mutation (Cluster).
func (*ClusterMutation) Where ¶
func (m *ClusterMutation) Where(ps ...predicate.Cluster)
Where appends a list predicates to the ClusterMutation builder.
func (*ClusterMutation) WhereP ¶
func (m *ClusterMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the ClusterMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type ClusterQuery ¶
type ClusterQuery struct {
// contains filtered or unexported fields
}
ClusterQuery is the builder for querying Cluster entities.
func (*ClusterQuery) Aggregate ¶
func (cq *ClusterQuery) Aggregate(fns ...AggregateFunc) *ClusterSelect
Aggregate returns a ClusterSelect configured with the given aggregations.
func (*ClusterQuery) All ¶
func (cq *ClusterQuery) All(ctx context.Context) ([]*Cluster, error)
All executes the query and returns a list of Clusters.
func (*ClusterQuery) AllX ¶
func (cq *ClusterQuery) AllX(ctx context.Context) []*Cluster
AllX is like All, but panics if an error occurs.
func (*ClusterQuery) Clone ¶
func (cq *ClusterQuery) Clone() *ClusterQuery
Clone returns a duplicate of the ClusterQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ClusterQuery) Count ¶
func (cq *ClusterQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ClusterQuery) CountX ¶
func (cq *ClusterQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ClusterQuery) Exist ¶
func (cq *ClusterQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ClusterQuery) ExistX ¶
func (cq *ClusterQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ClusterQuery) First ¶
func (cq *ClusterQuery) First(ctx context.Context) (*Cluster, error)
First returns the first Cluster entity from the query. Returns a *NotFoundError when no Cluster was found.
func (*ClusterQuery) FirstID ¶
func (cq *ClusterQuery) FirstID(ctx context.Context) (id int64, err error)
FirstID returns the first Cluster ID from the query. Returns a *NotFoundError when no Cluster ID was found.
func (*ClusterQuery) FirstIDX ¶
func (cq *ClusterQuery) FirstIDX(ctx context.Context) int64
FirstIDX is like FirstID, but panics if an error occurs.
func (*ClusterQuery) FirstX ¶
func (cq *ClusterQuery) FirstX(ctx context.Context) *Cluster
FirstX is like First, but panics if an error occurs.
func (*ClusterQuery) GroupBy ¶
func (cq *ClusterQuery) GroupBy(field string, fields ...string) *ClusterGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Cluster.Query(). GroupBy(cluster.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ClusterQuery) IDs ¶
func (cq *ClusterQuery) IDs(ctx context.Context) (ids []int64, err error)
IDs executes the query and returns a list of Cluster IDs.
func (*ClusterQuery) IDsX ¶
func (cq *ClusterQuery) IDsX(ctx context.Context) []int64
IDsX is like IDs, but panics if an error occurs.
func (*ClusterQuery) Limit ¶
func (cq *ClusterQuery) Limit(limit int) *ClusterQuery
Limit the number of records to be returned by this query.
func (*ClusterQuery) Offset ¶
func (cq *ClusterQuery) Offset(offset int) *ClusterQuery
Offset to start from.
func (*ClusterQuery) Only ¶
func (cq *ClusterQuery) Only(ctx context.Context) (*Cluster, error)
Only returns a single Cluster entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Cluster entity is found. Returns a *NotFoundError when no Cluster entities are found.
func (*ClusterQuery) OnlyID ¶
func (cq *ClusterQuery) OnlyID(ctx context.Context) (id int64, err error)
OnlyID is like Only, but returns the only Cluster ID in the query. Returns a *NotSingularError when more than one Cluster ID is found. Returns a *NotFoundError when no entities are found.
func (*ClusterQuery) OnlyIDX ¶
func (cq *ClusterQuery) OnlyIDX(ctx context.Context) int64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ClusterQuery) OnlyX ¶
func (cq *ClusterQuery) OnlyX(ctx context.Context) *Cluster
OnlyX is like Only, but panics if an error occurs.
func (*ClusterQuery) Order ¶
func (cq *ClusterQuery) Order(o ...cluster.OrderOption) *ClusterQuery
Order specifies how the records should be ordered.
func (*ClusterQuery) Select ¶
func (cq *ClusterQuery) Select(fields ...string) *ClusterSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Cluster.Query(). Select(cluster.FieldName). Scan(ctx, &v)
func (*ClusterQuery) Unique ¶
func (cq *ClusterQuery) Unique(unique bool) *ClusterQuery
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 (*ClusterQuery) Where ¶
func (cq *ClusterQuery) Where(ps ...predicate.Cluster) *ClusterQuery
Where adds a new predicate for the ClusterQuery builder.
type ClusterSelect ¶
type ClusterSelect struct { *ClusterQuery // contains filtered or unexported fields }
ClusterSelect is the builder for selecting fields of Cluster entities.
func (*ClusterSelect) Aggregate ¶
func (cs *ClusterSelect) Aggregate(fns ...AggregateFunc) *ClusterSelect
Aggregate adds the given aggregation functions to the selector query.
func (*ClusterSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ClusterSelect) Scan ¶
func (cs *ClusterSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ClusterSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ClusterUpdate ¶
type ClusterUpdate struct {
// contains filtered or unexported fields
}
ClusterUpdate is the builder for updating Cluster entities.
func (*ClusterUpdate) AddMachineType ¶
func (cu *ClusterUpdate) AddMachineType(i int32) *ClusterUpdate
AddMachineType adds i to the "machine_type" field.
func (*ClusterUpdate) AddNumNodes ¶
func (cu *ClusterUpdate) AddNumNodes(i int32) *ClusterUpdate
AddNumNodes adds i to the "num_nodes" field.
func (*ClusterUpdate) Exec ¶
func (cu *ClusterUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ClusterUpdate) ExecX ¶
func (cu *ClusterUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ClusterUpdate) Mutation ¶
func (cu *ClusterUpdate) Mutation() *ClusterMutation
Mutation returns the ClusterMutation object of the builder.
func (*ClusterUpdate) Save ¶
func (cu *ClusterUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ClusterUpdate) SaveX ¶
func (cu *ClusterUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ClusterUpdate) SetDisplayName ¶
func (cu *ClusterUpdate) SetDisplayName(s string) *ClusterUpdate
SetDisplayName sets the "display_name" field.
func (*ClusterUpdate) SetMachineType ¶
func (cu *ClusterUpdate) SetMachineType(i int32) *ClusterUpdate
SetMachineType sets the "machine_type" field.
func (*ClusterUpdate) SetName ¶
func (cu *ClusterUpdate) SetName(s string) *ClusterUpdate
SetName sets the "name" field.
func (*ClusterUpdate) SetNumNodes ¶
func (cu *ClusterUpdate) SetNumNodes(i int32) *ClusterUpdate
SetNumNodes sets the "num_nodes" field.
func (*ClusterUpdate) Where ¶
func (cu *ClusterUpdate) Where(ps ...predicate.Cluster) *ClusterUpdate
Where appends a list predicates to the ClusterUpdate builder.
type ClusterUpdateOne ¶
type ClusterUpdateOne struct {
// contains filtered or unexported fields
}
ClusterUpdateOne is the builder for updating a single Cluster entity.
func (*ClusterUpdateOne) AddMachineType ¶
func (cuo *ClusterUpdateOne) AddMachineType(i int32) *ClusterUpdateOne
AddMachineType adds i to the "machine_type" field.
func (*ClusterUpdateOne) AddNumNodes ¶
func (cuo *ClusterUpdateOne) AddNumNodes(i int32) *ClusterUpdateOne
AddNumNodes adds i to the "num_nodes" field.
func (*ClusterUpdateOne) Exec ¶
func (cuo *ClusterUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ClusterUpdateOne) ExecX ¶
func (cuo *ClusterUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ClusterUpdateOne) Mutation ¶
func (cuo *ClusterUpdateOne) Mutation() *ClusterMutation
Mutation returns the ClusterMutation object of the builder.
func (*ClusterUpdateOne) Save ¶
func (cuo *ClusterUpdateOne) Save(ctx context.Context) (*Cluster, error)
Save executes the query and returns the updated Cluster entity.
func (*ClusterUpdateOne) SaveX ¶
func (cuo *ClusterUpdateOne) SaveX(ctx context.Context) *Cluster
SaveX is like Save, but panics if an error occurs.
func (*ClusterUpdateOne) Select ¶
func (cuo *ClusterUpdateOne) Select(field string, fields ...string) *ClusterUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ClusterUpdateOne) SetDisplayName ¶
func (cuo *ClusterUpdateOne) SetDisplayName(s string) *ClusterUpdateOne
SetDisplayName sets the "display_name" field.
func (*ClusterUpdateOne) SetMachineType ¶
func (cuo *ClusterUpdateOne) SetMachineType(i int32) *ClusterUpdateOne
SetMachineType sets the "machine_type" field.
func (*ClusterUpdateOne) SetName ¶
func (cuo *ClusterUpdateOne) SetName(s string) *ClusterUpdateOne
SetName sets the "name" field.
func (*ClusterUpdateOne) SetNumNodes ¶
func (cuo *ClusterUpdateOne) SetNumNodes(i int32) *ClusterUpdateOne
SetNumNodes sets the "num_nodes" field.
func (*ClusterUpdateOne) Where ¶
func (cuo *ClusterUpdateOne) Where(ps ...predicate.Cluster) *ClusterUpdateOne
Where appends a list predicates to the ClusterUpdate builder.
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 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 { // Cluster is the client for interacting with the Cluster builders. Cluster *ClusterClient // 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.