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 File
- type FileClient
- func (c *FileClient) Create() *FileCreate
- func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk
- func (c *FileClient) Delete() *FileDelete
- func (c *FileClient) DeleteOne(f *File) *FileDeleteOne
- func (c *FileClient) DeleteOneID(id int) *FileDeleteOne
- func (c *FileClient) Get(ctx context.Context, id int) (*File, error)
- func (c *FileClient) GetX(ctx context.Context, id int) *File
- func (c *FileClient) Hooks() []Hook
- func (c *FileClient) Query() *FileQuery
- func (c *FileClient) QueryChildren(f *File) *FileQuery
- func (c *FileClient) QueryParent(f *File) *FileQuery
- func (c *FileClient) Update() *FileUpdate
- func (c *FileClient) UpdateOne(f *File) *FileUpdateOne
- func (c *FileClient) UpdateOneID(id int) *FileUpdateOne
- func (c *FileClient) Use(hooks ...Hook)
- type FileCreate
- func (fc *FileCreate) AddChildIDs(ids ...int) *FileCreate
- func (fc *FileCreate) AddChildren(f ...*File) *FileCreate
- func (fc *FileCreate) Exec(ctx context.Context) error
- func (fc *FileCreate) ExecX(ctx context.Context)
- func (fc *FileCreate) Mutation() *FileMutation
- func (fc *FileCreate) Save(ctx context.Context) (*File, error)
- func (fc *FileCreate) SaveX(ctx context.Context) *File
- func (fc *FileCreate) SetDeleted(b bool) *FileCreate
- func (fc *FileCreate) SetName(s string) *FileCreate
- func (fc *FileCreate) SetNillableDeleted(b *bool) *FileCreate
- func (fc *FileCreate) SetNillableParentID(i *int) *FileCreate
- func (fc *FileCreate) SetParent(f *File) *FileCreate
- func (fc *FileCreate) SetParentID(i int) *FileCreate
- type FileCreateBulk
- type FileDelete
- type FileDeleteOne
- type FileEdges
- type FileGroupBy
- func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy
- func (fgb *FileGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (fgb *FileGroupBy) BoolX(ctx context.Context) bool
- func (fgb *FileGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool
- func (fgb *FileGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (fgb *FileGroupBy) Float64X(ctx context.Context) float64
- func (fgb *FileGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64
- func (fgb *FileGroupBy) Int(ctx context.Context) (_ int, err error)
- func (fgb *FileGroupBy) IntX(ctx context.Context) int
- func (fgb *FileGroupBy) Ints(ctx context.Context) ([]int, error)
- func (fgb *FileGroupBy) IntsX(ctx context.Context) []int
- func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error
- func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})
- func (fgb *FileGroupBy) String(ctx context.Context) (_ string, err error)
- func (fgb *FileGroupBy) StringX(ctx context.Context) string
- func (fgb *FileGroupBy) Strings(ctx context.Context) ([]string, error)
- func (fgb *FileGroupBy) StringsX(ctx context.Context) []string
- type FileMutation
- func (m *FileMutation) AddChildIDs(ids ...int)
- func (m *FileMutation) AddField(name string, value ent.Value) error
- func (m *FileMutation) AddedEdges() []string
- func (m *FileMutation) AddedField(name string) (ent.Value, bool)
- func (m *FileMutation) AddedFields() []string
- func (m *FileMutation) AddedIDs(name string) []ent.Value
- func (m *FileMutation) ChildrenCleared() bool
- func (m *FileMutation) ChildrenIDs() (ids []int)
- func (m *FileMutation) ClearChildren()
- func (m *FileMutation) ClearEdge(name string) error
- func (m *FileMutation) ClearField(name string) error
- func (m *FileMutation) ClearParent()
- func (m *FileMutation) ClearParentID()
- func (m *FileMutation) ClearedEdges() []string
- func (m *FileMutation) ClearedFields() []string
- func (m FileMutation) Client() *Client
- func (m *FileMutation) Deleted() (r bool, exists bool)
- func (m *FileMutation) EdgeCleared(name string) bool
- func (m *FileMutation) Field(name string) (ent.Value, bool)
- func (m *FileMutation) FieldCleared(name string) bool
- func (m *FileMutation) Fields() []string
- func (m *FileMutation) ID() (id int, exists bool)
- func (m *FileMutation) IDs(ctx context.Context) ([]int, error)
- func (m *FileMutation) Name() (r string, exists bool)
- func (m *FileMutation) OldDeleted(ctx context.Context) (v bool, err error)
- func (m *FileMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *FileMutation) OldName(ctx context.Context) (v string, err error)
- func (m *FileMutation) OldParentID(ctx context.Context) (v int, err error)
- func (m *FileMutation) Op() Op
- func (m *FileMutation) ParentCleared() bool
- func (m *FileMutation) ParentID() (r int, exists bool)
- func (m *FileMutation) ParentIDCleared() bool
- func (m *FileMutation) ParentIDs() (ids []int)
- func (m *FileMutation) RemoveChildIDs(ids ...int)
- func (m *FileMutation) RemovedChildrenIDs() (ids []int)
- func (m *FileMutation) RemovedEdges() []string
- func (m *FileMutation) RemovedIDs(name string) []ent.Value
- func (m *FileMutation) ResetChildren()
- func (m *FileMutation) ResetDeleted()
- func (m *FileMutation) ResetEdge(name string) error
- func (m *FileMutation) ResetField(name string) error
- func (m *FileMutation) ResetName()
- func (m *FileMutation) ResetParent()
- func (m *FileMutation) ResetParentID()
- func (m *FileMutation) SetDeleted(b bool)
- func (m *FileMutation) SetField(name string, value ent.Value) error
- func (m *FileMutation) SetName(s string)
- func (m *FileMutation) SetParentID(i int)
- func (m FileMutation) Tx() (*Tx, error)
- func (m *FileMutation) Type() string
- func (m *FileMutation) Where(ps ...predicate.File)
- type FileQuery
- func (fq *FileQuery) All(ctx context.Context) ([]*File, error)
- func (fq *FileQuery) AllX(ctx context.Context) []*File
- func (fq *FileQuery) Clone() *FileQuery
- func (fq *FileQuery) Count(ctx context.Context) (int, error)
- func (fq *FileQuery) CountX(ctx context.Context) int
- func (fq *FileQuery) Exist(ctx context.Context) (bool, error)
- func (fq *FileQuery) ExistX(ctx context.Context) bool
- func (fq *FileQuery) First(ctx context.Context) (*File, error)
- func (fq *FileQuery) FirstID(ctx context.Context) (id int, err error)
- func (fq *FileQuery) FirstIDX(ctx context.Context) int
- func (fq *FileQuery) FirstX(ctx context.Context) *File
- func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
- func (fq *FileQuery) IDs(ctx context.Context) ([]int, error)
- func (fq *FileQuery) IDsX(ctx context.Context) []int
- func (fq *FileQuery) Limit(limit int) *FileQuery
- func (fq *FileQuery) Offset(offset int) *FileQuery
- func (fq *FileQuery) Only(ctx context.Context) (*File, error)
- func (fq *FileQuery) OnlyID(ctx context.Context) (id int, err error)
- func (fq *FileQuery) OnlyIDX(ctx context.Context) int
- func (fq *FileQuery) OnlyX(ctx context.Context) *File
- func (fq *FileQuery) Order(o ...OrderFunc) *FileQuery
- func (fq *FileQuery) QueryChildren() *FileQuery
- func (fq *FileQuery) QueryParent() *FileQuery
- func (fq *FileQuery) Select(fields ...string) *FileSelect
- func (fq *FileQuery) Unique(unique bool) *FileQuery
- func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery
- func (fq *FileQuery) WithChildren(opts ...func(*FileQuery)) *FileQuery
- func (fq *FileQuery) WithParent(opts ...func(*FileQuery)) *FileQuery
- type FileSelect
- func (fs *FileSelect) Bool(ctx context.Context) (_ bool, err error)
- func (fs *FileSelect) BoolX(ctx context.Context) bool
- func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)
- func (fs *FileSelect) BoolsX(ctx context.Context) []bool
- func (fs *FileSelect) Float64(ctx context.Context) (_ float64, err error)
- func (fs *FileSelect) Float64X(ctx context.Context) float64
- func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)
- func (fs *FileSelect) Float64sX(ctx context.Context) []float64
- func (fs *FileSelect) Int(ctx context.Context) (_ int, err error)
- func (fs *FileSelect) IntX(ctx context.Context) int
- func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)
- func (fs *FileSelect) IntsX(ctx context.Context) []int
- func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error
- func (fs *FileSelect) ScanX(ctx context.Context, v interface{})
- func (fs *FileSelect) String(ctx context.Context) (_ string, err error)
- func (fs *FileSelect) StringX(ctx context.Context) string
- func (fs *FileSelect) Strings(ctx context.Context) ([]string, error)
- func (fs *FileSelect) StringsX(ctx context.Context) []string
- type FileUpdate
- func (fu *FileUpdate) AddChildIDs(ids ...int) *FileUpdate
- func (fu *FileUpdate) AddChildren(f ...*File) *FileUpdate
- func (fu *FileUpdate) ClearChildren() *FileUpdate
- func (fu *FileUpdate) ClearParent() *FileUpdate
- func (fu *FileUpdate) ClearParentID() *FileUpdate
- func (fu *FileUpdate) Exec(ctx context.Context) error
- func (fu *FileUpdate) ExecX(ctx context.Context)
- func (fu *FileUpdate) Mutation() *FileMutation
- func (fu *FileUpdate) RemoveChildIDs(ids ...int) *FileUpdate
- func (fu *FileUpdate) RemoveChildren(f ...*File) *FileUpdate
- func (fu *FileUpdate) Save(ctx context.Context) (int, error)
- func (fu *FileUpdate) SaveX(ctx context.Context) int
- func (fu *FileUpdate) SetDeleted(b bool) *FileUpdate
- func (fu *FileUpdate) SetName(s string) *FileUpdate
- func (fu *FileUpdate) SetNillableDeleted(b *bool) *FileUpdate
- func (fu *FileUpdate) SetNillableParentID(i *int) *FileUpdate
- func (fu *FileUpdate) SetParent(f *File) *FileUpdate
- func (fu *FileUpdate) SetParentID(i int) *FileUpdate
- func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
- type FileUpdateOne
- func (fuo *FileUpdateOne) AddChildIDs(ids ...int) *FileUpdateOne
- func (fuo *FileUpdateOne) AddChildren(f ...*File) *FileUpdateOne
- func (fuo *FileUpdateOne) ClearChildren() *FileUpdateOne
- func (fuo *FileUpdateOne) ClearParent() *FileUpdateOne
- func (fuo *FileUpdateOne) ClearParentID() *FileUpdateOne
- func (fuo *FileUpdateOne) Exec(ctx context.Context) error
- func (fuo *FileUpdateOne) ExecX(ctx context.Context)
- func (fuo *FileUpdateOne) Mutation() *FileMutation
- func (fuo *FileUpdateOne) RemoveChildIDs(ids ...int) *FileUpdateOne
- func (fuo *FileUpdateOne) RemoveChildren(f ...*File) *FileUpdateOne
- func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
- func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
- func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne
- func (fuo *FileUpdateOne) SetDeleted(b bool) *FileUpdateOne
- func (fuo *FileUpdateOne) SetName(s string) *FileUpdateOne
- func (fuo *FileUpdateOne) SetNillableDeleted(b *bool) *FileUpdateOne
- func (fuo *FileUpdateOne) SetNillableParentID(i *int) *FileUpdateOne
- func (fuo *FileUpdateOne) SetParent(f *File) *FileUpdateOne
- func (fuo *FileUpdateOne) SetParentID(i int) *FileUpdateOne
- type Files
- 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. TypeFile = "File" )
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 // File is the client for interacting with the File builders. File *FileClient // 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(). File. 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(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 File ¶
type File struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Deleted holds the value of the "deleted" field. Deleted bool `json:"deleted,omitempty"` // ParentID holds the value of the "parent_id" field. ParentID int `json:"parent_id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the FileQuery when eager-loading is set. Edges FileEdges `json:"edges"` // contains filtered or unexported fields }
File is the model entity for the File schema.
func (*File) QueryChildren ¶
QueryChildren queries the "children" edge of the File entity.
func (*File) QueryParent ¶
QueryParent queries the "parent" edge of the File entity.
func (*File) Unwrap ¶
Unwrap unwraps the File 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 (*File) Update ¶
func (f *File) Update() *FileUpdateOne
Update returns a builder for updating this File. Note that you need to call File.Unwrap() before calling this method if this File was returned from a transaction, and the transaction was committed or rolled back.
type FileClient ¶
type FileClient struct {
// contains filtered or unexported fields
}
FileClient is a client for the File schema.
func NewFileClient ¶
func NewFileClient(c config) *FileClient
NewFileClient returns a client for the File from the given config.
func (*FileClient) Create ¶
func (c *FileClient) Create() *FileCreate
Create returns a create builder for File.
func (*FileClient) CreateBulk ¶
func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk
CreateBulk returns a builder for creating a bulk of File entities.
func (*FileClient) Delete ¶
func (c *FileClient) Delete() *FileDelete
Delete returns a delete builder for File.
func (*FileClient) DeleteOne ¶
func (c *FileClient) DeleteOne(f *File) *FileDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*FileClient) DeleteOneID ¶
func (c *FileClient) DeleteOneID(id int) *FileDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*FileClient) GetX ¶
func (c *FileClient) GetX(ctx context.Context, id int) *File
GetX is like Get, but panics if an error occurs.
func (*FileClient) Query ¶
func (c *FileClient) Query() *FileQuery
Query returns a query builder for File.
func (*FileClient) QueryChildren ¶
func (c *FileClient) QueryChildren(f *File) *FileQuery
QueryChildren queries the children edge of a File.
func (*FileClient) QueryParent ¶
func (c *FileClient) QueryParent(f *File) *FileQuery
QueryParent queries the parent edge of a File.
func (*FileClient) Update ¶
func (c *FileClient) Update() *FileUpdate
Update returns an update builder for File.
func (*FileClient) UpdateOne ¶
func (c *FileClient) UpdateOne(f *File) *FileUpdateOne
UpdateOne returns an update builder for the given entity.
func (*FileClient) UpdateOneID ¶
func (c *FileClient) UpdateOneID(id int) *FileUpdateOne
UpdateOneID returns an update builder for the given id.
func (*FileClient) Use ¶
func (c *FileClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `file.Hooks(f(g(h())))`.
type FileCreate ¶
type FileCreate struct {
// contains filtered or unexported fields
}
FileCreate is the builder for creating a File entity.
func (*FileCreate) AddChildIDs ¶
func (fc *FileCreate) AddChildIDs(ids ...int) *FileCreate
AddChildIDs adds the "children" edge to the File entity by IDs.
func (*FileCreate) AddChildren ¶
func (fc *FileCreate) AddChildren(f ...*File) *FileCreate
AddChildren adds the "children" edges to the File entity.
func (*FileCreate) Exec ¶
func (fc *FileCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*FileCreate) ExecX ¶
func (fc *FileCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileCreate) Mutation ¶
func (fc *FileCreate) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileCreate) Save ¶
func (fc *FileCreate) Save(ctx context.Context) (*File, error)
Save creates the File in the database.
func (*FileCreate) SaveX ¶
func (fc *FileCreate) SaveX(ctx context.Context) *File
SaveX calls Save and panics if Save returns an error.
func (*FileCreate) SetDeleted ¶
func (fc *FileCreate) SetDeleted(b bool) *FileCreate
SetDeleted sets the "deleted" field.
func (*FileCreate) SetName ¶
func (fc *FileCreate) SetName(s string) *FileCreate
SetName sets the "name" field.
func (*FileCreate) SetNillableDeleted ¶
func (fc *FileCreate) SetNillableDeleted(b *bool) *FileCreate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*FileCreate) SetNillableParentID ¶
func (fc *FileCreate) SetNillableParentID(i *int) *FileCreate
SetNillableParentID sets the "parent_id" field if the given value is not nil.
func (*FileCreate) SetParent ¶
func (fc *FileCreate) SetParent(f *File) *FileCreate
SetParent sets the "parent" edge to the File entity.
func (*FileCreate) SetParentID ¶
func (fc *FileCreate) SetParentID(i int) *FileCreate
SetParentID sets the "parent_id" field.
type FileCreateBulk ¶
type FileCreateBulk struct {
// contains filtered or unexported fields
}
FileCreateBulk is the builder for creating many File entities in bulk.
func (*FileCreateBulk) Exec ¶
func (fcb *FileCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*FileCreateBulk) ExecX ¶
func (fcb *FileCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type FileDelete ¶
type FileDelete struct {
// contains filtered or unexported fields
}
FileDelete is the builder for deleting a File entity.
func (*FileDelete) Exec ¶
func (fd *FileDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*FileDelete) ExecX ¶
func (fd *FileDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*FileDelete) Where ¶
func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete
Where appends a list predicates to the FileDelete builder.
type FileDeleteOne ¶
type FileDeleteOne struct {
// contains filtered or unexported fields
}
FileDeleteOne is the builder for deleting a single File entity.
func (*FileDeleteOne) Exec ¶
func (fdo *FileDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*FileDeleteOne) ExecX ¶
func (fdo *FileDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type FileEdges ¶
type FileEdges struct { // Parent holds the value of the parent edge. Parent *File `json:"parent,omitempty"` // Children holds the value of the children edge. Children []*File `json:"children,omitempty"` // contains filtered or unexported fields }
FileEdges holds the relations/edges for other nodes in the graph.
func (FileEdges) ChildrenOrErr ¶
ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.
func (FileEdges) ParentOrErr ¶
ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type FileGroupBy ¶
type FileGroupBy struct {
// contains filtered or unexported fields
}
FileGroupBy is the group-by builder for File entities.
func (*FileGroupBy) Aggregate ¶
func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*FileGroupBy) Bool ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) BoolX ¶
func (fgb *FileGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*FileGroupBy) Bools ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) BoolsX ¶
func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*FileGroupBy) Float64 ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) Float64X ¶
func (fgb *FileGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*FileGroupBy) Float64s ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) Float64sX ¶
func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*FileGroupBy) Int ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) IntX ¶
func (fgb *FileGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*FileGroupBy) Ints ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) IntsX ¶
func (fgb *FileGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*FileGroupBy) Scan ¶
func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*FileGroupBy) ScanX ¶
func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*FileGroupBy) String ¶
func (fgb *FileGroupBy) 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 (*FileGroupBy) StringX ¶
func (fgb *FileGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type FileMutation ¶
type FileMutation struct {
// contains filtered or unexported fields
}
FileMutation represents an operation that mutates the File nodes in the graph.
func (*FileMutation) AddChildIDs ¶
func (m *FileMutation) AddChildIDs(ids ...int)
AddChildIDs adds the "children" edge to the File entity by ids.
func (*FileMutation) AddField ¶
func (m *FileMutation) 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 (*FileMutation) AddedEdges ¶
func (m *FileMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*FileMutation) AddedField ¶
func (m *FileMutation) 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 (*FileMutation) AddedFields ¶
func (m *FileMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*FileMutation) AddedIDs ¶
func (m *FileMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*FileMutation) ChildrenCleared ¶
func (m *FileMutation) ChildrenCleared() bool
ChildrenCleared reports if the "children" edge to the File entity was cleared.
func (*FileMutation) ChildrenIDs ¶
func (m *FileMutation) ChildrenIDs() (ids []int)
ChildrenIDs returns the "children" edge IDs in the mutation.
func (*FileMutation) ClearChildren ¶
func (m *FileMutation) ClearChildren()
ClearChildren clears the "children" edge to the File entity.
func (*FileMutation) ClearEdge ¶
func (m *FileMutation) 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 (*FileMutation) ClearField ¶
func (m *FileMutation) 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 (*FileMutation) ClearParent ¶
func (m *FileMutation) ClearParent()
ClearParent clears the "parent" edge to the File entity.
func (*FileMutation) ClearParentID ¶
func (m *FileMutation) ClearParentID()
ClearParentID clears the value of the "parent_id" field.
func (*FileMutation) ClearedEdges ¶
func (m *FileMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*FileMutation) ClearedFields ¶
func (m *FileMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (FileMutation) Client ¶
func (m FileMutation) 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 (*FileMutation) Deleted ¶
func (m *FileMutation) Deleted() (r bool, exists bool)
Deleted returns the value of the "deleted" field in the mutation.
func (*FileMutation) EdgeCleared ¶
func (m *FileMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*FileMutation) Field ¶
func (m *FileMutation) 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 (*FileMutation) FieldCleared ¶
func (m *FileMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*FileMutation) Fields ¶
func (m *FileMutation) 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 (*FileMutation) ID ¶
func (m *FileMutation) 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 (*FileMutation) IDs ¶
func (m *FileMutation) 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 (*FileMutation) Name ¶
func (m *FileMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*FileMutation) OldDeleted ¶
func (m *FileMutation) OldDeleted(ctx context.Context) (v bool, err error)
OldDeleted returns the old "deleted" field's value of the File entity. If the File 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 (*FileMutation) 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 (*FileMutation) OldName ¶
func (m *FileMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the File entity. If the File 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 (*FileMutation) OldParentID ¶
func (m *FileMutation) OldParentID(ctx context.Context) (v int, err error)
OldParentID returns the old "parent_id" field's value of the File entity. If the File 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 (*FileMutation) ParentCleared ¶
func (m *FileMutation) ParentCleared() bool
ParentCleared reports if the "parent" edge to the File entity was cleared.
func (*FileMutation) ParentID ¶
func (m *FileMutation) ParentID() (r int, exists bool)
ParentID returns the value of the "parent_id" field in the mutation.
func (*FileMutation) ParentIDCleared ¶
func (m *FileMutation) ParentIDCleared() bool
ParentIDCleared returns if the "parent_id" field was cleared in this mutation.
func (*FileMutation) ParentIDs ¶
func (m *FileMutation) ParentIDs() (ids []int)
ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.
func (*FileMutation) RemoveChildIDs ¶
func (m *FileMutation) RemoveChildIDs(ids ...int)
RemoveChildIDs removes the "children" edge to the File entity by IDs.
func (*FileMutation) RemovedChildrenIDs ¶
func (m *FileMutation) RemovedChildrenIDs() (ids []int)
RemovedChildren returns the removed IDs of the "children" edge to the File entity.
func (*FileMutation) RemovedEdges ¶
func (m *FileMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*FileMutation) RemovedIDs ¶
func (m *FileMutation) 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 (*FileMutation) ResetChildren ¶
func (m *FileMutation) ResetChildren()
ResetChildren resets all changes to the "children" edge.
func (*FileMutation) ResetDeleted ¶
func (m *FileMutation) ResetDeleted()
ResetDeleted resets all changes to the "deleted" field.
func (*FileMutation) ResetEdge ¶
func (m *FileMutation) 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 (*FileMutation) ResetField ¶
func (m *FileMutation) 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 (*FileMutation) ResetName ¶
func (m *FileMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*FileMutation) ResetParent ¶
func (m *FileMutation) ResetParent()
ResetParent resets all changes to the "parent" edge.
func (*FileMutation) ResetParentID ¶
func (m *FileMutation) ResetParentID()
ResetParentID resets all changes to the "parent_id" field.
func (*FileMutation) SetDeleted ¶
func (m *FileMutation) SetDeleted(b bool)
SetDeleted sets the "deleted" field.
func (*FileMutation) SetField ¶
func (m *FileMutation) 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 (*FileMutation) SetName ¶
func (m *FileMutation) SetName(s string)
SetName sets the "name" field.
func (*FileMutation) SetParentID ¶
func (m *FileMutation) SetParentID(i int)
SetParentID sets the "parent_id" field.
func (FileMutation) Tx ¶
func (m FileMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*FileMutation) Type ¶
func (m *FileMutation) Type() string
Type returns the node type of this mutation (File).
func (*FileMutation) Where ¶
func (m *FileMutation) Where(ps ...predicate.File)
Where appends a list predicates to the FileMutation builder.
type FileQuery ¶
type FileQuery struct {
// contains filtered or unexported fields
}
FileQuery is the builder for querying File entities.
func (*FileQuery) Clone ¶
Clone returns a duplicate of the FileQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*FileQuery) First ¶
First returns the first File entity from the query. Returns a *NotFoundError when no File was found.
func (*FileQuery) FirstID ¶
FirstID returns the first File ID from the query. Returns a *NotFoundError when no File ID was found.
func (*FileQuery) GroupBy ¶
func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.File.Query(). GroupBy(file.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*FileQuery) Only ¶
Only returns a single File entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one File entity is not found. Returns a *NotFoundError when no File entities are found.
func (*FileQuery) OnlyID ¶
OnlyID is like Only, but returns the only File ID in the query. Returns a *NotSingularError when exactly one File ID is not found. Returns a *NotFoundError when no entities are found.
func (*FileQuery) QueryChildren ¶
QueryChildren chains the current query on the "children" edge.
func (*FileQuery) QueryParent ¶
QueryParent chains the current query on the "parent" edge.
func (*FileQuery) Select ¶
func (fq *FileQuery) Select(fields ...string) *FileSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.File.Query(). Select(file.FieldName). Scan(ctx, &v)
func (*FileQuery) Unique ¶
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 (*FileQuery) WithChildren ¶
WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.
func (*FileQuery) WithParent ¶
WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.
type FileSelect ¶
type FileSelect struct { *FileQuery // contains filtered or unexported fields }
FileSelect is the builder for selecting fields of File entities.
func (*FileSelect) Bool ¶
func (fs *FileSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*FileSelect) BoolX ¶
func (fs *FileSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*FileSelect) Bools ¶
func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*FileSelect) BoolsX ¶
func (fs *FileSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*FileSelect) Float64 ¶
func (fs *FileSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*FileSelect) Float64X ¶
func (fs *FileSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*FileSelect) Float64s ¶
func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*FileSelect) Float64sX ¶
func (fs *FileSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*FileSelect) Int ¶
func (fs *FileSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*FileSelect) IntX ¶
func (fs *FileSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*FileSelect) Ints ¶
func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*FileSelect) IntsX ¶
func (fs *FileSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*FileSelect) Scan ¶
func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*FileSelect) ScanX ¶
func (fs *FileSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*FileSelect) String ¶
func (fs *FileSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*FileSelect) StringX ¶
func (fs *FileSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type FileUpdate ¶
type FileUpdate struct {
// contains filtered or unexported fields
}
FileUpdate is the builder for updating File entities.
func (*FileUpdate) AddChildIDs ¶
func (fu *FileUpdate) AddChildIDs(ids ...int) *FileUpdate
AddChildIDs adds the "children" edge to the File entity by IDs.
func (*FileUpdate) AddChildren ¶
func (fu *FileUpdate) AddChildren(f ...*File) *FileUpdate
AddChildren adds the "children" edges to the File entity.
func (*FileUpdate) ClearChildren ¶
func (fu *FileUpdate) ClearChildren() *FileUpdate
ClearChildren clears all "children" edges to the File entity.
func (*FileUpdate) ClearParent ¶
func (fu *FileUpdate) ClearParent() *FileUpdate
ClearParent clears the "parent" edge to the File entity.
func (*FileUpdate) ClearParentID ¶
func (fu *FileUpdate) ClearParentID() *FileUpdate
ClearParentID clears the value of the "parent_id" field.
func (*FileUpdate) Exec ¶
func (fu *FileUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*FileUpdate) ExecX ¶
func (fu *FileUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileUpdate) Mutation ¶
func (fu *FileUpdate) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileUpdate) RemoveChildIDs ¶
func (fu *FileUpdate) RemoveChildIDs(ids ...int) *FileUpdate
RemoveChildIDs removes the "children" edge to File entities by IDs.
func (*FileUpdate) RemoveChildren ¶
func (fu *FileUpdate) RemoveChildren(f ...*File) *FileUpdate
RemoveChildren removes "children" edges to File entities.
func (*FileUpdate) Save ¶
func (fu *FileUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*FileUpdate) SaveX ¶
func (fu *FileUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*FileUpdate) SetDeleted ¶
func (fu *FileUpdate) SetDeleted(b bool) *FileUpdate
SetDeleted sets the "deleted" field.
func (*FileUpdate) SetName ¶
func (fu *FileUpdate) SetName(s string) *FileUpdate
SetName sets the "name" field.
func (*FileUpdate) SetNillableDeleted ¶
func (fu *FileUpdate) SetNillableDeleted(b *bool) *FileUpdate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*FileUpdate) SetNillableParentID ¶
func (fu *FileUpdate) SetNillableParentID(i *int) *FileUpdate
SetNillableParentID sets the "parent_id" field if the given value is not nil.
func (*FileUpdate) SetParent ¶
func (fu *FileUpdate) SetParent(f *File) *FileUpdate
SetParent sets the "parent" edge to the File entity.
func (*FileUpdate) SetParentID ¶
func (fu *FileUpdate) SetParentID(i int) *FileUpdate
SetParentID sets the "parent_id" field.
func (*FileUpdate) Where ¶
func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
Where appends a list predicates to the FileUpdate builder.
type FileUpdateOne ¶
type FileUpdateOne struct {
// contains filtered or unexported fields
}
FileUpdateOne is the builder for updating a single File entity.
func (*FileUpdateOne) AddChildIDs ¶
func (fuo *FileUpdateOne) AddChildIDs(ids ...int) *FileUpdateOne
AddChildIDs adds the "children" edge to the File entity by IDs.
func (*FileUpdateOne) AddChildren ¶
func (fuo *FileUpdateOne) AddChildren(f ...*File) *FileUpdateOne
AddChildren adds the "children" edges to the File entity.
func (*FileUpdateOne) ClearChildren ¶
func (fuo *FileUpdateOne) ClearChildren() *FileUpdateOne
ClearChildren clears all "children" edges to the File entity.
func (*FileUpdateOne) ClearParent ¶
func (fuo *FileUpdateOne) ClearParent() *FileUpdateOne
ClearParent clears the "parent" edge to the File entity.
func (*FileUpdateOne) ClearParentID ¶
func (fuo *FileUpdateOne) ClearParentID() *FileUpdateOne
ClearParentID clears the value of the "parent_id" field.
func (*FileUpdateOne) Exec ¶
func (fuo *FileUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*FileUpdateOne) ExecX ¶
func (fuo *FileUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileUpdateOne) Mutation ¶
func (fuo *FileUpdateOne) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileUpdateOne) RemoveChildIDs ¶
func (fuo *FileUpdateOne) RemoveChildIDs(ids ...int) *FileUpdateOne
RemoveChildIDs removes the "children" edge to File entities by IDs.
func (*FileUpdateOne) RemoveChildren ¶
func (fuo *FileUpdateOne) RemoveChildren(f ...*File) *FileUpdateOne
RemoveChildren removes "children" edges to File entities.
func (*FileUpdateOne) Save ¶
func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
Save executes the query and returns the updated File entity.
func (*FileUpdateOne) SaveX ¶
func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
SaveX is like Save, but panics if an error occurs.
func (*FileUpdateOne) Select ¶
func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*FileUpdateOne) SetDeleted ¶
func (fuo *FileUpdateOne) SetDeleted(b bool) *FileUpdateOne
SetDeleted sets the "deleted" field.
func (*FileUpdateOne) SetName ¶
func (fuo *FileUpdateOne) SetName(s string) *FileUpdateOne
SetName sets the "name" field.
func (*FileUpdateOne) SetNillableDeleted ¶
func (fuo *FileUpdateOne) SetNillableDeleted(b *bool) *FileUpdateOne
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*FileUpdateOne) SetNillableParentID ¶
func (fuo *FileUpdateOne) SetNillableParentID(i *int) *FileUpdateOne
SetNillableParentID sets the "parent_id" field if the given value is not nil.
func (*FileUpdateOne) SetParent ¶
func (fuo *FileUpdateOne) SetParent(f *File) *FileUpdateOne
SetParent sets the "parent" edge to the File entity.
func (*FileUpdateOne) SetParentID ¶
func (fuo *FileUpdateOne) SetParentID(i int) *FileUpdateOne
SetParentID sets the "parent_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(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 Tx ¶
type Tx struct { // File is the client for interacting with the File builders. File *FileClient // 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.