Documentation ¶
Index ¶
- Constants
- 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
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Histories
- type History
- type HistoryClient
- func (c *HistoryClient) Create() *HistoryCreate
- func (c *HistoryClient) CreateBulk(builders ...*HistoryCreate) *HistoryCreateBulk
- func (c *HistoryClient) Delete() *HistoryDelete
- func (c *HistoryClient) DeleteOne(h *History) *HistoryDeleteOne
- func (c *HistoryClient) DeleteOneID(id int64) *HistoryDeleteOne
- func (c *HistoryClient) Get(ctx context.Context, id int64) (*History, error)
- func (c *HistoryClient) GetX(ctx context.Context, id int64) *History
- func (c *HistoryClient) Hooks() []Hook
- func (c *HistoryClient) Query() *HistoryQuery
- func (c *HistoryClient) Update() *HistoryUpdate
- func (c *HistoryClient) UpdateOne(h *History) *HistoryUpdateOne
- func (c *HistoryClient) UpdateOneID(id int64) *HistoryUpdateOne
- func (c *HistoryClient) Use(hooks ...Hook)
- type HistoryCreate
- func (hc *HistoryCreate) Exec(ctx context.Context) error
- func (hc *HistoryCreate) ExecX(ctx context.Context)
- func (hc *HistoryCreate) Mutation() *HistoryMutation
- func (hc *HistoryCreate) Save(ctx context.Context) (*History, error)
- func (hc *HistoryCreate) SaveX(ctx context.Context) *History
- func (hc *HistoryCreate) SetCreatedAt(t time.Time) *HistoryCreate
- func (hc *HistoryCreate) SetID(i int64) *HistoryCreate
- func (hc *HistoryCreate) SetNillableCreatedAt(t *time.Time) *HistoryCreate
- func (hc *HistoryCreate) SetNillableUpdatedAt(t *time.Time) *HistoryCreate
- func (hc *HistoryCreate) SetObjID(i int64) *HistoryCreate
- func (hc *HistoryCreate) SetObjType(s string) *HistoryCreate
- func (hc *HistoryCreate) SetUpdatedAt(t time.Time) *HistoryCreate
- func (hc *HistoryCreate) SetUserID(i int64) *HistoryCreate
- type HistoryCreateBulk
- type HistoryDelete
- type HistoryDeleteOne
- type HistoryGroupBy
- func (hgb *HistoryGroupBy) Aggregate(fns ...AggregateFunc) *HistoryGroupBy
- func (hgb *HistoryGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (hgb *HistoryGroupBy) BoolX(ctx context.Context) bool
- func (hgb *HistoryGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (hgb *HistoryGroupBy) BoolsX(ctx context.Context) []bool
- func (hgb *HistoryGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (hgb *HistoryGroupBy) Float64X(ctx context.Context) float64
- func (hgb *HistoryGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (hgb *HistoryGroupBy) Float64sX(ctx context.Context) []float64
- func (hgb *HistoryGroupBy) Int(ctx context.Context) (_ int, err error)
- func (hgb *HistoryGroupBy) IntX(ctx context.Context) int
- func (hgb *HistoryGroupBy) Ints(ctx context.Context) ([]int, error)
- func (hgb *HistoryGroupBy) IntsX(ctx context.Context) []int
- func (hgb *HistoryGroupBy) Scan(ctx context.Context, v interface{}) error
- func (hgb *HistoryGroupBy) ScanX(ctx context.Context, v interface{})
- func (hgb *HistoryGroupBy) String(ctx context.Context) (_ string, err error)
- func (hgb *HistoryGroupBy) StringX(ctx context.Context) string
- func (hgb *HistoryGroupBy) Strings(ctx context.Context) ([]string, error)
- func (hgb *HistoryGroupBy) StringsX(ctx context.Context) []string
- type HistoryMutation
- func (m *HistoryMutation) AddField(name string, value ent.Value) error
- func (m *HistoryMutation) AddObjID(i int64)
- func (m *HistoryMutation) AddUserID(i int64)
- func (m *HistoryMutation) AddedEdges() []string
- func (m *HistoryMutation) AddedField(name string) (ent.Value, bool)
- func (m *HistoryMutation) AddedFields() []string
- func (m *HistoryMutation) AddedIDs(name string) []ent.Value
- func (m *HistoryMutation) AddedObjID() (r int64, exists bool)
- func (m *HistoryMutation) AddedUserID() (r int64, exists bool)
- func (m *HistoryMutation) ClearEdge(name string) error
- func (m *HistoryMutation) ClearField(name string) error
- func (m *HistoryMutation) ClearedEdges() []string
- func (m *HistoryMutation) ClearedFields() []string
- func (m HistoryMutation) Client() *Client
- func (m *HistoryMutation) CreatedAt() (r time.Time, exists bool)
- func (m *HistoryMutation) EdgeCleared(name string) bool
- func (m *HistoryMutation) Field(name string) (ent.Value, bool)
- func (m *HistoryMutation) FieldCleared(name string) bool
- func (m *HistoryMutation) Fields() []string
- func (m *HistoryMutation) ID() (id int64, exists bool)
- func (m *HistoryMutation) ObjID() (r int64, exists bool)
- func (m *HistoryMutation) ObjType() (r string, exists bool)
- func (m *HistoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *HistoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *HistoryMutation) OldObjID(ctx context.Context) (v int64, err error)
- func (m *HistoryMutation) OldObjType(ctx context.Context) (v string, err error)
- func (m *HistoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *HistoryMutation) OldUserID(ctx context.Context) (v int64, err error)
- func (m *HistoryMutation) Op() Op
- func (m *HistoryMutation) RemovedEdges() []string
- func (m *HistoryMutation) RemovedIDs(name string) []ent.Value
- func (m *HistoryMutation) ResetCreatedAt()
- func (m *HistoryMutation) ResetEdge(name string) error
- func (m *HistoryMutation) ResetField(name string) error
- func (m *HistoryMutation) ResetObjID()
- func (m *HistoryMutation) ResetObjType()
- func (m *HistoryMutation) ResetUpdatedAt()
- func (m *HistoryMutation) ResetUserID()
- func (m *HistoryMutation) SetCreatedAt(t time.Time)
- func (m *HistoryMutation) SetField(name string, value ent.Value) error
- func (m *HistoryMutation) SetID(id int64)
- func (m *HistoryMutation) SetObjID(i int64)
- func (m *HistoryMutation) SetObjType(s string)
- func (m *HistoryMutation) SetUpdatedAt(t time.Time)
- func (m *HistoryMutation) SetUserID(i int64)
- func (m HistoryMutation) Tx() (*Tx, error)
- func (m *HistoryMutation) Type() string
- func (m *HistoryMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *HistoryMutation) UserID() (r int64, exists bool)
- func (m *HistoryMutation) Where(ps ...predicate.History)
- type HistoryQuery
- func (hq *HistoryQuery) All(ctx context.Context) ([]*History, error)
- func (hq *HistoryQuery) AllX(ctx context.Context) []*History
- func (hq *HistoryQuery) Clone() *HistoryQuery
- func (hq *HistoryQuery) Count(ctx context.Context) (int, error)
- func (hq *HistoryQuery) CountX(ctx context.Context) int
- func (hq *HistoryQuery) Exist(ctx context.Context) (bool, error)
- func (hq *HistoryQuery) ExistX(ctx context.Context) bool
- func (hq *HistoryQuery) First(ctx context.Context) (*History, error)
- func (hq *HistoryQuery) FirstID(ctx context.Context) (id int64, err error)
- func (hq *HistoryQuery) FirstIDX(ctx context.Context) int64
- func (hq *HistoryQuery) FirstX(ctx context.Context) *History
- func (hq *HistoryQuery) GroupBy(field string, fields ...string) *HistoryGroupBy
- func (hq *HistoryQuery) IDs(ctx context.Context) ([]int64, error)
- func (hq *HistoryQuery) IDsX(ctx context.Context) []int64
- func (hq *HistoryQuery) Limit(limit int) *HistoryQuery
- func (hq *HistoryQuery) Offset(offset int) *HistoryQuery
- func (hq *HistoryQuery) Only(ctx context.Context) (*History, error)
- func (hq *HistoryQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (hq *HistoryQuery) OnlyIDX(ctx context.Context) int64
- func (hq *HistoryQuery) OnlyX(ctx context.Context) *History
- func (hq *HistoryQuery) Order(o ...OrderFunc) *HistoryQuery
- func (hq *HistoryQuery) Select(fields ...string) *HistorySelect
- func (hq *HistoryQuery) Unique(unique bool) *HistoryQuery
- func (hq *HistoryQuery) Where(ps ...predicate.History) *HistoryQuery
- type HistorySelect
- func (hs *HistorySelect) Bool(ctx context.Context) (_ bool, err error)
- func (hs *HistorySelect) BoolX(ctx context.Context) bool
- func (hs *HistorySelect) Bools(ctx context.Context) ([]bool, error)
- func (hs *HistorySelect) BoolsX(ctx context.Context) []bool
- func (hs *HistorySelect) Float64(ctx context.Context) (_ float64, err error)
- func (hs *HistorySelect) Float64X(ctx context.Context) float64
- func (hs *HistorySelect) Float64s(ctx context.Context) ([]float64, error)
- func (hs *HistorySelect) Float64sX(ctx context.Context) []float64
- func (hs *HistorySelect) Int(ctx context.Context) (_ int, err error)
- func (hs *HistorySelect) IntX(ctx context.Context) int
- func (hs *HistorySelect) Ints(ctx context.Context) ([]int, error)
- func (hs *HistorySelect) IntsX(ctx context.Context) []int
- func (hs *HistorySelect) Scan(ctx context.Context, v interface{}) error
- func (hs *HistorySelect) ScanX(ctx context.Context, v interface{})
- func (hs *HistorySelect) String(ctx context.Context) (_ string, err error)
- func (hs *HistorySelect) StringX(ctx context.Context) string
- func (hs *HistorySelect) Strings(ctx context.Context) ([]string, error)
- func (hs *HistorySelect) StringsX(ctx context.Context) []string
- type HistoryUpdate
- func (hu *HistoryUpdate) AddObjID(i int64) *HistoryUpdate
- func (hu *HistoryUpdate) AddUserID(i int64) *HistoryUpdate
- func (hu *HistoryUpdate) Exec(ctx context.Context) error
- func (hu *HistoryUpdate) ExecX(ctx context.Context)
- func (hu *HistoryUpdate) Mutation() *HistoryMutation
- func (hu *HistoryUpdate) Save(ctx context.Context) (int, error)
- func (hu *HistoryUpdate) SaveX(ctx context.Context) int
- func (hu *HistoryUpdate) SetCreatedAt(t time.Time) *HistoryUpdate
- func (hu *HistoryUpdate) SetNillableCreatedAt(t *time.Time) *HistoryUpdate
- func (hu *HistoryUpdate) SetNillableUpdatedAt(t *time.Time) *HistoryUpdate
- func (hu *HistoryUpdate) SetObjID(i int64) *HistoryUpdate
- func (hu *HistoryUpdate) SetObjType(s string) *HistoryUpdate
- func (hu *HistoryUpdate) SetUpdatedAt(t time.Time) *HistoryUpdate
- func (hu *HistoryUpdate) SetUserID(i int64) *HistoryUpdate
- func (hu *HistoryUpdate) Where(ps ...predicate.History) *HistoryUpdate
- type HistoryUpdateOne
- func (huo *HistoryUpdateOne) AddObjID(i int64) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) AddUserID(i int64) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) Exec(ctx context.Context) error
- func (huo *HistoryUpdateOne) ExecX(ctx context.Context)
- func (huo *HistoryUpdateOne) Mutation() *HistoryMutation
- func (huo *HistoryUpdateOne) Save(ctx context.Context) (*History, error)
- func (huo *HistoryUpdateOne) SaveX(ctx context.Context) *History
- func (huo *HistoryUpdateOne) Select(field string, fields ...string) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetCreatedAt(t time.Time) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetNillableCreatedAt(t *time.Time) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetNillableUpdatedAt(t *time.Time) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetObjID(i int64) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetObjType(s string) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetUpdatedAt(t time.Time) *HistoryUpdateOne
- func (huo *HistoryUpdateOne) SetUserID(i int64) *HistoryUpdateOne
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- 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. TypeHistory = "History" )
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 // History is the client for interacting with the History builders. History *HistoryClient // 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(). History. Query(). Count(ctx)
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(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 History ¶
type History struct { // ID of the ent. ID int64 `json:"id,omitempty"` // UserID holds the value of the "user_id" field. UserID int64 `json:"user_id,omitempty"` // ObjID holds the value of the "obj_id" field. ObjID int64 `json:"obj_id,omitempty"` // ObjType holds the value of the "obj_type" field. ObjType string `json:"obj_type,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // contains filtered or unexported fields }
History is the model entity for the History schema.
func (*History) Unwrap ¶
Unwrap unwraps the History 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 (*History) Update ¶
func (h *History) Update() *HistoryUpdateOne
Update returns a builder for updating this History. Note that you need to call History.Unwrap() before calling this method if this History was returned from a transaction, and the transaction was committed or rolled back.
type HistoryClient ¶
type HistoryClient struct {
// contains filtered or unexported fields
}
HistoryClient is a client for the History schema.
func NewHistoryClient ¶
func NewHistoryClient(c config) *HistoryClient
NewHistoryClient returns a client for the History from the given config.
func (*HistoryClient) Create ¶
func (c *HistoryClient) Create() *HistoryCreate
Create returns a create builder for History.
func (*HistoryClient) CreateBulk ¶
func (c *HistoryClient) CreateBulk(builders ...*HistoryCreate) *HistoryCreateBulk
CreateBulk returns a builder for creating a bulk of History entities.
func (*HistoryClient) Delete ¶
func (c *HistoryClient) Delete() *HistoryDelete
Delete returns a delete builder for History.
func (*HistoryClient) DeleteOne ¶
func (c *HistoryClient) DeleteOne(h *History) *HistoryDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*HistoryClient) DeleteOneID ¶
func (c *HistoryClient) DeleteOneID(id int64) *HistoryDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*HistoryClient) GetX ¶
func (c *HistoryClient) GetX(ctx context.Context, id int64) *History
GetX is like Get, but panics if an error occurs.
func (*HistoryClient) Hooks ¶
func (c *HistoryClient) Hooks() []Hook
Hooks returns the client hooks.
func (*HistoryClient) Query ¶
func (c *HistoryClient) Query() *HistoryQuery
Query returns a query builder for History.
func (*HistoryClient) Update ¶
func (c *HistoryClient) Update() *HistoryUpdate
Update returns an update builder for History.
func (*HistoryClient) UpdateOne ¶
func (c *HistoryClient) UpdateOne(h *History) *HistoryUpdateOne
UpdateOne returns an update builder for the given entity.
func (*HistoryClient) UpdateOneID ¶
func (c *HistoryClient) UpdateOneID(id int64) *HistoryUpdateOne
UpdateOneID returns an update builder for the given id.
func (*HistoryClient) Use ¶
func (c *HistoryClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `history.Hooks(f(g(h())))`.
type HistoryCreate ¶
type HistoryCreate struct {
// contains filtered or unexported fields
}
HistoryCreate is the builder for creating a History entity.
func (*HistoryCreate) Exec ¶
func (hc *HistoryCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*HistoryCreate) ExecX ¶
func (hc *HistoryCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*HistoryCreate) Mutation ¶
func (hc *HistoryCreate) Mutation() *HistoryMutation
Mutation returns the HistoryMutation object of the builder.
func (*HistoryCreate) Save ¶
func (hc *HistoryCreate) Save(ctx context.Context) (*History, error)
Save creates the History in the database.
func (*HistoryCreate) SaveX ¶
func (hc *HistoryCreate) SaveX(ctx context.Context) *History
SaveX calls Save and panics if Save returns an error.
func (*HistoryCreate) SetCreatedAt ¶
func (hc *HistoryCreate) SetCreatedAt(t time.Time) *HistoryCreate
SetCreatedAt sets the "created_at" field.
func (*HistoryCreate) SetID ¶
func (hc *HistoryCreate) SetID(i int64) *HistoryCreate
SetID sets the "id" field.
func (*HistoryCreate) SetNillableCreatedAt ¶
func (hc *HistoryCreate) SetNillableCreatedAt(t *time.Time) *HistoryCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*HistoryCreate) SetNillableUpdatedAt ¶
func (hc *HistoryCreate) SetNillableUpdatedAt(t *time.Time) *HistoryCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*HistoryCreate) SetObjID ¶
func (hc *HistoryCreate) SetObjID(i int64) *HistoryCreate
SetObjID sets the "obj_id" field.
func (*HistoryCreate) SetObjType ¶
func (hc *HistoryCreate) SetObjType(s string) *HistoryCreate
SetObjType sets the "obj_type" field.
func (*HistoryCreate) SetUpdatedAt ¶
func (hc *HistoryCreate) SetUpdatedAt(t time.Time) *HistoryCreate
SetUpdatedAt sets the "updated_at" field.
func (*HistoryCreate) SetUserID ¶
func (hc *HistoryCreate) SetUserID(i int64) *HistoryCreate
SetUserID sets the "user_id" field.
type HistoryCreateBulk ¶
type HistoryCreateBulk struct {
// contains filtered or unexported fields
}
HistoryCreateBulk is the builder for creating many History entities in bulk.
func (*HistoryCreateBulk) Exec ¶
func (hcb *HistoryCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*HistoryCreateBulk) ExecX ¶
func (hcb *HistoryCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type HistoryDelete ¶
type HistoryDelete struct {
// contains filtered or unexported fields
}
HistoryDelete is the builder for deleting a History entity.
func (*HistoryDelete) Exec ¶
func (hd *HistoryDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*HistoryDelete) ExecX ¶
func (hd *HistoryDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*HistoryDelete) Where ¶
func (hd *HistoryDelete) Where(ps ...predicate.History) *HistoryDelete
Where appends a list predicates to the HistoryDelete builder.
type HistoryDeleteOne ¶
type HistoryDeleteOne struct {
// contains filtered or unexported fields
}
HistoryDeleteOne is the builder for deleting a single History entity.
func (*HistoryDeleteOne) Exec ¶
func (hdo *HistoryDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*HistoryDeleteOne) ExecX ¶
func (hdo *HistoryDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type HistoryGroupBy ¶
type HistoryGroupBy struct {
// contains filtered or unexported fields
}
HistoryGroupBy is the group-by builder for History entities.
func (*HistoryGroupBy) Aggregate ¶
func (hgb *HistoryGroupBy) Aggregate(fns ...AggregateFunc) *HistoryGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*HistoryGroupBy) Bool ¶
func (hgb *HistoryGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) BoolX ¶
func (hgb *HistoryGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*HistoryGroupBy) Bools ¶
func (hgb *HistoryGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) BoolsX ¶
func (hgb *HistoryGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*HistoryGroupBy) Float64 ¶
func (hgb *HistoryGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) Float64X ¶
func (hgb *HistoryGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*HistoryGroupBy) Float64s ¶
func (hgb *HistoryGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) Float64sX ¶
func (hgb *HistoryGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*HistoryGroupBy) Int ¶
func (hgb *HistoryGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) IntX ¶
func (hgb *HistoryGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*HistoryGroupBy) Ints ¶
func (hgb *HistoryGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) IntsX ¶
func (hgb *HistoryGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*HistoryGroupBy) Scan ¶
func (hgb *HistoryGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*HistoryGroupBy) ScanX ¶
func (hgb *HistoryGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*HistoryGroupBy) String ¶
func (hgb *HistoryGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*HistoryGroupBy) StringX ¶
func (hgb *HistoryGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type HistoryMutation ¶
type HistoryMutation struct {
// contains filtered or unexported fields
}
HistoryMutation represents an operation that mutates the History nodes in the graph.
func (*HistoryMutation) AddField ¶
func (m *HistoryMutation) 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 (*HistoryMutation) AddObjID ¶
func (m *HistoryMutation) AddObjID(i int64)
AddObjID adds i to the "obj_id" field.
func (*HistoryMutation) AddUserID ¶
func (m *HistoryMutation) AddUserID(i int64)
AddUserID adds i to the "user_id" field.
func (*HistoryMutation) AddedEdges ¶
func (m *HistoryMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*HistoryMutation) AddedField ¶
func (m *HistoryMutation) 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 (*HistoryMutation) AddedFields ¶
func (m *HistoryMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*HistoryMutation) AddedIDs ¶
func (m *HistoryMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*HistoryMutation) AddedObjID ¶
func (m *HistoryMutation) AddedObjID() (r int64, exists bool)
AddedObjID returns the value that was added to the "obj_id" field in this mutation.
func (*HistoryMutation) AddedUserID ¶
func (m *HistoryMutation) AddedUserID() (r int64, exists bool)
AddedUserID returns the value that was added to the "user_id" field in this mutation.
func (*HistoryMutation) ClearEdge ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ClearField ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ClearedEdges ¶
func (m *HistoryMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*HistoryMutation) ClearedFields ¶
func (m *HistoryMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (HistoryMutation) Client ¶
func (m HistoryMutation) 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 (*HistoryMutation) CreatedAt ¶
func (m *HistoryMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*HistoryMutation) EdgeCleared ¶
func (m *HistoryMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*HistoryMutation) Field ¶
func (m *HistoryMutation) 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 (*HistoryMutation) FieldCleared ¶
func (m *HistoryMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*HistoryMutation) Fields ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ID ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ObjID ¶
func (m *HistoryMutation) ObjID() (r int64, exists bool)
ObjID returns the value of the "obj_id" field in the mutation.
func (*HistoryMutation) ObjType ¶
func (m *HistoryMutation) ObjType() (r string, exists bool)
ObjType returns the value of the "obj_type" field in the mutation.
func (*HistoryMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the History entity. If the History 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 (*HistoryMutation) 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 (*HistoryMutation) OldObjID ¶
func (m *HistoryMutation) OldObjID(ctx context.Context) (v int64, err error)
OldObjID returns the old "obj_id" field's value of the History entity. If the History 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 (*HistoryMutation) OldObjType ¶
func (m *HistoryMutation) OldObjType(ctx context.Context) (v string, err error)
OldObjType returns the old "obj_type" field's value of the History entity. If the History 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 (*HistoryMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the History entity. If the History 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 (*HistoryMutation) OldUserID ¶
func (m *HistoryMutation) OldUserID(ctx context.Context) (v int64, err error)
OldUserID returns the old "user_id" field's value of the History entity. If the History 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 (*HistoryMutation) RemovedEdges ¶
func (m *HistoryMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*HistoryMutation) RemovedIDs ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ResetCreatedAt ¶
func (m *HistoryMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*HistoryMutation) ResetEdge ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ResetField ¶
func (m *HistoryMutation) 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 (*HistoryMutation) ResetObjID ¶
func (m *HistoryMutation) ResetObjID()
ResetObjID resets all changes to the "obj_id" field.
func (*HistoryMutation) ResetObjType ¶
func (m *HistoryMutation) ResetObjType()
ResetObjType resets all changes to the "obj_type" field.
func (*HistoryMutation) ResetUpdatedAt ¶
func (m *HistoryMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*HistoryMutation) ResetUserID ¶
func (m *HistoryMutation) ResetUserID()
ResetUserID resets all changes to the "user_id" field.
func (*HistoryMutation) SetCreatedAt ¶
func (m *HistoryMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*HistoryMutation) SetField ¶
func (m *HistoryMutation) 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 (*HistoryMutation) SetID ¶
func (m *HistoryMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of History entities.
func (*HistoryMutation) SetObjID ¶
func (m *HistoryMutation) SetObjID(i int64)
SetObjID sets the "obj_id" field.
func (*HistoryMutation) SetObjType ¶
func (m *HistoryMutation) SetObjType(s string)
SetObjType sets the "obj_type" field.
func (*HistoryMutation) SetUpdatedAt ¶
func (m *HistoryMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*HistoryMutation) SetUserID ¶
func (m *HistoryMutation) SetUserID(i int64)
SetUserID sets the "user_id" field.
func (HistoryMutation) Tx ¶
func (m HistoryMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*HistoryMutation) Type ¶
func (m *HistoryMutation) Type() string
Type returns the node type of this mutation (History).
func (*HistoryMutation) UpdatedAt ¶
func (m *HistoryMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*HistoryMutation) UserID ¶
func (m *HistoryMutation) UserID() (r int64, exists bool)
UserID returns the value of the "user_id" field in the mutation.
func (*HistoryMutation) Where ¶
func (m *HistoryMutation) Where(ps ...predicate.History)
Where appends a list predicates to the HistoryMutation builder.
type HistoryQuery ¶
type HistoryQuery struct {
// contains filtered or unexported fields
}
HistoryQuery is the builder for querying History entities.
func (*HistoryQuery) All ¶
func (hq *HistoryQuery) All(ctx context.Context) ([]*History, error)
All executes the query and returns a list of Histories.
func (*HistoryQuery) AllX ¶
func (hq *HistoryQuery) AllX(ctx context.Context) []*History
AllX is like All, but panics if an error occurs.
func (*HistoryQuery) Clone ¶
func (hq *HistoryQuery) Clone() *HistoryQuery
Clone returns a duplicate of the HistoryQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*HistoryQuery) Count ¶
func (hq *HistoryQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*HistoryQuery) CountX ¶
func (hq *HistoryQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*HistoryQuery) Exist ¶
func (hq *HistoryQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*HistoryQuery) ExistX ¶
func (hq *HistoryQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*HistoryQuery) First ¶
func (hq *HistoryQuery) First(ctx context.Context) (*History, error)
First returns the first History entity from the query. Returns a *NotFoundError when no History was found.
func (*HistoryQuery) FirstID ¶
func (hq *HistoryQuery) FirstID(ctx context.Context) (id int64, err error)
FirstID returns the first History ID from the query. Returns a *NotFoundError when no History ID was found.
func (*HistoryQuery) FirstIDX ¶
func (hq *HistoryQuery) FirstIDX(ctx context.Context) int64
FirstIDX is like FirstID, but panics if an error occurs.
func (*HistoryQuery) FirstX ¶
func (hq *HistoryQuery) FirstX(ctx context.Context) *History
FirstX is like First, but panics if an error occurs.
func (*HistoryQuery) GroupBy ¶
func (hq *HistoryQuery) GroupBy(field string, fields ...string) *HistoryGroupBy
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 { UserID int64 `json:"user_id,omitempty"` Count int `json:"count,omitempty"` } client.History.Query(). GroupBy(history.FieldUserID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*HistoryQuery) IDs ¶
func (hq *HistoryQuery) IDs(ctx context.Context) ([]int64, error)
IDs executes the query and returns a list of History IDs.
func (*HistoryQuery) IDsX ¶
func (hq *HistoryQuery) IDsX(ctx context.Context) []int64
IDsX is like IDs, but panics if an error occurs.
func (*HistoryQuery) Limit ¶
func (hq *HistoryQuery) Limit(limit int) *HistoryQuery
Limit adds a limit step to the query.
func (*HistoryQuery) Offset ¶
func (hq *HistoryQuery) Offset(offset int) *HistoryQuery
Offset adds an offset step to the query.
func (*HistoryQuery) Only ¶
func (hq *HistoryQuery) Only(ctx context.Context) (*History, error)
Only returns a single History entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one History entity is not found. Returns a *NotFoundError when no History entities are found.
func (*HistoryQuery) OnlyID ¶
func (hq *HistoryQuery) OnlyID(ctx context.Context) (id int64, err error)
OnlyID is like Only, but returns the only History ID in the query. Returns a *NotSingularError when exactly one History ID is not found. Returns a *NotFoundError when no entities are found.
func (*HistoryQuery) OnlyIDX ¶
func (hq *HistoryQuery) OnlyIDX(ctx context.Context) int64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*HistoryQuery) OnlyX ¶
func (hq *HistoryQuery) OnlyX(ctx context.Context) *History
OnlyX is like Only, but panics if an error occurs.
func (*HistoryQuery) Order ¶
func (hq *HistoryQuery) Order(o ...OrderFunc) *HistoryQuery
Order adds an order step to the query.
func (*HistoryQuery) Select ¶
func (hq *HistoryQuery) Select(fields ...string) *HistorySelect
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 { UserID int64 `json:"user_id,omitempty"` } client.History.Query(). Select(history.FieldUserID). Scan(ctx, &v)
func (*HistoryQuery) Unique ¶
func (hq *HistoryQuery) Unique(unique bool) *HistoryQuery
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 (*HistoryQuery) Where ¶
func (hq *HistoryQuery) Where(ps ...predicate.History) *HistoryQuery
Where adds a new predicate for the HistoryQuery builder.
type HistorySelect ¶
type HistorySelect struct { *HistoryQuery // contains filtered or unexported fields }
HistorySelect is the builder for selecting fields of History entities.
func (*HistorySelect) Bool ¶
func (hs *HistorySelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*HistorySelect) BoolX ¶
func (hs *HistorySelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*HistorySelect) Bools ¶
func (hs *HistorySelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*HistorySelect) BoolsX ¶
func (hs *HistorySelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*HistorySelect) Float64 ¶
func (hs *HistorySelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*HistorySelect) Float64X ¶
func (hs *HistorySelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*HistorySelect) Float64s ¶
func (hs *HistorySelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*HistorySelect) Float64sX ¶
func (hs *HistorySelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*HistorySelect) Int ¶
func (hs *HistorySelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*HistorySelect) IntX ¶
func (hs *HistorySelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*HistorySelect) Ints ¶
func (hs *HistorySelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*HistorySelect) IntsX ¶
func (hs *HistorySelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*HistorySelect) Scan ¶
func (hs *HistorySelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*HistorySelect) ScanX ¶
func (hs *HistorySelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*HistorySelect) String ¶
func (hs *HistorySelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*HistorySelect) StringX ¶
func (hs *HistorySelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type HistoryUpdate ¶
type HistoryUpdate struct {
// contains filtered or unexported fields
}
HistoryUpdate is the builder for updating History entities.
func (*HistoryUpdate) AddObjID ¶
func (hu *HistoryUpdate) AddObjID(i int64) *HistoryUpdate
AddObjID adds i to the "obj_id" field.
func (*HistoryUpdate) AddUserID ¶
func (hu *HistoryUpdate) AddUserID(i int64) *HistoryUpdate
AddUserID adds i to the "user_id" field.
func (*HistoryUpdate) Exec ¶
func (hu *HistoryUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*HistoryUpdate) ExecX ¶
func (hu *HistoryUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*HistoryUpdate) Mutation ¶
func (hu *HistoryUpdate) Mutation() *HistoryMutation
Mutation returns the HistoryMutation object of the builder.
func (*HistoryUpdate) Save ¶
func (hu *HistoryUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*HistoryUpdate) SaveX ¶
func (hu *HistoryUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*HistoryUpdate) SetCreatedAt ¶
func (hu *HistoryUpdate) SetCreatedAt(t time.Time) *HistoryUpdate
SetCreatedAt sets the "created_at" field.
func (*HistoryUpdate) SetNillableCreatedAt ¶
func (hu *HistoryUpdate) SetNillableCreatedAt(t *time.Time) *HistoryUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*HistoryUpdate) SetNillableUpdatedAt ¶
func (hu *HistoryUpdate) SetNillableUpdatedAt(t *time.Time) *HistoryUpdate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*HistoryUpdate) SetObjID ¶
func (hu *HistoryUpdate) SetObjID(i int64) *HistoryUpdate
SetObjID sets the "obj_id" field.
func (*HistoryUpdate) SetObjType ¶
func (hu *HistoryUpdate) SetObjType(s string) *HistoryUpdate
SetObjType sets the "obj_type" field.
func (*HistoryUpdate) SetUpdatedAt ¶
func (hu *HistoryUpdate) SetUpdatedAt(t time.Time) *HistoryUpdate
SetUpdatedAt sets the "updated_at" field.
func (*HistoryUpdate) SetUserID ¶
func (hu *HistoryUpdate) SetUserID(i int64) *HistoryUpdate
SetUserID sets the "user_id" field.
func (*HistoryUpdate) Where ¶
func (hu *HistoryUpdate) Where(ps ...predicate.History) *HistoryUpdate
Where appends a list predicates to the HistoryUpdate builder.
type HistoryUpdateOne ¶
type HistoryUpdateOne struct {
// contains filtered or unexported fields
}
HistoryUpdateOne is the builder for updating a single History entity.
func (*HistoryUpdateOne) AddObjID ¶
func (huo *HistoryUpdateOne) AddObjID(i int64) *HistoryUpdateOne
AddObjID adds i to the "obj_id" field.
func (*HistoryUpdateOne) AddUserID ¶
func (huo *HistoryUpdateOne) AddUserID(i int64) *HistoryUpdateOne
AddUserID adds i to the "user_id" field.
func (*HistoryUpdateOne) Exec ¶
func (huo *HistoryUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*HistoryUpdateOne) ExecX ¶
func (huo *HistoryUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*HistoryUpdateOne) Mutation ¶
func (huo *HistoryUpdateOne) Mutation() *HistoryMutation
Mutation returns the HistoryMutation object of the builder.
func (*HistoryUpdateOne) Save ¶
func (huo *HistoryUpdateOne) Save(ctx context.Context) (*History, error)
Save executes the query and returns the updated History entity.
func (*HistoryUpdateOne) SaveX ¶
func (huo *HistoryUpdateOne) SaveX(ctx context.Context) *History
SaveX is like Save, but panics if an error occurs.
func (*HistoryUpdateOne) Select ¶
func (huo *HistoryUpdateOne) Select(field string, fields ...string) *HistoryUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*HistoryUpdateOne) SetCreatedAt ¶
func (huo *HistoryUpdateOne) SetCreatedAt(t time.Time) *HistoryUpdateOne
SetCreatedAt sets the "created_at" field.
func (*HistoryUpdateOne) SetNillableCreatedAt ¶
func (huo *HistoryUpdateOne) SetNillableCreatedAt(t *time.Time) *HistoryUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*HistoryUpdateOne) SetNillableUpdatedAt ¶
func (huo *HistoryUpdateOne) SetNillableUpdatedAt(t *time.Time) *HistoryUpdateOne
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*HistoryUpdateOne) SetObjID ¶
func (huo *HistoryUpdateOne) SetObjID(i int64) *HistoryUpdateOne
SetObjID sets the "obj_id" field.
func (*HistoryUpdateOne) SetObjType ¶
func (huo *HistoryUpdateOne) SetObjType(s string) *HistoryUpdateOne
SetObjType sets the "obj_type" field.
func (*HistoryUpdateOne) SetUpdatedAt ¶
func (huo *HistoryUpdateOne) SetUpdatedAt(t time.Time) *HistoryUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*HistoryUpdateOne) SetUserID ¶
func (huo *HistoryUpdateOne) SetUserID(i int64) *HistoryUpdateOne
SetUserID sets the "user_id" field.
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 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(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 Rollbacker method.
type Tx ¶
type Tx struct { // History is the client for interacting with the History builders. History *HistoryClient // 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 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.