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 Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Object
- type ObjectClient
- func (c *ObjectClient) Create() *ObjectCreate
- func (c *ObjectClient) CreateBulk(builders ...*ObjectCreate) *ObjectCreateBulk
- func (c *ObjectClient) Delete() *ObjectDelete
- func (c *ObjectClient) DeleteOne(o *Object) *ObjectDeleteOne
- func (c *ObjectClient) DeleteOneID(id int) *ObjectDeleteOne
- func (c *ObjectClient) Get(ctx context.Context, id int) (*Object, error)
- func (c *ObjectClient) GetX(ctx context.Context, id int) *Object
- func (c *ObjectClient) Hooks() []Hook
- func (c *ObjectClient) Query() *ObjectQuery
- func (c *ObjectClient) Update() *ObjectUpdate
- func (c *ObjectClient) UpdateOne(o *Object) *ObjectUpdateOne
- func (c *ObjectClient) UpdateOneID(id int) *ObjectUpdateOne
- func (c *ObjectClient) Use(hooks ...Hook)
- type ObjectCreate
- func (oc *ObjectCreate) Exec(ctx context.Context) error
- func (oc *ObjectCreate) ExecX(ctx context.Context)
- func (oc *ObjectCreate) Mutation() *ObjectMutation
- func (oc *ObjectCreate) Save(ctx context.Context) (*Object, error)
- func (oc *ObjectCreate) SaveX(ctx context.Context) *Object
- func (oc *ObjectCreate) SetContent(b []byte) *ObjectCreate
- func (oc *ObjectCreate) SetHash(s string) *ObjectCreate
- func (oc *ObjectCreate) SetPackage(s string) *ObjectCreate
- func (oc *ObjectCreate) SetType(i int8) *ObjectCreate
- type ObjectCreateBulk
- type ObjectDelete
- type ObjectDeleteOne
- type ObjectGroupBy
- func (ogb *ObjectGroupBy) Aggregate(fns ...AggregateFunc) *ObjectGroupBy
- func (ogb *ObjectGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (ogb *ObjectGroupBy) BoolX(ctx context.Context) bool
- func (ogb *ObjectGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ogb *ObjectGroupBy) BoolsX(ctx context.Context) []bool
- func (ogb *ObjectGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (ogb *ObjectGroupBy) Float64X(ctx context.Context) float64
- func (ogb *ObjectGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ogb *ObjectGroupBy) Float64sX(ctx context.Context) []float64
- func (ogb *ObjectGroupBy) Int(ctx context.Context) (_ int, err error)
- func (ogb *ObjectGroupBy) IntX(ctx context.Context) int
- func (ogb *ObjectGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ogb *ObjectGroupBy) IntsX(ctx context.Context) []int
- func (ogb *ObjectGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ogb *ObjectGroupBy) ScanX(ctx context.Context, v interface{})
- func (ogb *ObjectGroupBy) String(ctx context.Context) (_ string, err error)
- func (ogb *ObjectGroupBy) StringX(ctx context.Context) string
- func (ogb *ObjectGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ogb *ObjectGroupBy) StringsX(ctx context.Context) []string
- type ObjectMutation
- func (m *ObjectMutation) AddField(name string, value ent.Value) error
- func (m *ObjectMutation) AddType(i int8)
- func (m *ObjectMutation) AddedEdges() []string
- func (m *ObjectMutation) AddedField(name string) (ent.Value, bool)
- func (m *ObjectMutation) AddedFields() []string
- func (m *ObjectMutation) AddedIDs(name string) []ent.Value
- func (m *ObjectMutation) AddedType() (r int8, exists bool)
- func (m *ObjectMutation) ClearEdge(name string) error
- func (m *ObjectMutation) ClearField(name string) error
- func (m *ObjectMutation) ClearedEdges() []string
- func (m *ObjectMutation) ClearedFields() []string
- func (m ObjectMutation) Client() *Client
- func (m *ObjectMutation) Content() (r []byte, exists bool)
- func (m *ObjectMutation) EdgeCleared(name string) bool
- func (m *ObjectMutation) Field(name string) (ent.Value, bool)
- func (m *ObjectMutation) FieldCleared(name string) bool
- func (m *ObjectMutation) Fields() []string
- func (m *ObjectMutation) GetType() (r int8, exists bool)
- func (m *ObjectMutation) Hash() (r string, exists bool)
- func (m *ObjectMutation) ID() (id int, exists bool)
- func (m *ObjectMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ObjectMutation) OldContent(ctx context.Context) (v []byte, err error)
- func (m *ObjectMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ObjectMutation) OldHash(ctx context.Context) (v string, err error)
- func (m *ObjectMutation) OldPackage(ctx context.Context) (v string, err error)
- func (m *ObjectMutation) OldType(ctx context.Context) (v int8, err error)
- func (m *ObjectMutation) Op() Op
- func (m *ObjectMutation) Package() (r string, exists bool)
- func (m *ObjectMutation) RemovedEdges() []string
- func (m *ObjectMutation) RemovedIDs(name string) []ent.Value
- func (m *ObjectMutation) ResetContent()
- func (m *ObjectMutation) ResetEdge(name string) error
- func (m *ObjectMutation) ResetField(name string) error
- func (m *ObjectMutation) ResetHash()
- func (m *ObjectMutation) ResetPackage()
- func (m *ObjectMutation) ResetType()
- func (m *ObjectMutation) SetContent(b []byte)
- func (m *ObjectMutation) SetField(name string, value ent.Value) error
- func (m *ObjectMutation) SetHash(s string)
- func (m *ObjectMutation) SetPackage(s string)
- func (m *ObjectMutation) SetType(i int8)
- func (m ObjectMutation) Tx() (*Tx, error)
- func (m *ObjectMutation) Type() string
- func (m *ObjectMutation) Where(ps ...predicate.Object)
- type ObjectQuery
- func (oq *ObjectQuery) All(ctx context.Context) ([]*Object, error)
- func (oq *ObjectQuery) AllX(ctx context.Context) []*Object
- func (oq *ObjectQuery) Clone() *ObjectQuery
- func (oq *ObjectQuery) Count(ctx context.Context) (int, error)
- func (oq *ObjectQuery) CountX(ctx context.Context) int
- func (oq *ObjectQuery) Exist(ctx context.Context) (bool, error)
- func (oq *ObjectQuery) ExistX(ctx context.Context) bool
- func (oq *ObjectQuery) First(ctx context.Context) (*Object, error)
- func (oq *ObjectQuery) FirstID(ctx context.Context) (id int, err error)
- func (oq *ObjectQuery) FirstIDX(ctx context.Context) int
- func (oq *ObjectQuery) FirstX(ctx context.Context) *Object
- func (oq *ObjectQuery) GroupBy(field string, fields ...string) *ObjectGroupBy
- func (oq *ObjectQuery) IDs(ctx context.Context) ([]int, error)
- func (oq *ObjectQuery) IDsX(ctx context.Context) []int
- func (oq *ObjectQuery) Limit(limit int) *ObjectQuery
- func (oq *ObjectQuery) Offset(offset int) *ObjectQuery
- func (oq *ObjectQuery) Only(ctx context.Context) (*Object, error)
- func (oq *ObjectQuery) OnlyID(ctx context.Context) (id int, err error)
- func (oq *ObjectQuery) OnlyIDX(ctx context.Context) int
- func (oq *ObjectQuery) OnlyX(ctx context.Context) *Object
- func (oq *ObjectQuery) Order(o ...OrderFunc) *ObjectQuery
- func (oq *ObjectQuery) Select(fields ...string) *ObjectSelect
- func (oq *ObjectQuery) Unique(unique bool) *ObjectQuery
- func (oq *ObjectQuery) Where(ps ...predicate.Object) *ObjectQuery
- type ObjectSelect
- func (os *ObjectSelect) Bool(ctx context.Context) (_ bool, err error)
- func (os *ObjectSelect) BoolX(ctx context.Context) bool
- func (os *ObjectSelect) Bools(ctx context.Context) ([]bool, error)
- func (os *ObjectSelect) BoolsX(ctx context.Context) []bool
- func (os *ObjectSelect) Float64(ctx context.Context) (_ float64, err error)
- func (os *ObjectSelect) Float64X(ctx context.Context) float64
- func (os *ObjectSelect) Float64s(ctx context.Context) ([]float64, error)
- func (os *ObjectSelect) Float64sX(ctx context.Context) []float64
- func (os *ObjectSelect) Int(ctx context.Context) (_ int, err error)
- func (os *ObjectSelect) IntX(ctx context.Context) int
- func (os *ObjectSelect) Ints(ctx context.Context) ([]int, error)
- func (os *ObjectSelect) IntsX(ctx context.Context) []int
- func (os *ObjectSelect) Scan(ctx context.Context, v interface{}) error
- func (os *ObjectSelect) ScanX(ctx context.Context, v interface{})
- func (os *ObjectSelect) String(ctx context.Context) (_ string, err error)
- func (os *ObjectSelect) StringX(ctx context.Context) string
- func (os *ObjectSelect) Strings(ctx context.Context) ([]string, error)
- func (os *ObjectSelect) StringsX(ctx context.Context) []string
- type ObjectUpdate
- func (ou *ObjectUpdate) AddType(i int8) *ObjectUpdate
- func (ou *ObjectUpdate) Exec(ctx context.Context) error
- func (ou *ObjectUpdate) ExecX(ctx context.Context)
- func (ou *ObjectUpdate) Mutation() *ObjectMutation
- func (ou *ObjectUpdate) Save(ctx context.Context) (int, error)
- func (ou *ObjectUpdate) SaveX(ctx context.Context) int
- func (ou *ObjectUpdate) SetContent(b []byte) *ObjectUpdate
- func (ou *ObjectUpdate) SetHash(s string) *ObjectUpdate
- func (ou *ObjectUpdate) SetPackage(s string) *ObjectUpdate
- func (ou *ObjectUpdate) SetType(i int8) *ObjectUpdate
- func (ou *ObjectUpdate) Where(ps ...predicate.Object) *ObjectUpdate
- type ObjectUpdateOne
- func (ouo *ObjectUpdateOne) AddType(i int8) *ObjectUpdateOne
- func (ouo *ObjectUpdateOne) Exec(ctx context.Context) error
- func (ouo *ObjectUpdateOne) ExecX(ctx context.Context)
- func (ouo *ObjectUpdateOne) Mutation() *ObjectMutation
- func (ouo *ObjectUpdateOne) Save(ctx context.Context) (*Object, error)
- func (ouo *ObjectUpdateOne) SaveX(ctx context.Context) *Object
- func (ouo *ObjectUpdateOne) Select(field string, fields ...string) *ObjectUpdateOne
- func (ouo *ObjectUpdateOne) SetContent(b []byte) *ObjectUpdateOne
- func (ouo *ObjectUpdateOne) SetHash(s string) *ObjectUpdateOne
- func (ouo *ObjectUpdateOne) SetPackage(s string) *ObjectUpdateOne
- func (ouo *ObjectUpdateOne) SetType(i int8) *ObjectUpdateOne
- type Objects
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type Reference
- type ReferenceClient
- func (c *ReferenceClient) Create() *ReferenceCreate
- func (c *ReferenceClient) CreateBulk(builders ...*ReferenceCreate) *ReferenceCreateBulk
- func (c *ReferenceClient) Delete() *ReferenceDelete
- func (c *ReferenceClient) DeleteOne(r *Reference) *ReferenceDeleteOne
- func (c *ReferenceClient) DeleteOneID(id int) *ReferenceDeleteOne
- func (c *ReferenceClient) Get(ctx context.Context, id int) (*Reference, error)
- func (c *ReferenceClient) GetX(ctx context.Context, id int) *Reference
- func (c *ReferenceClient) Hooks() []Hook
- func (c *ReferenceClient) Query() *ReferenceQuery
- func (c *ReferenceClient) Update() *ReferenceUpdate
- func (c *ReferenceClient) UpdateOne(r *Reference) *ReferenceUpdateOne
- func (c *ReferenceClient) UpdateOneID(id int) *ReferenceUpdateOne
- func (c *ReferenceClient) Use(hooks ...Hook)
- type ReferenceCreate
- func (rc *ReferenceCreate) Exec(ctx context.Context) error
- func (rc *ReferenceCreate) ExecX(ctx context.Context)
- func (rc *ReferenceCreate) Mutation() *ReferenceMutation
- func (rc *ReferenceCreate) Save(ctx context.Context) (*Reference, error)
- func (rc *ReferenceCreate) SaveX(ctx context.Context) *Reference
- func (rc *ReferenceCreate) SetHash(s string) *ReferenceCreate
- func (rc *ReferenceCreate) SetPackage(s string) *ReferenceCreate
- func (rc *ReferenceCreate) SetRef(s string) *ReferenceCreate
- type ReferenceCreateBulk
- type ReferenceDelete
- type ReferenceDeleteOne
- type ReferenceGroupBy
- func (rgb *ReferenceGroupBy) Aggregate(fns ...AggregateFunc) *ReferenceGroupBy
- func (rgb *ReferenceGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (rgb *ReferenceGroupBy) BoolX(ctx context.Context) bool
- func (rgb *ReferenceGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (rgb *ReferenceGroupBy) BoolsX(ctx context.Context) []bool
- func (rgb *ReferenceGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (rgb *ReferenceGroupBy) Float64X(ctx context.Context) float64
- func (rgb *ReferenceGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (rgb *ReferenceGroupBy) Float64sX(ctx context.Context) []float64
- func (rgb *ReferenceGroupBy) Int(ctx context.Context) (_ int, err error)
- func (rgb *ReferenceGroupBy) IntX(ctx context.Context) int
- func (rgb *ReferenceGroupBy) Ints(ctx context.Context) ([]int, error)
- func (rgb *ReferenceGroupBy) IntsX(ctx context.Context) []int
- func (rgb *ReferenceGroupBy) Scan(ctx context.Context, v interface{}) error
- func (rgb *ReferenceGroupBy) ScanX(ctx context.Context, v interface{})
- func (rgb *ReferenceGroupBy) String(ctx context.Context) (_ string, err error)
- func (rgb *ReferenceGroupBy) StringX(ctx context.Context) string
- func (rgb *ReferenceGroupBy) Strings(ctx context.Context) ([]string, error)
- func (rgb *ReferenceGroupBy) StringsX(ctx context.Context) []string
- type ReferenceMutation
- func (m *ReferenceMutation) AddField(name string, value ent.Value) error
- func (m *ReferenceMutation) AddedEdges() []string
- func (m *ReferenceMutation) AddedField(name string) (ent.Value, bool)
- func (m *ReferenceMutation) AddedFields() []string
- func (m *ReferenceMutation) AddedIDs(name string) []ent.Value
- func (m *ReferenceMutation) ClearEdge(name string) error
- func (m *ReferenceMutation) ClearField(name string) error
- func (m *ReferenceMutation) ClearedEdges() []string
- func (m *ReferenceMutation) ClearedFields() []string
- func (m ReferenceMutation) Client() *Client
- func (m *ReferenceMutation) EdgeCleared(name string) bool
- func (m *ReferenceMutation) Field(name string) (ent.Value, bool)
- func (m *ReferenceMutation) FieldCleared(name string) bool
- func (m *ReferenceMutation) Fields() []string
- func (m *ReferenceMutation) Hash() (r string, exists bool)
- func (m *ReferenceMutation) ID() (id int, exists bool)
- func (m *ReferenceMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ReferenceMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ReferenceMutation) OldHash(ctx context.Context) (v string, err error)
- func (m *ReferenceMutation) OldPackage(ctx context.Context) (v string, err error)
- func (m *ReferenceMutation) OldRef(ctx context.Context) (v string, err error)
- func (m *ReferenceMutation) Op() Op
- func (m *ReferenceMutation) Package() (r string, exists bool)
- func (m *ReferenceMutation) Ref() (r string, exists bool)
- func (m *ReferenceMutation) RemovedEdges() []string
- func (m *ReferenceMutation) RemovedIDs(name string) []ent.Value
- func (m *ReferenceMutation) ResetEdge(name string) error
- func (m *ReferenceMutation) ResetField(name string) error
- func (m *ReferenceMutation) ResetHash()
- func (m *ReferenceMutation) ResetPackage()
- func (m *ReferenceMutation) ResetRef()
- func (m *ReferenceMutation) SetField(name string, value ent.Value) error
- func (m *ReferenceMutation) SetHash(s string)
- func (m *ReferenceMutation) SetPackage(s string)
- func (m *ReferenceMutation) SetRef(s string)
- func (m ReferenceMutation) Tx() (*Tx, error)
- func (m *ReferenceMutation) Type() string
- func (m *ReferenceMutation) Where(ps ...predicate.Reference)
- type ReferenceQuery
- func (rq *ReferenceQuery) All(ctx context.Context) ([]*Reference, error)
- func (rq *ReferenceQuery) AllX(ctx context.Context) []*Reference
- func (rq *ReferenceQuery) Clone() *ReferenceQuery
- func (rq *ReferenceQuery) Count(ctx context.Context) (int, error)
- func (rq *ReferenceQuery) CountX(ctx context.Context) int
- func (rq *ReferenceQuery) Exist(ctx context.Context) (bool, error)
- func (rq *ReferenceQuery) ExistX(ctx context.Context) bool
- func (rq *ReferenceQuery) First(ctx context.Context) (*Reference, error)
- func (rq *ReferenceQuery) FirstID(ctx context.Context) (id int, err error)
- func (rq *ReferenceQuery) FirstIDX(ctx context.Context) int
- func (rq *ReferenceQuery) FirstX(ctx context.Context) *Reference
- func (rq *ReferenceQuery) GroupBy(field string, fields ...string) *ReferenceGroupBy
- func (rq *ReferenceQuery) IDs(ctx context.Context) ([]int, error)
- func (rq *ReferenceQuery) IDsX(ctx context.Context) []int
- func (rq *ReferenceQuery) Limit(limit int) *ReferenceQuery
- func (rq *ReferenceQuery) Offset(offset int) *ReferenceQuery
- func (rq *ReferenceQuery) Only(ctx context.Context) (*Reference, error)
- func (rq *ReferenceQuery) OnlyID(ctx context.Context) (id int, err error)
- func (rq *ReferenceQuery) OnlyIDX(ctx context.Context) int
- func (rq *ReferenceQuery) OnlyX(ctx context.Context) *Reference
- func (rq *ReferenceQuery) Order(o ...OrderFunc) *ReferenceQuery
- func (rq *ReferenceQuery) Select(fields ...string) *ReferenceSelect
- func (rq *ReferenceQuery) Unique(unique bool) *ReferenceQuery
- func (rq *ReferenceQuery) Where(ps ...predicate.Reference) *ReferenceQuery
- type ReferenceSelect
- func (rs *ReferenceSelect) Bool(ctx context.Context) (_ bool, err error)
- func (rs *ReferenceSelect) BoolX(ctx context.Context) bool
- func (rs *ReferenceSelect) Bools(ctx context.Context) ([]bool, error)
- func (rs *ReferenceSelect) BoolsX(ctx context.Context) []bool
- func (rs *ReferenceSelect) Float64(ctx context.Context) (_ float64, err error)
- func (rs *ReferenceSelect) Float64X(ctx context.Context) float64
- func (rs *ReferenceSelect) Float64s(ctx context.Context) ([]float64, error)
- func (rs *ReferenceSelect) Float64sX(ctx context.Context) []float64
- func (rs *ReferenceSelect) Int(ctx context.Context) (_ int, err error)
- func (rs *ReferenceSelect) IntX(ctx context.Context) int
- func (rs *ReferenceSelect) Ints(ctx context.Context) ([]int, error)
- func (rs *ReferenceSelect) IntsX(ctx context.Context) []int
- func (rs *ReferenceSelect) Scan(ctx context.Context, v interface{}) error
- func (rs *ReferenceSelect) ScanX(ctx context.Context, v interface{})
- func (rs *ReferenceSelect) String(ctx context.Context) (_ string, err error)
- func (rs *ReferenceSelect) StringX(ctx context.Context) string
- func (rs *ReferenceSelect) Strings(ctx context.Context) ([]string, error)
- func (rs *ReferenceSelect) StringsX(ctx context.Context) []string
- type ReferenceUpdate
- func (ru *ReferenceUpdate) Exec(ctx context.Context) error
- func (ru *ReferenceUpdate) ExecX(ctx context.Context)
- func (ru *ReferenceUpdate) Mutation() *ReferenceMutation
- func (ru *ReferenceUpdate) Save(ctx context.Context) (int, error)
- func (ru *ReferenceUpdate) SaveX(ctx context.Context) int
- func (ru *ReferenceUpdate) SetHash(s string) *ReferenceUpdate
- func (ru *ReferenceUpdate) SetPackage(s string) *ReferenceUpdate
- func (ru *ReferenceUpdate) SetRef(s string) *ReferenceUpdate
- func (ru *ReferenceUpdate) Where(ps ...predicate.Reference) *ReferenceUpdate
- type ReferenceUpdateOne
- func (ruo *ReferenceUpdateOne) Exec(ctx context.Context) error
- func (ruo *ReferenceUpdateOne) ExecX(ctx context.Context)
- func (ruo *ReferenceUpdateOne) Mutation() *ReferenceMutation
- func (ruo *ReferenceUpdateOne) Save(ctx context.Context) (*Reference, error)
- func (ruo *ReferenceUpdateOne) SaveX(ctx context.Context) *Reference
- func (ruo *ReferenceUpdateOne) Select(field string, fields ...string) *ReferenceUpdateOne
- func (ruo *ReferenceUpdateOne) SetHash(s string) *ReferenceUpdateOne
- func (ruo *ReferenceUpdateOne) SetPackage(s string) *ReferenceUpdateOne
- func (ruo *ReferenceUpdateOne) SetRef(s string) *ReferenceUpdateOne
- type References
- 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. TypeObject = "Object" TypeReference = "Reference" )
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
// Object is the client for interacting with the Object builders.
Object *ObjectClient
// Reference is the client for interacting with the Reference builders.
Reference *ReferenceClient
// 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(). Object. 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 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 Object ¶
type Object struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Package holds the value of the "package" field.
Package string `json:"package,omitempty"`
// Type holds the value of the "type" field.
Type int8 `json:"type,omitempty"`
// Hash holds the value of the "hash" field.
Hash string `json:"hash,omitempty"`
// Content holds the value of the "content" field.
Content []byte `json:"content,omitempty"`
// contains filtered or unexported fields
}
Object is the model entity for the Object schema.
func (*Object) Unwrap ¶
Unwrap unwraps the Object 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 (*Object) Update ¶
func (o *Object) Update() *ObjectUpdateOne
Update returns a builder for updating this Object. Note that you need to call Object.Unwrap() before calling this method if this Object was returned from a transaction, and the transaction was committed or rolled back.
type ObjectClient ¶
type ObjectClient struct {
// contains filtered or unexported fields
}
ObjectClient is a client for the Object schema.
func NewObjectClient ¶
func NewObjectClient(c config) *ObjectClient
NewObjectClient returns a client for the Object from the given config.
func (*ObjectClient) Create ¶
func (c *ObjectClient) Create() *ObjectCreate
Create returns a create builder for Object.
func (*ObjectClient) CreateBulk ¶
func (c *ObjectClient) CreateBulk(builders ...*ObjectCreate) *ObjectCreateBulk
CreateBulk returns a builder for creating a bulk of Object entities.
func (*ObjectClient) Delete ¶
func (c *ObjectClient) Delete() *ObjectDelete
Delete returns a delete builder for Object.
func (*ObjectClient) DeleteOne ¶
func (c *ObjectClient) DeleteOne(o *Object) *ObjectDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ObjectClient) DeleteOneID ¶
func (c *ObjectClient) DeleteOneID(id int) *ObjectDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ObjectClient) GetX ¶
func (c *ObjectClient) GetX(ctx context.Context, id int) *Object
GetX is like Get, but panics if an error occurs.
func (*ObjectClient) Query ¶
func (c *ObjectClient) Query() *ObjectQuery
Query returns a query builder for Object.
func (*ObjectClient) Update ¶
func (c *ObjectClient) Update() *ObjectUpdate
Update returns an update builder for Object.
func (*ObjectClient) UpdateOne ¶
func (c *ObjectClient) UpdateOne(o *Object) *ObjectUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ObjectClient) UpdateOneID ¶
func (c *ObjectClient) UpdateOneID(id int) *ObjectUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ObjectClient) Use ¶
func (c *ObjectClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `object.Hooks(f(g(h())))`.
type ObjectCreate ¶
type ObjectCreate struct {
// contains filtered or unexported fields
}
ObjectCreate is the builder for creating a Object entity.
func (*ObjectCreate) Exec ¶
func (oc *ObjectCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ObjectCreate) ExecX ¶
func (oc *ObjectCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ObjectCreate) Mutation ¶
func (oc *ObjectCreate) Mutation() *ObjectMutation
Mutation returns the ObjectMutation object of the builder.
func (*ObjectCreate) Save ¶
func (oc *ObjectCreate) Save(ctx context.Context) (*Object, error)
Save creates the Object in the database.
func (*ObjectCreate) SaveX ¶
func (oc *ObjectCreate) SaveX(ctx context.Context) *Object
SaveX calls Save and panics if Save returns an error.
func (*ObjectCreate) SetContent ¶
func (oc *ObjectCreate) SetContent(b []byte) *ObjectCreate
SetContent sets the "content" field.
func (*ObjectCreate) SetHash ¶
func (oc *ObjectCreate) SetHash(s string) *ObjectCreate
SetHash sets the "hash" field.
func (*ObjectCreate) SetPackage ¶
func (oc *ObjectCreate) SetPackage(s string) *ObjectCreate
SetPackage sets the "package" field.
func (*ObjectCreate) SetType ¶
func (oc *ObjectCreate) SetType(i int8) *ObjectCreate
SetType sets the "type" field.
type ObjectCreateBulk ¶
type ObjectCreateBulk struct {
// contains filtered or unexported fields
}
ObjectCreateBulk is the builder for creating many Object entities in bulk.
func (*ObjectCreateBulk) Exec ¶
func (ocb *ObjectCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ObjectCreateBulk) ExecX ¶
func (ocb *ObjectCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ObjectDelete ¶
type ObjectDelete struct {
// contains filtered or unexported fields
}
ObjectDelete is the builder for deleting a Object entity.
func (*ObjectDelete) Exec ¶
func (od *ObjectDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ObjectDelete) ExecX ¶
func (od *ObjectDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ObjectDelete) Where ¶
func (od *ObjectDelete) Where(ps ...predicate.Object) *ObjectDelete
Where appends a list predicates to the ObjectDelete builder.
type ObjectDeleteOne ¶
type ObjectDeleteOne struct {
// contains filtered or unexported fields
}
ObjectDeleteOne is the builder for deleting a single Object entity.
func (*ObjectDeleteOne) Exec ¶
func (odo *ObjectDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ObjectDeleteOne) ExecX ¶
func (odo *ObjectDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ObjectGroupBy ¶
type ObjectGroupBy struct {
// contains filtered or unexported fields
}
ObjectGroupBy is the group-by builder for Object entities.
func (*ObjectGroupBy) Aggregate ¶
func (ogb *ObjectGroupBy) Aggregate(fns ...AggregateFunc) *ObjectGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ObjectGroupBy) Bool ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) BoolX ¶
func (ogb *ObjectGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ObjectGroupBy) Bools ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) BoolsX ¶
func (ogb *ObjectGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ObjectGroupBy) Float64 ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) Float64X ¶
func (ogb *ObjectGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ObjectGroupBy) Float64s ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) Float64sX ¶
func (ogb *ObjectGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ObjectGroupBy) Int ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) IntX ¶
func (ogb *ObjectGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ObjectGroupBy) Ints ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) IntsX ¶
func (ogb *ObjectGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ObjectGroupBy) Scan ¶
func (ogb *ObjectGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ObjectGroupBy) ScanX ¶
func (ogb *ObjectGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ObjectGroupBy) String ¶
func (ogb *ObjectGroupBy) 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 (*ObjectGroupBy) StringX ¶
func (ogb *ObjectGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ObjectMutation ¶
type ObjectMutation struct {
// contains filtered or unexported fields
}
ObjectMutation represents an operation that mutates the Object nodes in the graph.
func (*ObjectMutation) AddField ¶
func (m *ObjectMutation) 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 (*ObjectMutation) AddType ¶
func (m *ObjectMutation) AddType(i int8)
AddType adds i to the "type" field.
func (*ObjectMutation) AddedEdges ¶
func (m *ObjectMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ObjectMutation) AddedField ¶
func (m *ObjectMutation) 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 (*ObjectMutation) AddedFields ¶
func (m *ObjectMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ObjectMutation) AddedIDs ¶
func (m *ObjectMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ObjectMutation) AddedType ¶
func (m *ObjectMutation) AddedType() (r int8, exists bool)
AddedType returns the value that was added to the "type" field in this mutation.
func (*ObjectMutation) ClearEdge ¶
func (m *ObjectMutation) 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 (*ObjectMutation) ClearField ¶
func (m *ObjectMutation) 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 (*ObjectMutation) ClearedEdges ¶
func (m *ObjectMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ObjectMutation) ClearedFields ¶
func (m *ObjectMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ObjectMutation) Client ¶
func (m ObjectMutation) 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 (*ObjectMutation) Content ¶
func (m *ObjectMutation) Content() (r []byte, exists bool)
Content returns the value of the "content" field in the mutation.
func (*ObjectMutation) EdgeCleared ¶
func (m *ObjectMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ObjectMutation) Field ¶
func (m *ObjectMutation) 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 (*ObjectMutation) FieldCleared ¶
func (m *ObjectMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ObjectMutation) Fields ¶
func (m *ObjectMutation) 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 (*ObjectMutation) GetType ¶
func (m *ObjectMutation) GetType() (r int8, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*ObjectMutation) Hash ¶
func (m *ObjectMutation) Hash() (r string, exists bool)
Hash returns the value of the "hash" field in the mutation.
func (*ObjectMutation) ID ¶
func (m *ObjectMutation) 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 (*ObjectMutation) IDs ¶
func (m *ObjectMutation) 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 (*ObjectMutation) OldContent ¶
func (m *ObjectMutation) OldContent(ctx context.Context) (v []byte, err error)
OldContent returns the old "content" field's value of the Object entity. If the Object 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 (*ObjectMutation) 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 (*ObjectMutation) OldHash ¶
func (m *ObjectMutation) OldHash(ctx context.Context) (v string, err error)
OldHash returns the old "hash" field's value of the Object entity. If the Object 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 (*ObjectMutation) OldPackage ¶
func (m *ObjectMutation) OldPackage(ctx context.Context) (v string, err error)
OldPackage returns the old "package" field's value of the Object entity. If the Object 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 (*ObjectMutation) OldType ¶
func (m *ObjectMutation) OldType(ctx context.Context) (v int8, err error)
OldType returns the old "type" field's value of the Object entity. If the Object 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 (*ObjectMutation) Package ¶
func (m *ObjectMutation) Package() (r string, exists bool)
Package returns the value of the "package" field in the mutation.
func (*ObjectMutation) RemovedEdges ¶
func (m *ObjectMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ObjectMutation) RemovedIDs ¶
func (m *ObjectMutation) 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 (*ObjectMutation) ResetContent ¶
func (m *ObjectMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*ObjectMutation) ResetEdge ¶
func (m *ObjectMutation) 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 (*ObjectMutation) ResetField ¶
func (m *ObjectMutation) 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 (*ObjectMutation) ResetHash ¶
func (m *ObjectMutation) ResetHash()
ResetHash resets all changes to the "hash" field.
func (*ObjectMutation) ResetPackage ¶
func (m *ObjectMutation) ResetPackage()
ResetPackage resets all changes to the "package" field.
func (*ObjectMutation) ResetType ¶
func (m *ObjectMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*ObjectMutation) SetContent ¶
func (m *ObjectMutation) SetContent(b []byte)
SetContent sets the "content" field.
func (*ObjectMutation) SetField ¶
func (m *ObjectMutation) 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 (*ObjectMutation) SetHash ¶
func (m *ObjectMutation) SetHash(s string)
SetHash sets the "hash" field.
func (*ObjectMutation) SetPackage ¶
func (m *ObjectMutation) SetPackage(s string)
SetPackage sets the "package" field.
func (*ObjectMutation) SetType ¶
func (m *ObjectMutation) SetType(i int8)
SetType sets the "type" field.
func (ObjectMutation) Tx ¶
func (m ObjectMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ObjectMutation) Type ¶
func (m *ObjectMutation) Type() string
Type returns the node type of this mutation (Object).
func (*ObjectMutation) Where ¶
func (m *ObjectMutation) Where(ps ...predicate.Object)
Where appends a list predicates to the ObjectMutation builder.
type ObjectQuery ¶
type ObjectQuery struct {
// contains filtered or unexported fields
}
ObjectQuery is the builder for querying Object entities.
func (*ObjectQuery) All ¶
func (oq *ObjectQuery) All(ctx context.Context) ([]*Object, error)
All executes the query and returns a list of Objects.
func (*ObjectQuery) AllX ¶
func (oq *ObjectQuery) AllX(ctx context.Context) []*Object
AllX is like All, but panics if an error occurs.
func (*ObjectQuery) Clone ¶
func (oq *ObjectQuery) Clone() *ObjectQuery
Clone returns a duplicate of the ObjectQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ObjectQuery) Count ¶
func (oq *ObjectQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ObjectQuery) CountX ¶
func (oq *ObjectQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ObjectQuery) Exist ¶
func (oq *ObjectQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ObjectQuery) ExistX ¶
func (oq *ObjectQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ObjectQuery) First ¶
func (oq *ObjectQuery) First(ctx context.Context) (*Object, error)
First returns the first Object entity from the query. Returns a *NotFoundError when no Object was found.
func (*ObjectQuery) FirstID ¶
func (oq *ObjectQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Object ID from the query. Returns a *NotFoundError when no Object ID was found.
func (*ObjectQuery) FirstIDX ¶
func (oq *ObjectQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*ObjectQuery) FirstX ¶
func (oq *ObjectQuery) FirstX(ctx context.Context) *Object
FirstX is like First, but panics if an error occurs.
func (*ObjectQuery) GroupBy ¶
func (oq *ObjectQuery) GroupBy(field string, fields ...string) *ObjectGroupBy
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 {
Package string `json:"package,omitempty"`
Count int `json:"count,omitempty"`
}
client.Object.Query().
GroupBy(object.FieldPackage).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*ObjectQuery) IDs ¶
func (oq *ObjectQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Object IDs.
func (*ObjectQuery) IDsX ¶
func (oq *ObjectQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ObjectQuery) Limit ¶
func (oq *ObjectQuery) Limit(limit int) *ObjectQuery
Limit adds a limit step to the query.
func (*ObjectQuery) Offset ¶
func (oq *ObjectQuery) Offset(offset int) *ObjectQuery
Offset adds an offset step to the query.
func (*ObjectQuery) Only ¶
func (oq *ObjectQuery) Only(ctx context.Context) (*Object, error)
Only returns a single Object entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Object entity is not found. Returns a *NotFoundError when no Object entities are found.
func (*ObjectQuery) OnlyID ¶
func (oq *ObjectQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Object ID in the query. Returns a *NotSingularError when exactly one Object ID is not found. Returns a *NotFoundError when no entities are found.
func (*ObjectQuery) OnlyIDX ¶
func (oq *ObjectQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ObjectQuery) OnlyX ¶
func (oq *ObjectQuery) OnlyX(ctx context.Context) *Object
OnlyX is like Only, but panics if an error occurs.
func (*ObjectQuery) Order ¶
func (oq *ObjectQuery) Order(o ...OrderFunc) *ObjectQuery
Order adds an order step to the query.
func (*ObjectQuery) Select ¶
func (oq *ObjectQuery) Select(fields ...string) *ObjectSelect
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 {
Package string `json:"package,omitempty"`
}
client.Object.Query().
Select(object.FieldPackage).
Scan(ctx, &v)
func (*ObjectQuery) Unique ¶
func (oq *ObjectQuery) Unique(unique bool) *ObjectQuery
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 (*ObjectQuery) Where ¶
func (oq *ObjectQuery) Where(ps ...predicate.Object) *ObjectQuery
Where adds a new predicate for the ObjectQuery builder.
type ObjectSelect ¶
type ObjectSelect struct {
*ObjectQuery
// contains filtered or unexported fields
}
ObjectSelect is the builder for selecting fields of Object entities.
func (*ObjectSelect) Bool ¶
func (os *ObjectSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) BoolX ¶
func (os *ObjectSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ObjectSelect) Bools ¶
func (os *ObjectSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) BoolsX ¶
func (os *ObjectSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ObjectSelect) Float64 ¶
func (os *ObjectSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) Float64X ¶
func (os *ObjectSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ObjectSelect) Float64s ¶
func (os *ObjectSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) Float64sX ¶
func (os *ObjectSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ObjectSelect) Int ¶
func (os *ObjectSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) IntX ¶
func (os *ObjectSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ObjectSelect) Ints ¶
func (os *ObjectSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) IntsX ¶
func (os *ObjectSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ObjectSelect) Scan ¶
func (os *ObjectSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ObjectSelect) ScanX ¶
func (os *ObjectSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ObjectSelect) String ¶
func (os *ObjectSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ObjectSelect) StringX ¶
func (os *ObjectSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ObjectUpdate ¶
type ObjectUpdate struct {
// contains filtered or unexported fields
}
ObjectUpdate is the builder for updating Object entities.
func (*ObjectUpdate) AddType ¶
func (ou *ObjectUpdate) AddType(i int8) *ObjectUpdate
AddType adds i to the "type" field.
func (*ObjectUpdate) Exec ¶
func (ou *ObjectUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ObjectUpdate) ExecX ¶
func (ou *ObjectUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ObjectUpdate) Mutation ¶
func (ou *ObjectUpdate) Mutation() *ObjectMutation
Mutation returns the ObjectMutation object of the builder.
func (*ObjectUpdate) Save ¶
func (ou *ObjectUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ObjectUpdate) SaveX ¶
func (ou *ObjectUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ObjectUpdate) SetContent ¶
func (ou *ObjectUpdate) SetContent(b []byte) *ObjectUpdate
SetContent sets the "content" field.
func (*ObjectUpdate) SetHash ¶
func (ou *ObjectUpdate) SetHash(s string) *ObjectUpdate
SetHash sets the "hash" field.
func (*ObjectUpdate) SetPackage ¶
func (ou *ObjectUpdate) SetPackage(s string) *ObjectUpdate
SetPackage sets the "package" field.
func (*ObjectUpdate) SetType ¶
func (ou *ObjectUpdate) SetType(i int8) *ObjectUpdate
SetType sets the "type" field.
func (*ObjectUpdate) Where ¶
func (ou *ObjectUpdate) Where(ps ...predicate.Object) *ObjectUpdate
Where appends a list predicates to the ObjectUpdate builder.
type ObjectUpdateOne ¶
type ObjectUpdateOne struct {
// contains filtered or unexported fields
}
ObjectUpdateOne is the builder for updating a single Object entity.
func (*ObjectUpdateOne) AddType ¶
func (ouo *ObjectUpdateOne) AddType(i int8) *ObjectUpdateOne
AddType adds i to the "type" field.
func (*ObjectUpdateOne) Exec ¶
func (ouo *ObjectUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ObjectUpdateOne) ExecX ¶
func (ouo *ObjectUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ObjectUpdateOne) Mutation ¶
func (ouo *ObjectUpdateOne) Mutation() *ObjectMutation
Mutation returns the ObjectMutation object of the builder.
func (*ObjectUpdateOne) Save ¶
func (ouo *ObjectUpdateOne) Save(ctx context.Context) (*Object, error)
Save executes the query and returns the updated Object entity.
func (*ObjectUpdateOne) SaveX ¶
func (ouo *ObjectUpdateOne) SaveX(ctx context.Context) *Object
SaveX is like Save, but panics if an error occurs.
func (*ObjectUpdateOne) Select ¶
func (ouo *ObjectUpdateOne) Select(field string, fields ...string) *ObjectUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ObjectUpdateOne) SetContent ¶
func (ouo *ObjectUpdateOne) SetContent(b []byte) *ObjectUpdateOne
SetContent sets the "content" field.
func (*ObjectUpdateOne) SetHash ¶
func (ouo *ObjectUpdateOne) SetHash(s string) *ObjectUpdateOne
SetHash sets the "hash" field.
func (*ObjectUpdateOne) SetPackage ¶
func (ouo *ObjectUpdateOne) SetPackage(s string) *ObjectUpdateOne
SetPackage sets the "package" field.
func (*ObjectUpdateOne) SetType ¶
func (ouo *ObjectUpdateOne) SetType(i int8) *ObjectUpdateOne
SetType sets the "type" field.
type Reference ¶
type Reference struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Package holds the value of the "package" field.
Package string `json:"package,omitempty"`
// Ref holds the value of the "ref" field.
Ref string `json:"ref,omitempty"`
// Hash holds the value of the "hash" field.
Hash string `json:"hash,omitempty"`
// contains filtered or unexported fields
}
Reference is the model entity for the Reference schema.
func (*Reference) Unwrap ¶
Unwrap unwraps the Reference 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 (*Reference) Update ¶
func (r *Reference) Update() *ReferenceUpdateOne
Update returns a builder for updating this Reference. Note that you need to call Reference.Unwrap() before calling this method if this Reference was returned from a transaction, and the transaction was committed or rolled back.
type ReferenceClient ¶
type ReferenceClient struct {
// contains filtered or unexported fields
}
ReferenceClient is a client for the Reference schema.
func NewReferenceClient ¶
func NewReferenceClient(c config) *ReferenceClient
NewReferenceClient returns a client for the Reference from the given config.
func (*ReferenceClient) Create ¶
func (c *ReferenceClient) Create() *ReferenceCreate
Create returns a create builder for Reference.
func (*ReferenceClient) CreateBulk ¶
func (c *ReferenceClient) CreateBulk(builders ...*ReferenceCreate) *ReferenceCreateBulk
CreateBulk returns a builder for creating a bulk of Reference entities.
func (*ReferenceClient) Delete ¶
func (c *ReferenceClient) Delete() *ReferenceDelete
Delete returns a delete builder for Reference.
func (*ReferenceClient) DeleteOne ¶
func (c *ReferenceClient) DeleteOne(r *Reference) *ReferenceDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ReferenceClient) DeleteOneID ¶
func (c *ReferenceClient) DeleteOneID(id int) *ReferenceDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ReferenceClient) GetX ¶
func (c *ReferenceClient) GetX(ctx context.Context, id int) *Reference
GetX is like Get, but panics if an error occurs.
func (*ReferenceClient) Hooks ¶
func (c *ReferenceClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ReferenceClient) Query ¶
func (c *ReferenceClient) Query() *ReferenceQuery
Query returns a query builder for Reference.
func (*ReferenceClient) Update ¶
func (c *ReferenceClient) Update() *ReferenceUpdate
Update returns an update builder for Reference.
func (*ReferenceClient) UpdateOne ¶
func (c *ReferenceClient) UpdateOne(r *Reference) *ReferenceUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ReferenceClient) UpdateOneID ¶
func (c *ReferenceClient) UpdateOneID(id int) *ReferenceUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ReferenceClient) Use ¶
func (c *ReferenceClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `reference.Hooks(f(g(h())))`.
type ReferenceCreate ¶
type ReferenceCreate struct {
// contains filtered or unexported fields
}
ReferenceCreate is the builder for creating a Reference entity.
func (*ReferenceCreate) Exec ¶
func (rc *ReferenceCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ReferenceCreate) ExecX ¶
func (rc *ReferenceCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ReferenceCreate) Mutation ¶
func (rc *ReferenceCreate) Mutation() *ReferenceMutation
Mutation returns the ReferenceMutation object of the builder.
func (*ReferenceCreate) Save ¶
func (rc *ReferenceCreate) Save(ctx context.Context) (*Reference, error)
Save creates the Reference in the database.
func (*ReferenceCreate) SaveX ¶
func (rc *ReferenceCreate) SaveX(ctx context.Context) *Reference
SaveX calls Save and panics if Save returns an error.
func (*ReferenceCreate) SetHash ¶
func (rc *ReferenceCreate) SetHash(s string) *ReferenceCreate
SetHash sets the "hash" field.
func (*ReferenceCreate) SetPackage ¶
func (rc *ReferenceCreate) SetPackage(s string) *ReferenceCreate
SetPackage sets the "package" field.
func (*ReferenceCreate) SetRef ¶
func (rc *ReferenceCreate) SetRef(s string) *ReferenceCreate
SetRef sets the "ref" field.
type ReferenceCreateBulk ¶
type ReferenceCreateBulk struct {
// contains filtered or unexported fields
}
ReferenceCreateBulk is the builder for creating many Reference entities in bulk.
func (*ReferenceCreateBulk) Exec ¶
func (rcb *ReferenceCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ReferenceCreateBulk) ExecX ¶
func (rcb *ReferenceCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ReferenceDelete ¶
type ReferenceDelete struct {
// contains filtered or unexported fields
}
ReferenceDelete is the builder for deleting a Reference entity.
func (*ReferenceDelete) Exec ¶
func (rd *ReferenceDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ReferenceDelete) ExecX ¶
func (rd *ReferenceDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ReferenceDelete) Where ¶
func (rd *ReferenceDelete) Where(ps ...predicate.Reference) *ReferenceDelete
Where appends a list predicates to the ReferenceDelete builder.
type ReferenceDeleteOne ¶
type ReferenceDeleteOne struct {
// contains filtered or unexported fields
}
ReferenceDeleteOne is the builder for deleting a single Reference entity.
func (*ReferenceDeleteOne) Exec ¶
func (rdo *ReferenceDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ReferenceDeleteOne) ExecX ¶
func (rdo *ReferenceDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ReferenceGroupBy ¶
type ReferenceGroupBy struct {
// contains filtered or unexported fields
}
ReferenceGroupBy is the group-by builder for Reference entities.
func (*ReferenceGroupBy) Aggregate ¶
func (rgb *ReferenceGroupBy) Aggregate(fns ...AggregateFunc) *ReferenceGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ReferenceGroupBy) Bool ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) BoolX ¶
func (rgb *ReferenceGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ReferenceGroupBy) Bools ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) BoolsX ¶
func (rgb *ReferenceGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ReferenceGroupBy) Float64 ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) Float64X ¶
func (rgb *ReferenceGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ReferenceGroupBy) Float64s ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) Float64sX ¶
func (rgb *ReferenceGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ReferenceGroupBy) Int ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) IntX ¶
func (rgb *ReferenceGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ReferenceGroupBy) Ints ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) IntsX ¶
func (rgb *ReferenceGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ReferenceGroupBy) Scan ¶
func (rgb *ReferenceGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ReferenceGroupBy) ScanX ¶
func (rgb *ReferenceGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ReferenceGroupBy) String ¶
func (rgb *ReferenceGroupBy) 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 (*ReferenceGroupBy) StringX ¶
func (rgb *ReferenceGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ReferenceMutation ¶
type ReferenceMutation struct {
// contains filtered or unexported fields
}
ReferenceMutation represents an operation that mutates the Reference nodes in the graph.
func (*ReferenceMutation) AddField ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) AddedEdges ¶
func (m *ReferenceMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ReferenceMutation) AddedField ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) AddedFields ¶
func (m *ReferenceMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ReferenceMutation) AddedIDs ¶
func (m *ReferenceMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ReferenceMutation) ClearEdge ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) ClearField ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) ClearedEdges ¶
func (m *ReferenceMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ReferenceMutation) ClearedFields ¶
func (m *ReferenceMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ReferenceMutation) Client ¶
func (m ReferenceMutation) 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 (*ReferenceMutation) EdgeCleared ¶
func (m *ReferenceMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ReferenceMutation) Field ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) FieldCleared ¶
func (m *ReferenceMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ReferenceMutation) Fields ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) Hash ¶
func (m *ReferenceMutation) Hash() (r string, exists bool)
Hash returns the value of the "hash" field in the mutation.
func (*ReferenceMutation) ID ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) IDs ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) 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 (*ReferenceMutation) OldHash ¶
func (m *ReferenceMutation) OldHash(ctx context.Context) (v string, err error)
OldHash returns the old "hash" field's value of the Reference entity. If the Reference 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 (*ReferenceMutation) OldPackage ¶
func (m *ReferenceMutation) OldPackage(ctx context.Context) (v string, err error)
OldPackage returns the old "package" field's value of the Reference entity. If the Reference 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 (*ReferenceMutation) OldRef ¶
func (m *ReferenceMutation) OldRef(ctx context.Context) (v string, err error)
OldRef returns the old "ref" field's value of the Reference entity. If the Reference 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 (*ReferenceMutation) Package ¶
func (m *ReferenceMutation) Package() (r string, exists bool)
Package returns the value of the "package" field in the mutation.
func (*ReferenceMutation) Ref ¶
func (m *ReferenceMutation) Ref() (r string, exists bool)
Ref returns the value of the "ref" field in the mutation.
func (*ReferenceMutation) RemovedEdges ¶
func (m *ReferenceMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ReferenceMutation) RemovedIDs ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) ResetEdge ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) ResetField ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) ResetHash ¶
func (m *ReferenceMutation) ResetHash()
ResetHash resets all changes to the "hash" field.
func (*ReferenceMutation) ResetPackage ¶
func (m *ReferenceMutation) ResetPackage()
ResetPackage resets all changes to the "package" field.
func (*ReferenceMutation) ResetRef ¶
func (m *ReferenceMutation) ResetRef()
ResetRef resets all changes to the "ref" field.
func (*ReferenceMutation) SetField ¶
func (m *ReferenceMutation) 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 (*ReferenceMutation) SetHash ¶
func (m *ReferenceMutation) SetHash(s string)
SetHash sets the "hash" field.
func (*ReferenceMutation) SetPackage ¶
func (m *ReferenceMutation) SetPackage(s string)
SetPackage sets the "package" field.
func (*ReferenceMutation) SetRef ¶
func (m *ReferenceMutation) SetRef(s string)
SetRef sets the "ref" field.
func (ReferenceMutation) Tx ¶
func (m ReferenceMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ReferenceMutation) Type ¶
func (m *ReferenceMutation) Type() string
Type returns the node type of this mutation (Reference).
func (*ReferenceMutation) Where ¶
func (m *ReferenceMutation) Where(ps ...predicate.Reference)
Where appends a list predicates to the ReferenceMutation builder.
type ReferenceQuery ¶
type ReferenceQuery struct {
// contains filtered or unexported fields
}
ReferenceQuery is the builder for querying Reference entities.
func (*ReferenceQuery) All ¶
func (rq *ReferenceQuery) All(ctx context.Context) ([]*Reference, error)
All executes the query and returns a list of References.
func (*ReferenceQuery) AllX ¶
func (rq *ReferenceQuery) AllX(ctx context.Context) []*Reference
AllX is like All, but panics if an error occurs.
func (*ReferenceQuery) Clone ¶
func (rq *ReferenceQuery) Clone() *ReferenceQuery
Clone returns a duplicate of the ReferenceQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ReferenceQuery) Count ¶
func (rq *ReferenceQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ReferenceQuery) CountX ¶
func (rq *ReferenceQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ReferenceQuery) Exist ¶
func (rq *ReferenceQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ReferenceQuery) ExistX ¶
func (rq *ReferenceQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ReferenceQuery) First ¶
func (rq *ReferenceQuery) First(ctx context.Context) (*Reference, error)
First returns the first Reference entity from the query. Returns a *NotFoundError when no Reference was found.
func (*ReferenceQuery) FirstID ¶
func (rq *ReferenceQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Reference ID from the query. Returns a *NotFoundError when no Reference ID was found.
func (*ReferenceQuery) FirstIDX ¶
func (rq *ReferenceQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*ReferenceQuery) FirstX ¶
func (rq *ReferenceQuery) FirstX(ctx context.Context) *Reference
FirstX is like First, but panics if an error occurs.
func (*ReferenceQuery) GroupBy ¶
func (rq *ReferenceQuery) GroupBy(field string, fields ...string) *ReferenceGroupBy
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 {
Package string `json:"package,omitempty"`
Count int `json:"count,omitempty"`
}
client.Reference.Query().
GroupBy(reference.FieldPackage).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*ReferenceQuery) IDs ¶
func (rq *ReferenceQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Reference IDs.
func (*ReferenceQuery) IDsX ¶
func (rq *ReferenceQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ReferenceQuery) Limit ¶
func (rq *ReferenceQuery) Limit(limit int) *ReferenceQuery
Limit adds a limit step to the query.
func (*ReferenceQuery) Offset ¶
func (rq *ReferenceQuery) Offset(offset int) *ReferenceQuery
Offset adds an offset step to the query.
func (*ReferenceQuery) Only ¶
func (rq *ReferenceQuery) Only(ctx context.Context) (*Reference, error)
Only returns a single Reference entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Reference entity is not found. Returns a *NotFoundError when no Reference entities are found.
func (*ReferenceQuery) OnlyID ¶
func (rq *ReferenceQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Reference ID in the query. Returns a *NotSingularError when exactly one Reference ID is not found. Returns a *NotFoundError when no entities are found.
func (*ReferenceQuery) OnlyIDX ¶
func (rq *ReferenceQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ReferenceQuery) OnlyX ¶
func (rq *ReferenceQuery) OnlyX(ctx context.Context) *Reference
OnlyX is like Only, but panics if an error occurs.
func (*ReferenceQuery) Order ¶
func (rq *ReferenceQuery) Order(o ...OrderFunc) *ReferenceQuery
Order adds an order step to the query.
func (*ReferenceQuery) Select ¶
func (rq *ReferenceQuery) Select(fields ...string) *ReferenceSelect
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 {
Package string `json:"package,omitempty"`
}
client.Reference.Query().
Select(reference.FieldPackage).
Scan(ctx, &v)
func (*ReferenceQuery) Unique ¶
func (rq *ReferenceQuery) Unique(unique bool) *ReferenceQuery
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 (*ReferenceQuery) Where ¶
func (rq *ReferenceQuery) Where(ps ...predicate.Reference) *ReferenceQuery
Where adds a new predicate for the ReferenceQuery builder.
type ReferenceSelect ¶
type ReferenceSelect struct {
*ReferenceQuery
// contains filtered or unexported fields
}
ReferenceSelect is the builder for selecting fields of Reference entities.
func (*ReferenceSelect) Bool ¶
func (rs *ReferenceSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) BoolX ¶
func (rs *ReferenceSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ReferenceSelect) Bools ¶
func (rs *ReferenceSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) BoolsX ¶
func (rs *ReferenceSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ReferenceSelect) Float64 ¶
func (rs *ReferenceSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) Float64X ¶
func (rs *ReferenceSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ReferenceSelect) Float64s ¶
func (rs *ReferenceSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) Float64sX ¶
func (rs *ReferenceSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ReferenceSelect) Int ¶
func (rs *ReferenceSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) IntX ¶
func (rs *ReferenceSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ReferenceSelect) Ints ¶
func (rs *ReferenceSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) IntsX ¶
func (rs *ReferenceSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ReferenceSelect) Scan ¶
func (rs *ReferenceSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ReferenceSelect) ScanX ¶
func (rs *ReferenceSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ReferenceSelect) String ¶
func (rs *ReferenceSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ReferenceSelect) StringX ¶
func (rs *ReferenceSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ReferenceUpdate ¶
type ReferenceUpdate struct {
// contains filtered or unexported fields
}
ReferenceUpdate is the builder for updating Reference entities.
func (*ReferenceUpdate) Exec ¶
func (ru *ReferenceUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ReferenceUpdate) ExecX ¶
func (ru *ReferenceUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ReferenceUpdate) Mutation ¶
func (ru *ReferenceUpdate) Mutation() *ReferenceMutation
Mutation returns the ReferenceMutation object of the builder.
func (*ReferenceUpdate) Save ¶
func (ru *ReferenceUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ReferenceUpdate) SaveX ¶
func (ru *ReferenceUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ReferenceUpdate) SetHash ¶
func (ru *ReferenceUpdate) SetHash(s string) *ReferenceUpdate
SetHash sets the "hash" field.
func (*ReferenceUpdate) SetPackage ¶
func (ru *ReferenceUpdate) SetPackage(s string) *ReferenceUpdate
SetPackage sets the "package" field.
func (*ReferenceUpdate) SetRef ¶
func (ru *ReferenceUpdate) SetRef(s string) *ReferenceUpdate
SetRef sets the "ref" field.
func (*ReferenceUpdate) Where ¶
func (ru *ReferenceUpdate) Where(ps ...predicate.Reference) *ReferenceUpdate
Where appends a list predicates to the ReferenceUpdate builder.
type ReferenceUpdateOne ¶
type ReferenceUpdateOne struct {
// contains filtered or unexported fields
}
ReferenceUpdateOne is the builder for updating a single Reference entity.
func (*ReferenceUpdateOne) Exec ¶
func (ruo *ReferenceUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ReferenceUpdateOne) ExecX ¶
func (ruo *ReferenceUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ReferenceUpdateOne) Mutation ¶
func (ruo *ReferenceUpdateOne) Mutation() *ReferenceMutation
Mutation returns the ReferenceMutation object of the builder.
func (*ReferenceUpdateOne) Save ¶
func (ruo *ReferenceUpdateOne) Save(ctx context.Context) (*Reference, error)
Save executes the query and returns the updated Reference entity.
func (*ReferenceUpdateOne) SaveX ¶
func (ruo *ReferenceUpdateOne) SaveX(ctx context.Context) *Reference
SaveX is like Save, but panics if an error occurs.
func (*ReferenceUpdateOne) Select ¶
func (ruo *ReferenceUpdateOne) Select(field string, fields ...string) *ReferenceUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ReferenceUpdateOne) SetHash ¶
func (ruo *ReferenceUpdateOne) SetHash(s string) *ReferenceUpdateOne
SetHash sets the "hash" field.
func (*ReferenceUpdateOne) SetPackage ¶
func (ruo *ReferenceUpdateOne) SetPackage(s string) *ReferenceUpdateOne
SetPackage sets the "package" field.
func (*ReferenceUpdateOne) SetRef ¶
func (ruo *ReferenceUpdateOne) SetRef(s string) *ReferenceUpdateOne
SetRef sets the "ref" field.
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 {
// Object is the client for interacting with the Object builders.
Object *ObjectClient
// Reference is the client for interacting with the Reference builders.
Reference *ReferenceClient
// 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.