Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) 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 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 System
- type SystemClient
- func (c *SystemClient) Create() *SystemCreate
- func (c *SystemClient) CreateBulk(builders ...*SystemCreate) *SystemCreateBulk
- func (c *SystemClient) Delete() *SystemDelete
- func (c *SystemClient) DeleteOne(s *System) *SystemDeleteOne
- func (c *SystemClient) DeleteOneID(id int) *SystemDeleteOne
- func (c *SystemClient) Get(ctx context.Context, id int) (*System, error)
- func (c *SystemClient) GetX(ctx context.Context, id int) *System
- func (c *SystemClient) Hooks() []Hook
- func (c *SystemClient) Intercept(interceptors ...Interceptor)
- func (c *SystemClient) Interceptors() []Interceptor
- func (c *SystemClient) MapCreateBulk(slice any, setFunc func(*SystemCreate, int)) *SystemCreateBulk
- func (c *SystemClient) Query() *SystemQuery
- func (c *SystemClient) Update() *SystemUpdate
- func (c *SystemClient) UpdateOne(s *System) *SystemUpdateOne
- func (c *SystemClient) UpdateOneID(id int) *SystemUpdateOne
- func (c *SystemClient) Use(hooks ...Hook)
- type SystemCreate
- func (sc *SystemCreate) Exec(ctx context.Context) error
- func (sc *SystemCreate) ExecX(ctx context.Context)
- func (sc *SystemCreate) Mutation() *SystemMutation
- func (sc *SystemCreate) Save(ctx context.Context) (*System, error)
- func (sc *SystemCreate) SaveX(ctx context.Context) *System
- func (sc *SystemCreate) SetApproved(b bool) *SystemCreate
- func (sc *SystemCreate) SetLastLogin(i int64) *SystemCreate
- func (sc *SystemCreate) SetPublicKey(b []byte) *SystemCreate
- func (sc *SystemCreate) SetSystemID(u uuid.UUID) *SystemCreate
- type SystemCreateBulk
- type SystemDelete
- type SystemDeleteOne
- type SystemGroupBy
- func (sgb *SystemGroupBy) Aggregate(fns ...AggregateFunc) *SystemGroupBy
- func (s *SystemGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *SystemGroupBy) BoolX(ctx context.Context) bool
- func (s *SystemGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *SystemGroupBy) BoolsX(ctx context.Context) []bool
- func (s *SystemGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *SystemGroupBy) Float64X(ctx context.Context) float64
- func (s *SystemGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *SystemGroupBy) Float64sX(ctx context.Context) []float64
- func (s *SystemGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *SystemGroupBy) IntX(ctx context.Context) int
- func (s *SystemGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *SystemGroupBy) IntsX(ctx context.Context) []int
- func (sgb *SystemGroupBy) Scan(ctx context.Context, v any) error
- func (s *SystemGroupBy) ScanX(ctx context.Context, v any)
- func (s *SystemGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *SystemGroupBy) StringX(ctx context.Context) string
- func (s *SystemGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *SystemGroupBy) StringsX(ctx context.Context) []string
- type SystemMutation
- func (m *SystemMutation) AddField(name string, value ent.Value) error
- func (m *SystemMutation) AddLastLogin(i int64)
- func (m *SystemMutation) AddedEdges() []string
- func (m *SystemMutation) AddedField(name string) (ent.Value, bool)
- func (m *SystemMutation) AddedFields() []string
- func (m *SystemMutation) AddedIDs(name string) []ent.Value
- func (m *SystemMutation) AddedLastLogin() (r int64, exists bool)
- func (m *SystemMutation) Approved() (r bool, exists bool)
- func (m *SystemMutation) ClearEdge(name string) error
- func (m *SystemMutation) ClearField(name string) error
- func (m *SystemMutation) ClearedEdges() []string
- func (m *SystemMutation) ClearedFields() []string
- func (m SystemMutation) Client() *Client
- func (m *SystemMutation) EdgeCleared(name string) bool
- func (m *SystemMutation) Field(name string) (ent.Value, bool)
- func (m *SystemMutation) FieldCleared(name string) bool
- func (m *SystemMutation) Fields() []string
- func (m *SystemMutation) ID() (id int, exists bool)
- func (m *SystemMutation) IDs(ctx context.Context) ([]int, error)
- func (m *SystemMutation) LastLogin() (r int64, exists bool)
- func (m *SystemMutation) OldApproved(ctx context.Context) (v bool, err error)
- func (m *SystemMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *SystemMutation) OldLastLogin(ctx context.Context) (v int64, err error)
- func (m *SystemMutation) OldPublicKey(ctx context.Context) (v []byte, err error)
- func (m *SystemMutation) OldSystemID(ctx context.Context) (v uuid.UUID, err error)
- func (m *SystemMutation) Op() Op
- func (m *SystemMutation) PublicKey() (r []byte, exists bool)
- func (m *SystemMutation) RemovedEdges() []string
- func (m *SystemMutation) RemovedIDs(name string) []ent.Value
- func (m *SystemMutation) ResetApproved()
- func (m *SystemMutation) ResetEdge(name string) error
- func (m *SystemMutation) ResetField(name string) error
- func (m *SystemMutation) ResetLastLogin()
- func (m *SystemMutation) ResetPublicKey()
- func (m *SystemMutation) ResetSystemID()
- func (m *SystemMutation) SetApproved(b bool)
- func (m *SystemMutation) SetField(name string, value ent.Value) error
- func (m *SystemMutation) SetLastLogin(i int64)
- func (m *SystemMutation) SetOp(op Op)
- func (m *SystemMutation) SetPublicKey(b []byte)
- func (m *SystemMutation) SetSystemID(u uuid.UUID)
- func (m *SystemMutation) SystemID() (r uuid.UUID, exists bool)
- func (m SystemMutation) Tx() (*Tx, error)
- func (m *SystemMutation) Type() string
- func (m *SystemMutation) Where(ps ...predicate.System)
- func (m *SystemMutation) WhereP(ps ...func(*sql.Selector))
- type SystemQuery
- func (sq *SystemQuery) Aggregate(fns ...AggregateFunc) *SystemSelect
- func (sq *SystemQuery) All(ctx context.Context) ([]*System, error)
- func (sq *SystemQuery) AllX(ctx context.Context) []*System
- func (sq *SystemQuery) Clone() *SystemQuery
- func (sq *SystemQuery) Count(ctx context.Context) (int, error)
- func (sq *SystemQuery) CountX(ctx context.Context) int
- func (sq *SystemQuery) Exist(ctx context.Context) (bool, error)
- func (sq *SystemQuery) ExistX(ctx context.Context) bool
- func (sq *SystemQuery) First(ctx context.Context) (*System, error)
- func (sq *SystemQuery) FirstID(ctx context.Context) (id int, err error)
- func (sq *SystemQuery) FirstIDX(ctx context.Context) int
- func (sq *SystemQuery) FirstX(ctx context.Context) *System
- func (sq *SystemQuery) GroupBy(field string, fields ...string) *SystemGroupBy
- func (sq *SystemQuery) IDs(ctx context.Context) (ids []int, err error)
- func (sq *SystemQuery) IDsX(ctx context.Context) []int
- func (sq *SystemQuery) Limit(limit int) *SystemQuery
- func (sq *SystemQuery) Offset(offset int) *SystemQuery
- func (sq *SystemQuery) Only(ctx context.Context) (*System, error)
- func (sq *SystemQuery) OnlyID(ctx context.Context) (id int, err error)
- func (sq *SystemQuery) OnlyIDX(ctx context.Context) int
- func (sq *SystemQuery) OnlyX(ctx context.Context) *System
- func (sq *SystemQuery) Order(o ...system.OrderOption) *SystemQuery
- func (sq *SystemQuery) Select(fields ...string) *SystemSelect
- func (sq *SystemQuery) Unique(unique bool) *SystemQuery
- func (sq *SystemQuery) Where(ps ...predicate.System) *SystemQuery
- type SystemSelect
- func (ss *SystemSelect) Aggregate(fns ...AggregateFunc) *SystemSelect
- func (s *SystemSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *SystemSelect) BoolX(ctx context.Context) bool
- func (s *SystemSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *SystemSelect) BoolsX(ctx context.Context) []bool
- func (s *SystemSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *SystemSelect) Float64X(ctx context.Context) float64
- func (s *SystemSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *SystemSelect) Float64sX(ctx context.Context) []float64
- func (s *SystemSelect) Int(ctx context.Context) (_ int, err error)
- func (s *SystemSelect) IntX(ctx context.Context) int
- func (s *SystemSelect) Ints(ctx context.Context) ([]int, error)
- func (s *SystemSelect) IntsX(ctx context.Context) []int
- func (ss *SystemSelect) Scan(ctx context.Context, v any) error
- func (s *SystemSelect) ScanX(ctx context.Context, v any)
- func (s *SystemSelect) String(ctx context.Context) (_ string, err error)
- func (s *SystemSelect) StringX(ctx context.Context) string
- func (s *SystemSelect) Strings(ctx context.Context) ([]string, error)
- func (s *SystemSelect) StringsX(ctx context.Context) []string
- type SystemUpdate
- func (su *SystemUpdate) AddLastLogin(i int64) *SystemUpdate
- func (su *SystemUpdate) Exec(ctx context.Context) error
- func (su *SystemUpdate) ExecX(ctx context.Context)
- func (su *SystemUpdate) Mutation() *SystemMutation
- func (su *SystemUpdate) Save(ctx context.Context) (int, error)
- func (su *SystemUpdate) SaveX(ctx context.Context) int
- func (su *SystemUpdate) SetApproved(b bool) *SystemUpdate
- func (su *SystemUpdate) SetLastLogin(i int64) *SystemUpdate
- func (su *SystemUpdate) SetPublicKey(b []byte) *SystemUpdate
- func (su *SystemUpdate) SetSystemID(u uuid.UUID) *SystemUpdate
- func (su *SystemUpdate) Where(ps ...predicate.System) *SystemUpdate
- type SystemUpdateOne
- func (suo *SystemUpdateOne) AddLastLogin(i int64) *SystemUpdateOne
- func (suo *SystemUpdateOne) Exec(ctx context.Context) error
- func (suo *SystemUpdateOne) ExecX(ctx context.Context)
- func (suo *SystemUpdateOne) Mutation() *SystemMutation
- func (suo *SystemUpdateOne) Save(ctx context.Context) (*System, error)
- func (suo *SystemUpdateOne) SaveX(ctx context.Context) *System
- func (suo *SystemUpdateOne) Select(field string, fields ...string) *SystemUpdateOne
- func (suo *SystemUpdateOne) SetApproved(b bool) *SystemUpdateOne
- func (suo *SystemUpdateOne) SetLastLogin(i int64) *SystemUpdateOne
- func (suo *SystemUpdateOne) SetPublicKey(b []byte) *SystemUpdateOne
- func (suo *SystemUpdateOne) SetSystemID(u uuid.UUID) *SystemUpdateOne
- func (suo *SystemUpdateOne) Where(ps ...predicate.System) *SystemUpdateOne
- type Systems
- 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. TypeSystem = "System" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // System is the client for interacting with the System builders. System *SystemClient // 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(). System. 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 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 System ¶
type System struct { // ID of the ent. ID int `json:"id,omitempty"` // SystemID holds the value of the "system_id" field. SystemID uuid.UUID `json:"system_id,omitempty"` // PublicKey holds the value of the "public_key" field. PublicKey []byte `json:"public_key,omitempty"` // Approved holds the value of the "approved" field. Approved bool `json:"approved,omitempty"` // LastLogin holds the value of the "last_login" field. LastLogin int64 `json:"last_login,omitempty"` // contains filtered or unexported fields }
System is the model entity for the System schema.
func (*System) Unwrap ¶
Unwrap unwraps the System 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 (*System) Update ¶
func (s *System) Update() *SystemUpdateOne
Update returns a builder for updating this System. Note that you need to call System.Unwrap() before calling this method if this System was returned from a transaction, and the transaction was committed or rolled back.
type SystemClient ¶
type SystemClient struct {
// contains filtered or unexported fields
}
SystemClient is a client for the System schema.
func NewSystemClient ¶
func NewSystemClient(c config) *SystemClient
NewSystemClient returns a client for the System from the given config.
func (*SystemClient) Create ¶
func (c *SystemClient) Create() *SystemCreate
Create returns a builder for creating a System entity.
func (*SystemClient) CreateBulk ¶
func (c *SystemClient) CreateBulk(builders ...*SystemCreate) *SystemCreateBulk
CreateBulk returns a builder for creating a bulk of System entities.
func (*SystemClient) Delete ¶
func (c *SystemClient) Delete() *SystemDelete
Delete returns a delete builder for System.
func (*SystemClient) DeleteOne ¶
func (c *SystemClient) DeleteOne(s *System) *SystemDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*SystemClient) DeleteOneID ¶
func (c *SystemClient) DeleteOneID(id int) *SystemDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*SystemClient) GetX ¶
func (c *SystemClient) GetX(ctx context.Context, id int) *System
GetX is like Get, but panics if an error occurs.
func (*SystemClient) Intercept ¶
func (c *SystemClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `system.Intercept(f(g(h())))`.
func (*SystemClient) Interceptors ¶
func (c *SystemClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*SystemClient) MapCreateBulk ¶
func (c *SystemClient) MapCreateBulk(slice any, setFunc func(*SystemCreate, int)) *SystemCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*SystemClient) Query ¶
func (c *SystemClient) Query() *SystemQuery
Query returns a query builder for System.
func (*SystemClient) Update ¶
func (c *SystemClient) Update() *SystemUpdate
Update returns an update builder for System.
func (*SystemClient) UpdateOne ¶
func (c *SystemClient) UpdateOne(s *System) *SystemUpdateOne
UpdateOne returns an update builder for the given entity.
func (*SystemClient) UpdateOneID ¶
func (c *SystemClient) UpdateOneID(id int) *SystemUpdateOne
UpdateOneID returns an update builder for the given id.
func (*SystemClient) Use ¶
func (c *SystemClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `system.Hooks(f(g(h())))`.
type SystemCreate ¶
type SystemCreate struct {
// contains filtered or unexported fields
}
SystemCreate is the builder for creating a System entity.
func (*SystemCreate) Exec ¶
func (sc *SystemCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*SystemCreate) ExecX ¶
func (sc *SystemCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SystemCreate) Mutation ¶
func (sc *SystemCreate) Mutation() *SystemMutation
Mutation returns the SystemMutation object of the builder.
func (*SystemCreate) Save ¶
func (sc *SystemCreate) Save(ctx context.Context) (*System, error)
Save creates the System in the database.
func (*SystemCreate) SaveX ¶
func (sc *SystemCreate) SaveX(ctx context.Context) *System
SaveX calls Save and panics if Save returns an error.
func (*SystemCreate) SetApproved ¶
func (sc *SystemCreate) SetApproved(b bool) *SystemCreate
SetApproved sets the "approved" field.
func (*SystemCreate) SetLastLogin ¶
func (sc *SystemCreate) SetLastLogin(i int64) *SystemCreate
SetLastLogin sets the "last_login" field.
func (*SystemCreate) SetPublicKey ¶
func (sc *SystemCreate) SetPublicKey(b []byte) *SystemCreate
SetPublicKey sets the "public_key" field.
func (*SystemCreate) SetSystemID ¶
func (sc *SystemCreate) SetSystemID(u uuid.UUID) *SystemCreate
SetSystemID sets the "system_id" field.
type SystemCreateBulk ¶
type SystemCreateBulk struct {
// contains filtered or unexported fields
}
SystemCreateBulk is the builder for creating many System entities in bulk.
func (*SystemCreateBulk) Exec ¶
func (scb *SystemCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*SystemCreateBulk) ExecX ¶
func (scb *SystemCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type SystemDelete ¶
type SystemDelete struct {
// contains filtered or unexported fields
}
SystemDelete is the builder for deleting a System entity.
func (*SystemDelete) Exec ¶
func (sd *SystemDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*SystemDelete) ExecX ¶
func (sd *SystemDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*SystemDelete) Where ¶
func (sd *SystemDelete) Where(ps ...predicate.System) *SystemDelete
Where appends a list predicates to the SystemDelete builder.
type SystemDeleteOne ¶
type SystemDeleteOne struct {
// contains filtered or unexported fields
}
SystemDeleteOne is the builder for deleting a single System entity.
func (*SystemDeleteOne) Exec ¶
func (sdo *SystemDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*SystemDeleteOne) ExecX ¶
func (sdo *SystemDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SystemDeleteOne) Where ¶
func (sdo *SystemDeleteOne) Where(ps ...predicate.System) *SystemDeleteOne
Where appends a list predicates to the SystemDelete builder.
type SystemGroupBy ¶
type SystemGroupBy struct {
// contains filtered or unexported fields
}
SystemGroupBy is the group-by builder for System entities.
func (*SystemGroupBy) Aggregate ¶
func (sgb *SystemGroupBy) Aggregate(fns ...AggregateFunc) *SystemGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*SystemGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*SystemGroupBy) Scan ¶
func (sgb *SystemGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*SystemGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type SystemMutation ¶
type SystemMutation struct {
// contains filtered or unexported fields
}
SystemMutation represents an operation that mutates the System nodes in the graph.
func (*SystemMutation) AddField ¶
func (m *SystemMutation) 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 (*SystemMutation) AddLastLogin ¶
func (m *SystemMutation) AddLastLogin(i int64)
AddLastLogin adds i to the "last_login" field.
func (*SystemMutation) AddedEdges ¶
func (m *SystemMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*SystemMutation) AddedField ¶
func (m *SystemMutation) 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 (*SystemMutation) AddedFields ¶
func (m *SystemMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*SystemMutation) AddedIDs ¶
func (m *SystemMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*SystemMutation) AddedLastLogin ¶
func (m *SystemMutation) AddedLastLogin() (r int64, exists bool)
AddedLastLogin returns the value that was added to the "last_login" field in this mutation.
func (*SystemMutation) Approved ¶
func (m *SystemMutation) Approved() (r bool, exists bool)
Approved returns the value of the "approved" field in the mutation.
func (*SystemMutation) ClearEdge ¶
func (m *SystemMutation) 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 (*SystemMutation) ClearField ¶
func (m *SystemMutation) 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 (*SystemMutation) ClearedEdges ¶
func (m *SystemMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*SystemMutation) ClearedFields ¶
func (m *SystemMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (SystemMutation) Client ¶
func (m SystemMutation) 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 (*SystemMutation) EdgeCleared ¶
func (m *SystemMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*SystemMutation) Field ¶
func (m *SystemMutation) 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 (*SystemMutation) FieldCleared ¶
func (m *SystemMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*SystemMutation) Fields ¶
func (m *SystemMutation) 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 (*SystemMutation) ID ¶
func (m *SystemMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*SystemMutation) IDs ¶
func (m *SystemMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*SystemMutation) LastLogin ¶
func (m *SystemMutation) LastLogin() (r int64, exists bool)
LastLogin returns the value of the "last_login" field in the mutation.
func (*SystemMutation) OldApproved ¶
func (m *SystemMutation) OldApproved(ctx context.Context) (v bool, err error)
OldApproved returns the old "approved" field's value of the System entity. If the System 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 (*SystemMutation) 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 (*SystemMutation) OldLastLogin ¶
func (m *SystemMutation) OldLastLogin(ctx context.Context) (v int64, err error)
OldLastLogin returns the old "last_login" field's value of the System entity. If the System 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 (*SystemMutation) OldPublicKey ¶
func (m *SystemMutation) OldPublicKey(ctx context.Context) (v []byte, err error)
OldPublicKey returns the old "public_key" field's value of the System entity. If the System 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 (*SystemMutation) OldSystemID ¶
OldSystemID returns the old "system_id" field's value of the System entity. If the System 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 (*SystemMutation) PublicKey ¶
func (m *SystemMutation) PublicKey() (r []byte, exists bool)
PublicKey returns the value of the "public_key" field in the mutation.
func (*SystemMutation) RemovedEdges ¶
func (m *SystemMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*SystemMutation) RemovedIDs ¶
func (m *SystemMutation) 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 (*SystemMutation) ResetApproved ¶
func (m *SystemMutation) ResetApproved()
ResetApproved resets all changes to the "approved" field.
func (*SystemMutation) ResetEdge ¶
func (m *SystemMutation) 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 (*SystemMutation) ResetField ¶
func (m *SystemMutation) 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 (*SystemMutation) ResetLastLogin ¶
func (m *SystemMutation) ResetLastLogin()
ResetLastLogin resets all changes to the "last_login" field.
func (*SystemMutation) ResetPublicKey ¶
func (m *SystemMutation) ResetPublicKey()
ResetPublicKey resets all changes to the "public_key" field.
func (*SystemMutation) ResetSystemID ¶
func (m *SystemMutation) ResetSystemID()
ResetSystemID resets all changes to the "system_id" field.
func (*SystemMutation) SetApproved ¶
func (m *SystemMutation) SetApproved(b bool)
SetApproved sets the "approved" field.
func (*SystemMutation) SetField ¶
func (m *SystemMutation) 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 (*SystemMutation) SetLastLogin ¶
func (m *SystemMutation) SetLastLogin(i int64)
SetLastLogin sets the "last_login" field.
func (*SystemMutation) SetOp ¶
func (m *SystemMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*SystemMutation) SetPublicKey ¶
func (m *SystemMutation) SetPublicKey(b []byte)
SetPublicKey sets the "public_key" field.
func (*SystemMutation) SetSystemID ¶
func (m *SystemMutation) SetSystemID(u uuid.UUID)
SetSystemID sets the "system_id" field.
func (*SystemMutation) SystemID ¶
func (m *SystemMutation) SystemID() (r uuid.UUID, exists bool)
SystemID returns the value of the "system_id" field in the mutation.
func (SystemMutation) Tx ¶
func (m SystemMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*SystemMutation) Type ¶
func (m *SystemMutation) Type() string
Type returns the node type of this mutation (System).
func (*SystemMutation) Where ¶
func (m *SystemMutation) Where(ps ...predicate.System)
Where appends a list predicates to the SystemMutation builder.
func (*SystemMutation) WhereP ¶
func (m *SystemMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the SystemMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type SystemQuery ¶
type SystemQuery struct {
// contains filtered or unexported fields
}
SystemQuery is the builder for querying System entities.
func (*SystemQuery) Aggregate ¶
func (sq *SystemQuery) Aggregate(fns ...AggregateFunc) *SystemSelect
Aggregate returns a SystemSelect configured with the given aggregations.
func (*SystemQuery) All ¶
func (sq *SystemQuery) All(ctx context.Context) ([]*System, error)
All executes the query and returns a list of Systems.
func (*SystemQuery) AllX ¶
func (sq *SystemQuery) AllX(ctx context.Context) []*System
AllX is like All, but panics if an error occurs.
func (*SystemQuery) Clone ¶
func (sq *SystemQuery) Clone() *SystemQuery
Clone returns a duplicate of the SystemQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*SystemQuery) Count ¶
func (sq *SystemQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*SystemQuery) CountX ¶
func (sq *SystemQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*SystemQuery) Exist ¶
func (sq *SystemQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*SystemQuery) ExistX ¶
func (sq *SystemQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*SystemQuery) First ¶
func (sq *SystemQuery) First(ctx context.Context) (*System, error)
First returns the first System entity from the query. Returns a *NotFoundError when no System was found.
func (*SystemQuery) FirstID ¶
func (sq *SystemQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first System ID from the query. Returns a *NotFoundError when no System ID was found.
func (*SystemQuery) FirstIDX ¶
func (sq *SystemQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*SystemQuery) FirstX ¶
func (sq *SystemQuery) FirstX(ctx context.Context) *System
FirstX is like First, but panics if an error occurs.
func (*SystemQuery) GroupBy ¶
func (sq *SystemQuery) GroupBy(field string, fields ...string) *SystemGroupBy
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 { SystemID uuid.UUID `json:"system_id,omitempty"` Count int `json:"count,omitempty"` } client.System.Query(). GroupBy(system.FieldSystemID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*SystemQuery) IDs ¶
func (sq *SystemQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of System IDs.
func (*SystemQuery) IDsX ¶
func (sq *SystemQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*SystemQuery) Limit ¶
func (sq *SystemQuery) Limit(limit int) *SystemQuery
Limit the number of records to be returned by this query.
func (*SystemQuery) Offset ¶
func (sq *SystemQuery) Offset(offset int) *SystemQuery
Offset to start from.
func (*SystemQuery) Only ¶
func (sq *SystemQuery) Only(ctx context.Context) (*System, error)
Only returns a single System entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one System entity is found. Returns a *NotFoundError when no System entities are found.
func (*SystemQuery) OnlyID ¶
func (sq *SystemQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only System ID in the query. Returns a *NotSingularError when more than one System ID is found. Returns a *NotFoundError when no entities are found.
func (*SystemQuery) OnlyIDX ¶
func (sq *SystemQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*SystemQuery) OnlyX ¶
func (sq *SystemQuery) OnlyX(ctx context.Context) *System
OnlyX is like Only, but panics if an error occurs.
func (*SystemQuery) Order ¶
func (sq *SystemQuery) Order(o ...system.OrderOption) *SystemQuery
Order specifies how the records should be ordered.
func (*SystemQuery) Select ¶
func (sq *SystemQuery) Select(fields ...string) *SystemSelect
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 { SystemID uuid.UUID `json:"system_id,omitempty"` } client.System.Query(). Select(system.FieldSystemID). Scan(ctx, &v)
func (*SystemQuery) Unique ¶
func (sq *SystemQuery) Unique(unique bool) *SystemQuery
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 (*SystemQuery) Where ¶
func (sq *SystemQuery) Where(ps ...predicate.System) *SystemQuery
Where adds a new predicate for the SystemQuery builder.
type SystemSelect ¶
type SystemSelect struct { *SystemQuery // contains filtered or unexported fields }
SystemSelect is the builder for selecting fields of System entities.
func (*SystemSelect) Aggregate ¶
func (ss *SystemSelect) Aggregate(fns ...AggregateFunc) *SystemSelect
Aggregate adds the given aggregation functions to the selector query.
func (*SystemSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*SystemSelect) Scan ¶
func (ss *SystemSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*SystemSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type SystemUpdate ¶
type SystemUpdate struct {
// contains filtered or unexported fields
}
SystemUpdate is the builder for updating System entities.
func (*SystemUpdate) AddLastLogin ¶
func (su *SystemUpdate) AddLastLogin(i int64) *SystemUpdate
AddLastLogin adds i to the "last_login" field.
func (*SystemUpdate) Exec ¶
func (su *SystemUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*SystemUpdate) ExecX ¶
func (su *SystemUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SystemUpdate) Mutation ¶
func (su *SystemUpdate) Mutation() *SystemMutation
Mutation returns the SystemMutation object of the builder.
func (*SystemUpdate) Save ¶
func (su *SystemUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*SystemUpdate) SaveX ¶
func (su *SystemUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*SystemUpdate) SetApproved ¶
func (su *SystemUpdate) SetApproved(b bool) *SystemUpdate
SetApproved sets the "approved" field.
func (*SystemUpdate) SetLastLogin ¶
func (su *SystemUpdate) SetLastLogin(i int64) *SystemUpdate
SetLastLogin sets the "last_login" field.
func (*SystemUpdate) SetPublicKey ¶
func (su *SystemUpdate) SetPublicKey(b []byte) *SystemUpdate
SetPublicKey sets the "public_key" field.
func (*SystemUpdate) SetSystemID ¶
func (su *SystemUpdate) SetSystemID(u uuid.UUID) *SystemUpdate
SetSystemID sets the "system_id" field.
func (*SystemUpdate) Where ¶
func (su *SystemUpdate) Where(ps ...predicate.System) *SystemUpdate
Where appends a list predicates to the SystemUpdate builder.
type SystemUpdateOne ¶
type SystemUpdateOne struct {
// contains filtered or unexported fields
}
SystemUpdateOne is the builder for updating a single System entity.
func (*SystemUpdateOne) AddLastLogin ¶
func (suo *SystemUpdateOne) AddLastLogin(i int64) *SystemUpdateOne
AddLastLogin adds i to the "last_login" field.
func (*SystemUpdateOne) Exec ¶
func (suo *SystemUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*SystemUpdateOne) ExecX ¶
func (suo *SystemUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SystemUpdateOne) Mutation ¶
func (suo *SystemUpdateOne) Mutation() *SystemMutation
Mutation returns the SystemMutation object of the builder.
func (*SystemUpdateOne) Save ¶
func (suo *SystemUpdateOne) Save(ctx context.Context) (*System, error)
Save executes the query and returns the updated System entity.
func (*SystemUpdateOne) SaveX ¶
func (suo *SystemUpdateOne) SaveX(ctx context.Context) *System
SaveX is like Save, but panics if an error occurs.
func (*SystemUpdateOne) Select ¶
func (suo *SystemUpdateOne) Select(field string, fields ...string) *SystemUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*SystemUpdateOne) SetApproved ¶
func (suo *SystemUpdateOne) SetApproved(b bool) *SystemUpdateOne
SetApproved sets the "approved" field.
func (*SystemUpdateOne) SetLastLogin ¶
func (suo *SystemUpdateOne) SetLastLogin(i int64) *SystemUpdateOne
SetLastLogin sets the "last_login" field.
func (*SystemUpdateOne) SetPublicKey ¶
func (suo *SystemUpdateOne) SetPublicKey(b []byte) *SystemUpdateOne
SetPublicKey sets the "public_key" field.
func (*SystemUpdateOne) SetSystemID ¶
func (suo *SystemUpdateOne) SetSystemID(u uuid.UUID) *SystemUpdateOne
SetSystemID sets the "system_id" field.
func (*SystemUpdateOne) Where ¶
func (suo *SystemUpdateOne) Where(ps ...predicate.System) *SystemUpdateOne
Where appends a list predicates to the SystemUpdate builder.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // System is the client for interacting with the System builders. System *SystemClient // 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.