Documentation
¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(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 Aggregate
- type Client
- type ConstraintError
- type Hook
- type Manufacturer
- type ManufacturerClient
- func (c *ManufacturerClient) Create() *ManufacturerCreate
- func (c *ManufacturerClient) Delete() *ManufacturerDelete
- func (c *ManufacturerClient) DeleteOne(m *Manufacturer) *ManufacturerDeleteOne
- func (c *ManufacturerClient) DeleteOneID(id int) *ManufacturerDeleteOne
- func (c *ManufacturerClient) Get(ctx context.Context, id int) (*Manufacturer, error)
- func (c *ManufacturerClient) GetX(ctx context.Context, id int) *Manufacturer
- func (c *ManufacturerClient) Hooks() []Hook
- func (c *ManufacturerClient) Query() *ManufacturerQuery
- func (c *ManufacturerClient) Update() *ManufacturerUpdate
- func (c *ManufacturerClient) UpdateOne(m *Manufacturer) *ManufacturerUpdateOne
- func (c *ManufacturerClient) UpdateOneID(id int) *ManufacturerUpdateOne
- func (c *ManufacturerClient) Use(hooks ...Hook)
- type ManufacturerCreate
- type ManufacturerDelete
- type ManufacturerDeleteOne
- type ManufacturerGroupBy
- func (mgb *ManufacturerGroupBy) Aggregate(fns ...Aggregate) *ManufacturerGroupBy
- func (mgb *ManufacturerGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (mgb *ManufacturerGroupBy) BoolsX(ctx context.Context) []bool
- func (mgb *ManufacturerGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (mgb *ManufacturerGroupBy) Float64sX(ctx context.Context) []float64
- func (mgb *ManufacturerGroupBy) Ints(ctx context.Context) ([]int, error)
- func (mgb *ManufacturerGroupBy) IntsX(ctx context.Context) []int
- func (mgb *ManufacturerGroupBy) Scan(ctx context.Context, v interface{}) error
- func (mgb *ManufacturerGroupBy) ScanX(ctx context.Context, v interface{})
- func (mgb *ManufacturerGroupBy) Strings(ctx context.Context) ([]string, error)
- func (mgb *ManufacturerGroupBy) StringsX(ctx context.Context) []string
- type ManufacturerMutation
- func (m *ManufacturerMutation) AddField(name string, value ent.Value) error
- func (m *ManufacturerMutation) AddedEdges() []string
- func (m *ManufacturerMutation) AddedField(name string) (ent.Value, bool)
- func (m *ManufacturerMutation) AddedFields() []string
- func (m *ManufacturerMutation) AddedIDs(name string) []ent.Value
- func (m *ManufacturerMutation) ClearEdge(name string) error
- func (m *ManufacturerMutation) ClearField(name string) error
- func (m *ManufacturerMutation) ClearedEdges() []string
- func (m *ManufacturerMutation) ClearedFields() []string
- func (m ManufacturerMutation) Client() *Client
- func (m *ManufacturerMutation) EdgeCleared(name string) bool
- func (m *ManufacturerMutation) Field(name string) (ent.Value, bool)
- func (m *ManufacturerMutation) FieldCleared(name string) bool
- func (m *ManufacturerMutation) Fields() []string
- func (m *ManufacturerMutation) ID() (id int, exists bool)
- func (m *ManufacturerMutation) Name() (r string, exists bool)
- func (m *ManufacturerMutation) Op() Op
- func (m *ManufacturerMutation) RemovedEdges() []string
- func (m *ManufacturerMutation) RemovedIDs(name string) []ent.Value
- func (m *ManufacturerMutation) ResetEdge(name string) error
- func (m *ManufacturerMutation) ResetField(name string) error
- func (m *ManufacturerMutation) ResetName()
- func (m *ManufacturerMutation) SetField(name string, value ent.Value) error
- func (m *ManufacturerMutation) SetName(s string)
- func (m ManufacturerMutation) Tx() (*Tx, error)
- func (m *ManufacturerMutation) Type() string
- type ManufacturerQuery
- func (mq *ManufacturerQuery) All(ctx context.Context) ([]*Manufacturer, error)
- func (mq *ManufacturerQuery) AllX(ctx context.Context) []*Manufacturer
- func (mq *ManufacturerQuery) Clone() *ManufacturerQuery
- func (mq *ManufacturerQuery) Count(ctx context.Context) (int, error)
- func (mq *ManufacturerQuery) CountX(ctx context.Context) int
- func (mq *ManufacturerQuery) Exist(ctx context.Context) (bool, error)
- func (mq *ManufacturerQuery) ExistX(ctx context.Context) bool
- func (mq *ManufacturerQuery) First(ctx context.Context) (*Manufacturer, error)
- func (mq *ManufacturerQuery) FirstID(ctx context.Context) (id int, err error)
- func (mq *ManufacturerQuery) FirstX(ctx context.Context) *Manufacturer
- func (mq *ManufacturerQuery) FirstXID(ctx context.Context) int
- func (mq *ManufacturerQuery) GroupBy(field string, fields ...string) *ManufacturerGroupBy
- func (mq *ManufacturerQuery) IDs(ctx context.Context) ([]int, error)
- func (mq *ManufacturerQuery) IDsX(ctx context.Context) []int
- func (mq *ManufacturerQuery) Limit(limit int) *ManufacturerQuery
- func (mq *ManufacturerQuery) Offset(offset int) *ManufacturerQuery
- func (mq *ManufacturerQuery) Only(ctx context.Context) (*Manufacturer, error)
- func (mq *ManufacturerQuery) OnlyID(ctx context.Context) (id int, err error)
- func (mq *ManufacturerQuery) OnlyX(ctx context.Context) *Manufacturer
- func (mq *ManufacturerQuery) OnlyXID(ctx context.Context) int
- func (mq *ManufacturerQuery) Order(o ...Order) *ManufacturerQuery
- func (mq *ManufacturerQuery) Select(field string, fields ...string) *ManufacturerSelect
- func (mq *ManufacturerQuery) Where(ps ...predicate.Manufacturer) *ManufacturerQuery
- type ManufacturerSelect
- func (ms *ManufacturerSelect) Bools(ctx context.Context) ([]bool, error)
- func (ms *ManufacturerSelect) BoolsX(ctx context.Context) []bool
- func (ms *ManufacturerSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ms *ManufacturerSelect) Float64sX(ctx context.Context) []float64
- func (ms *ManufacturerSelect) Ints(ctx context.Context) ([]int, error)
- func (ms *ManufacturerSelect) IntsX(ctx context.Context) []int
- func (ms *ManufacturerSelect) Scan(ctx context.Context, v interface{}) error
- func (ms *ManufacturerSelect) ScanX(ctx context.Context, v interface{})
- func (ms *ManufacturerSelect) Strings(ctx context.Context) ([]string, error)
- func (ms *ManufacturerSelect) StringsX(ctx context.Context) []string
- type ManufacturerUpdate
- func (mu *ManufacturerUpdate) Exec(ctx context.Context) error
- func (mu *ManufacturerUpdate) ExecX(ctx context.Context)
- func (mu *ManufacturerUpdate) Save(ctx context.Context) (int, error)
- func (mu *ManufacturerUpdate) SaveX(ctx context.Context) int
- func (mu *ManufacturerUpdate) SetName(s string) *ManufacturerUpdate
- func (mu *ManufacturerUpdate) SetNillableName(s *string) *ManufacturerUpdate
- func (mu *ManufacturerUpdate) Where(ps ...predicate.Manufacturer) *ManufacturerUpdate
- type ManufacturerUpdateOne
- func (muo *ManufacturerUpdateOne) Exec(ctx context.Context) error
- func (muo *ManufacturerUpdateOne) ExecX(ctx context.Context)
- func (muo *ManufacturerUpdateOne) Save(ctx context.Context) (*Manufacturer, error)
- func (muo *ManufacturerUpdateOne) SaveX(ctx context.Context) *Manufacturer
- func (muo *ManufacturerUpdateOne) SetName(s string) *ManufacturerUpdateOne
- func (muo *ManufacturerUpdateOne) SetNillableName(s *string) *ManufacturerUpdateOne
- type Manufacturers
- type Model
- type ModelClient
- func (c *ModelClient) Create() *ModelCreate
- func (c *ModelClient) Delete() *ModelDelete
- func (c *ModelClient) DeleteOne(m *Model) *ModelDeleteOne
- func (c *ModelClient) DeleteOneID(id int) *ModelDeleteOne
- func (c *ModelClient) Get(ctx context.Context, id int) (*Model, error)
- func (c *ModelClient) GetX(ctx context.Context, id int) *Model
- func (c *ModelClient) Hooks() []Hook
- func (c *ModelClient) Query() *ModelQuery
- func (c *ModelClient) Update() *ModelUpdate
- func (c *ModelClient) UpdateOne(m *Model) *ModelUpdateOne
- func (c *ModelClient) UpdateOneID(id int) *ModelUpdateOne
- func (c *ModelClient) Use(hooks ...Hook)
- type ModelCreate
- type ModelDelete
- type ModelDeleteOne
- type ModelGroupBy
- func (mgb *ModelGroupBy) Aggregate(fns ...Aggregate) *ModelGroupBy
- func (mgb *ModelGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (mgb *ModelGroupBy) BoolsX(ctx context.Context) []bool
- func (mgb *ModelGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (mgb *ModelGroupBy) Float64sX(ctx context.Context) []float64
- func (mgb *ModelGroupBy) Ints(ctx context.Context) ([]int, error)
- func (mgb *ModelGroupBy) IntsX(ctx context.Context) []int
- func (mgb *ModelGroupBy) Scan(ctx context.Context, v interface{}) error
- func (mgb *ModelGroupBy) ScanX(ctx context.Context, v interface{})
- func (mgb *ModelGroupBy) Strings(ctx context.Context) ([]string, error)
- func (mgb *ModelGroupBy) StringsX(ctx context.Context) []string
- type ModelMutation
- func (m *ModelMutation) AddField(name string, value ent.Value) error
- func (m *ModelMutation) AddedEdges() []string
- func (m *ModelMutation) AddedField(name string) (ent.Value, bool)
- func (m *ModelMutation) AddedFields() []string
- func (m *ModelMutation) AddedIDs(name string) []ent.Value
- func (m *ModelMutation) ClearEdge(name string) error
- func (m *ModelMutation) ClearField(name string) error
- func (m *ModelMutation) ClearedEdges() []string
- func (m *ModelMutation) ClearedFields() []string
- func (m ModelMutation) Client() *Client
- func (m *ModelMutation) EdgeCleared(name string) bool
- func (m *ModelMutation) Field(name string) (ent.Value, bool)
- func (m *ModelMutation) FieldCleared(name string) bool
- func (m *ModelMutation) Fields() []string
- func (m *ModelMutation) ID() (id int, exists bool)
- func (m *ModelMutation) Name() (r string, exists bool)
- func (m *ModelMutation) Op() Op
- func (m *ModelMutation) RemovedEdges() []string
- func (m *ModelMutation) RemovedIDs(name string) []ent.Value
- func (m *ModelMutation) ResetEdge(name string) error
- func (m *ModelMutation) ResetField(name string) error
- func (m *ModelMutation) ResetName()
- func (m *ModelMutation) SetField(name string, value ent.Value) error
- func (m *ModelMutation) SetName(s string)
- func (m ModelMutation) Tx() (*Tx, error)
- func (m *ModelMutation) Type() string
- type ModelQuery
- func (mq *ModelQuery) All(ctx context.Context) ([]*Model, error)
- func (mq *ModelQuery) AllX(ctx context.Context) []*Model
- func (mq *ModelQuery) Clone() *ModelQuery
- func (mq *ModelQuery) Count(ctx context.Context) (int, error)
- func (mq *ModelQuery) CountX(ctx context.Context) int
- func (mq *ModelQuery) Exist(ctx context.Context) (bool, error)
- func (mq *ModelQuery) ExistX(ctx context.Context) bool
- func (mq *ModelQuery) First(ctx context.Context) (*Model, error)
- func (mq *ModelQuery) FirstID(ctx context.Context) (id int, err error)
- func (mq *ModelQuery) FirstX(ctx context.Context) *Model
- func (mq *ModelQuery) FirstXID(ctx context.Context) int
- func (mq *ModelQuery) GroupBy(field string, fields ...string) *ModelGroupBy
- func (mq *ModelQuery) IDs(ctx context.Context) ([]int, error)
- func (mq *ModelQuery) IDsX(ctx context.Context) []int
- func (mq *ModelQuery) Limit(limit int) *ModelQuery
- func (mq *ModelQuery) Offset(offset int) *ModelQuery
- func (mq *ModelQuery) Only(ctx context.Context) (*Model, error)
- func (mq *ModelQuery) OnlyID(ctx context.Context) (id int, err error)
- func (mq *ModelQuery) OnlyX(ctx context.Context) *Model
- func (mq *ModelQuery) OnlyXID(ctx context.Context) int
- func (mq *ModelQuery) Order(o ...Order) *ModelQuery
- func (mq *ModelQuery) Select(field string, fields ...string) *ModelSelect
- func (mq *ModelQuery) Where(ps ...predicate.Model) *ModelQuery
- type ModelSelect
- func (ms *ModelSelect) Bools(ctx context.Context) ([]bool, error)
- func (ms *ModelSelect) BoolsX(ctx context.Context) []bool
- func (ms *ModelSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ms *ModelSelect) Float64sX(ctx context.Context) []float64
- func (ms *ModelSelect) Ints(ctx context.Context) ([]int, error)
- func (ms *ModelSelect) IntsX(ctx context.Context) []int
- func (ms *ModelSelect) Scan(ctx context.Context, v interface{}) error
- func (ms *ModelSelect) ScanX(ctx context.Context, v interface{})
- func (ms *ModelSelect) Strings(ctx context.Context) ([]string, error)
- func (ms *ModelSelect) StringsX(ctx context.Context) []string
- type ModelUpdate
- func (mu *ModelUpdate) Exec(ctx context.Context) error
- func (mu *ModelUpdate) ExecX(ctx context.Context)
- func (mu *ModelUpdate) Save(ctx context.Context) (int, error)
- func (mu *ModelUpdate) SaveX(ctx context.Context) int
- func (mu *ModelUpdate) SetName(s string) *ModelUpdate
- func (mu *ModelUpdate) SetNillableName(s *string) *ModelUpdate
- func (mu *ModelUpdate) Where(ps ...predicate.Model) *ModelUpdate
- type ModelUpdateOne
- func (muo *ModelUpdateOne) Exec(ctx context.Context) error
- func (muo *ModelUpdateOne) ExecX(ctx context.Context)
- func (muo *ModelUpdateOne) Save(ctx context.Context) (*Model, error)
- func (muo *ModelUpdateOne) SaveX(ctx context.Context) *Model
- func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne
- func (muo *ModelUpdateOne) SetNillableName(s *string) *ModelUpdateOne
- type Models
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type Order
- type Policy
- type Query
- type Tx
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeManufacturer = "Manufacturer" TypeModel = "Model" )
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 NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type Aggregate ¶
Aggregate applies an aggregation step on the group-by traversal/selector.
func As ¶
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)
type Client ¶
type Client struct {
// Schema is the client for creating, migrating and dropping schema.
Schema *migrate.Schema
// Manufacturer is the client for interacting with the Manufacturer builders.
Manufacturer *ManufacturerClient
// Model is the client for interacting with the Model builders.
Model *ModelClient
// contains filtered or unexported fields
}
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
Open opens a connection to the database specified by the driver name and a driver-specific 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(). Manufacturer. Query(). Count(ctx)
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 Manufacturer ¶
type Manufacturer struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// contains filtered or unexported fields
}
Manufacturer is the model entity for the Manufacturer schema.
func (*Manufacturer) String ¶
func (m *Manufacturer) String() string
String implements the fmt.Stringer.
func (*Manufacturer) Unwrap ¶
func (m *Manufacturer) Unwrap() *Manufacturer
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Manufacturer) Update ¶
func (m *Manufacturer) Update() *ManufacturerUpdateOne
Update returns a builder for updating this Manufacturer. Note that, you need to call Manufacturer.Unwrap() before calling this method, if this Manufacturer was returned from a transaction, and the transaction was committed or rolled back.
type ManufacturerClient ¶
type ManufacturerClient struct {
// contains filtered or unexported fields
}
ManufacturerClient is a client for the Manufacturer schema.
func NewManufacturerClient ¶
func NewManufacturerClient(c config) *ManufacturerClient
NewManufacturerClient returns a client for the Manufacturer from the given config.
func (*ManufacturerClient) Create ¶
func (c *ManufacturerClient) Create() *ManufacturerCreate
Create returns a create builder for Manufacturer.
func (*ManufacturerClient) Delete ¶
func (c *ManufacturerClient) Delete() *ManufacturerDelete
Delete returns a delete builder for Manufacturer.
func (*ManufacturerClient) DeleteOne ¶
func (c *ManufacturerClient) DeleteOne(m *Manufacturer) *ManufacturerDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ManufacturerClient) DeleteOneID ¶
func (c *ManufacturerClient) DeleteOneID(id int) *ManufacturerDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ManufacturerClient) Get ¶
func (c *ManufacturerClient) Get(ctx context.Context, id int) (*Manufacturer, error)
Get returns a Manufacturer entity by its id.
func (*ManufacturerClient) GetX ¶
func (c *ManufacturerClient) GetX(ctx context.Context, id int) *Manufacturer
GetX is like Get, but panics if an error occurs.
func (*ManufacturerClient) Hooks ¶
func (c *ManufacturerClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ManufacturerClient) Query ¶
func (c *ManufacturerClient) Query() *ManufacturerQuery
Create returns a query builder for Manufacturer.
func (*ManufacturerClient) Update ¶
func (c *ManufacturerClient) Update() *ManufacturerUpdate
Update returns an update builder for Manufacturer.
func (*ManufacturerClient) UpdateOne ¶
func (c *ManufacturerClient) UpdateOne(m *Manufacturer) *ManufacturerUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ManufacturerClient) UpdateOneID ¶
func (c *ManufacturerClient) UpdateOneID(id int) *ManufacturerUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ManufacturerClient) Use ¶
func (c *ManufacturerClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `manufacturer.Hooks(f(g(h())))`.
type ManufacturerCreate ¶
type ManufacturerCreate struct {
// contains filtered or unexported fields
}
ManufacturerCreate is the builder for creating a Manufacturer entity.
func (*ManufacturerCreate) Save ¶
func (mc *ManufacturerCreate) Save(ctx context.Context) (*Manufacturer, error)
Save creates the Manufacturer in the database.
func (*ManufacturerCreate) SaveX ¶
func (mc *ManufacturerCreate) SaveX(ctx context.Context) *Manufacturer
SaveX calls Save and panics if Save returns an error.
func (*ManufacturerCreate) SetName ¶
func (mc *ManufacturerCreate) SetName(s string) *ManufacturerCreate
SetName sets the name field.
func (*ManufacturerCreate) SetNillableName ¶
func (mc *ManufacturerCreate) SetNillableName(s *string) *ManufacturerCreate
SetNillableName sets the name field if the given value is not nil.
type ManufacturerDelete ¶
type ManufacturerDelete struct {
// contains filtered or unexported fields
}
ManufacturerDelete is the builder for deleting a Manufacturer entity.
func (*ManufacturerDelete) Exec ¶
func (md *ManufacturerDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ManufacturerDelete) ExecX ¶
func (md *ManufacturerDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ManufacturerDelete) Where ¶
func (md *ManufacturerDelete) Where(ps ...predicate.Manufacturer) *ManufacturerDelete
Where adds a new predicate to the delete builder.
type ManufacturerDeleteOne ¶
type ManufacturerDeleteOne struct {
// contains filtered or unexported fields
}
ManufacturerDeleteOne is the builder for deleting a single Manufacturer entity.
func (*ManufacturerDeleteOne) Exec ¶
func (mdo *ManufacturerDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ManufacturerDeleteOne) ExecX ¶
func (mdo *ManufacturerDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ManufacturerGroupBy ¶
type ManufacturerGroupBy struct {
// contains filtered or unexported fields
}
ManufacturerGroupBy is the builder for group-by Manufacturer entities.
func (*ManufacturerGroupBy) Aggregate ¶
func (mgb *ManufacturerGroupBy) Aggregate(fns ...Aggregate) *ManufacturerGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ManufacturerGroupBy) Bools ¶
func (mgb *ManufacturerGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*ManufacturerGroupBy) BoolsX ¶
func (mgb *ManufacturerGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ManufacturerGroupBy) Float64s ¶
func (mgb *ManufacturerGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*ManufacturerGroupBy) Float64sX ¶
func (mgb *ManufacturerGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ManufacturerGroupBy) Ints ¶
func (mgb *ManufacturerGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*ManufacturerGroupBy) IntsX ¶
func (mgb *ManufacturerGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ManufacturerGroupBy) Scan ¶
func (mgb *ManufacturerGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*ManufacturerGroupBy) ScanX ¶
func (mgb *ManufacturerGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ManufacturerMutation ¶
type ManufacturerMutation struct {
// contains filtered or unexported fields
}
ManufacturerMutation represents an operation that mutate the Manufacturers nodes in the graph.
func (*ManufacturerMutation) AddField ¶
func (m *ManufacturerMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ManufacturerMutation) AddedEdges ¶
func (m *ManufacturerMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ManufacturerMutation) AddedField ¶
func (m *ManufacturerMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*ManufacturerMutation) AddedFields ¶
func (m *ManufacturerMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*ManufacturerMutation) AddedIDs ¶
func (m *ManufacturerMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*ManufacturerMutation) ClearEdge ¶
func (m *ManufacturerMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*ManufacturerMutation) ClearField ¶
func (m *ManufacturerMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*ManufacturerMutation) ClearedEdges ¶
func (m *ManufacturerMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ManufacturerMutation) ClearedFields ¶
func (m *ManufacturerMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ManufacturerMutation) Client ¶
func (m ManufacturerMutation) 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 (*ManufacturerMutation) EdgeCleared ¶
func (m *ManufacturerMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*ManufacturerMutation) Field ¶
func (m *ManufacturerMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*ManufacturerMutation) FieldCleared ¶
func (m *ManufacturerMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*ManufacturerMutation) Fields ¶
func (m *ManufacturerMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*ManufacturerMutation) ID ¶
func (m *ManufacturerMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*ManufacturerMutation) Name ¶
func (m *ManufacturerMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*ManufacturerMutation) Op ¶
func (m *ManufacturerMutation) Op() Op
Op returns the operation name.
func (*ManufacturerMutation) RemovedEdges ¶
func (m *ManufacturerMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ManufacturerMutation) RemovedIDs ¶
func (m *ManufacturerMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*ManufacturerMutation) ResetEdge ¶
func (m *ManufacturerMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*ManufacturerMutation) ResetField ¶
func (m *ManufacturerMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*ManufacturerMutation) ResetName ¶
func (m *ManufacturerMutation) ResetName()
ResetName reset all changes of the name field.
func (*ManufacturerMutation) SetField ¶
func (m *ManufacturerMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ManufacturerMutation) SetName ¶
func (m *ManufacturerMutation) SetName(s string)
SetName sets the name field.
func (ManufacturerMutation) Tx ¶
func (m ManufacturerMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ManufacturerMutation) Type ¶
func (m *ManufacturerMutation) Type() string
Type returns the node type of this mutation (Manufacturer).
type ManufacturerQuery ¶
type ManufacturerQuery struct {
// contains filtered or unexported fields
}
ManufacturerQuery is the builder for querying Manufacturer entities.
func (*ManufacturerQuery) All ¶
func (mq *ManufacturerQuery) All(ctx context.Context) ([]*Manufacturer, error)
All executes the query and returns a list of Manufacturers.
func (*ManufacturerQuery) AllX ¶
func (mq *ManufacturerQuery) AllX(ctx context.Context) []*Manufacturer
AllX is like All, but panics if an error occurs.
func (*ManufacturerQuery) Clone ¶
func (mq *ManufacturerQuery) Clone() *ManufacturerQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ManufacturerQuery) Count ¶
func (mq *ManufacturerQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ManufacturerQuery) CountX ¶
func (mq *ManufacturerQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ManufacturerQuery) Exist ¶
func (mq *ManufacturerQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ManufacturerQuery) ExistX ¶
func (mq *ManufacturerQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ManufacturerQuery) First ¶
func (mq *ManufacturerQuery) First(ctx context.Context) (*Manufacturer, error)
First returns the first Manufacturer entity in the query. Returns *NotFoundError when no manufacturer was found.
func (*ManufacturerQuery) FirstID ¶
func (mq *ManufacturerQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Manufacturer id in the query. Returns *NotFoundError when no id was found.
func (*ManufacturerQuery) FirstX ¶
func (mq *ManufacturerQuery) FirstX(ctx context.Context) *Manufacturer
FirstX is like First, but panics if an error occurs.
func (*ManufacturerQuery) FirstXID ¶
func (mq *ManufacturerQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*ManufacturerQuery) GroupBy ¶
func (mq *ManufacturerQuery) GroupBy(field string, fields ...string) *ManufacturerGroupBy
GroupBy 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.Manufacturer.Query().
GroupBy(manufacturer.FieldName).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*ManufacturerQuery) IDs ¶
func (mq *ManufacturerQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Manufacturer ids.
func (*ManufacturerQuery) IDsX ¶
func (mq *ManufacturerQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ManufacturerQuery) Limit ¶
func (mq *ManufacturerQuery) Limit(limit int) *ManufacturerQuery
Limit adds a limit step to the query.
func (*ManufacturerQuery) Offset ¶
func (mq *ManufacturerQuery) Offset(offset int) *ManufacturerQuery
Offset adds an offset step to the query.
func (*ManufacturerQuery) Only ¶
func (mq *ManufacturerQuery) Only(ctx context.Context) (*Manufacturer, error)
Only returns the only Manufacturer entity in the query, returns an error if not exactly one entity was returned.
func (*ManufacturerQuery) OnlyID ¶
func (mq *ManufacturerQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Manufacturer id in the query, returns an error if not exactly one id was returned.
func (*ManufacturerQuery) OnlyX ¶
func (mq *ManufacturerQuery) OnlyX(ctx context.Context) *Manufacturer
OnlyX is like Only, but panics if an error occurs.
func (*ManufacturerQuery) OnlyXID ¶
func (mq *ManufacturerQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*ManufacturerQuery) Order ¶
func (mq *ManufacturerQuery) Order(o ...Order) *ManufacturerQuery
Order adds an order step to the query.
func (*ManufacturerQuery) Select ¶
func (mq *ManufacturerQuery) Select(field string, fields ...string) *ManufacturerSelect
Select one or more fields from the given query.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.Manufacturer.Query().
Select(manufacturer.FieldName).
Scan(ctx, &v)
func (*ManufacturerQuery) Where ¶
func (mq *ManufacturerQuery) Where(ps ...predicate.Manufacturer) *ManufacturerQuery
Where adds a new predicate for the builder.
type ManufacturerSelect ¶
type ManufacturerSelect struct {
// contains filtered or unexported fields
}
ManufacturerSelect is the builder for select fields of Manufacturer entities.
func (*ManufacturerSelect) Bools ¶
func (ms *ManufacturerSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*ManufacturerSelect) BoolsX ¶
func (ms *ManufacturerSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ManufacturerSelect) Float64s ¶
func (ms *ManufacturerSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*ManufacturerSelect) Float64sX ¶
func (ms *ManufacturerSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ManufacturerSelect) Ints ¶
func (ms *ManufacturerSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*ManufacturerSelect) IntsX ¶
func (ms *ManufacturerSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ManufacturerSelect) Scan ¶
func (ms *ManufacturerSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*ManufacturerSelect) ScanX ¶
func (ms *ManufacturerSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ManufacturerUpdate ¶
type ManufacturerUpdate struct {
// contains filtered or unexported fields
}
ManufacturerUpdate is the builder for updating Manufacturer entities.
func (*ManufacturerUpdate) Exec ¶
func (mu *ManufacturerUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ManufacturerUpdate) ExecX ¶
func (mu *ManufacturerUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ManufacturerUpdate) Save ¶
func (mu *ManufacturerUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*ManufacturerUpdate) SaveX ¶
func (mu *ManufacturerUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ManufacturerUpdate) SetName ¶
func (mu *ManufacturerUpdate) SetName(s string) *ManufacturerUpdate
SetName sets the name field.
func (*ManufacturerUpdate) SetNillableName ¶
func (mu *ManufacturerUpdate) SetNillableName(s *string) *ManufacturerUpdate
SetNillableName sets the name field if the given value is not nil.
func (*ManufacturerUpdate) Where ¶
func (mu *ManufacturerUpdate) Where(ps ...predicate.Manufacturer) *ManufacturerUpdate
Where adds a new predicate for the builder.
type ManufacturerUpdateOne ¶
type ManufacturerUpdateOne struct {
// contains filtered or unexported fields
}
ManufacturerUpdateOne is the builder for updating a single Manufacturer entity.
func (*ManufacturerUpdateOne) Exec ¶
func (muo *ManufacturerUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ManufacturerUpdateOne) ExecX ¶
func (muo *ManufacturerUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ManufacturerUpdateOne) Save ¶
func (muo *ManufacturerUpdateOne) Save(ctx context.Context) (*Manufacturer, error)
Save executes the query and returns the updated entity.
func (*ManufacturerUpdateOne) SaveX ¶
func (muo *ManufacturerUpdateOne) SaveX(ctx context.Context) *Manufacturer
SaveX is like Save, but panics if an error occurs.
func (*ManufacturerUpdateOne) SetName ¶
func (muo *ManufacturerUpdateOne) SetName(s string) *ManufacturerUpdateOne
SetName sets the name field.
func (*ManufacturerUpdateOne) SetNillableName ¶
func (muo *ManufacturerUpdateOne) SetNillableName(s *string) *ManufacturerUpdateOne
SetNillableName sets the name field if the given value is not nil.
type Manufacturers ¶
type Manufacturers []*Manufacturer
Manufacturers is a parsable slice of Manufacturer.
type Model ¶
type Model struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// contains filtered or unexported fields
}
Model is the model entity for the Model schema.
func (*Model) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Model) Update ¶
func (m *Model) Update() *ModelUpdateOne
Update returns a builder for updating this Model. Note that, you need to call Model.Unwrap() before calling this method, if this Model was returned from a transaction, and the transaction was committed or rolled back.
type ModelClient ¶
type ModelClient struct {
// contains filtered or unexported fields
}
ModelClient is a client for the Model schema.
func NewModelClient ¶
func NewModelClient(c config) *ModelClient
NewModelClient returns a client for the Model from the given config.
func (*ModelClient) Create ¶
func (c *ModelClient) Create() *ModelCreate
Create returns a create builder for Model.
func (*ModelClient) Delete ¶
func (c *ModelClient) Delete() *ModelDelete
Delete returns a delete builder for Model.
func (*ModelClient) DeleteOne ¶
func (c *ModelClient) DeleteOne(m *Model) *ModelDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ModelClient) DeleteOneID ¶
func (c *ModelClient) DeleteOneID(id int) *ModelDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ModelClient) GetX ¶
func (c *ModelClient) GetX(ctx context.Context, id int) *Model
GetX is like Get, but panics if an error occurs.
func (*ModelClient) Query ¶
func (c *ModelClient) Query() *ModelQuery
Create returns a query builder for Model.
func (*ModelClient) Update ¶
func (c *ModelClient) Update() *ModelUpdate
Update returns an update builder for Model.
func (*ModelClient) UpdateOne ¶
func (c *ModelClient) UpdateOne(m *Model) *ModelUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ModelClient) UpdateOneID ¶
func (c *ModelClient) UpdateOneID(id int) *ModelUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ModelClient) Use ¶
func (c *ModelClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `model.Hooks(f(g(h())))`.
type ModelCreate ¶
type ModelCreate struct {
// contains filtered or unexported fields
}
ModelCreate is the builder for creating a Model entity.
func (*ModelCreate) Save ¶
func (mc *ModelCreate) Save(ctx context.Context) (*Model, error)
Save creates the Model in the database.
func (*ModelCreate) SaveX ¶
func (mc *ModelCreate) SaveX(ctx context.Context) *Model
SaveX calls Save and panics if Save returns an error.
func (*ModelCreate) SetName ¶
func (mc *ModelCreate) SetName(s string) *ModelCreate
SetName sets the name field.
func (*ModelCreate) SetNillableName ¶
func (mc *ModelCreate) SetNillableName(s *string) *ModelCreate
SetNillableName sets the name field if the given value is not nil.
type ModelDelete ¶
type ModelDelete struct {
// contains filtered or unexported fields
}
ModelDelete is the builder for deleting a Model entity.
func (*ModelDelete) Exec ¶
func (md *ModelDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ModelDelete) ExecX ¶
func (md *ModelDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ModelDelete) Where ¶
func (md *ModelDelete) Where(ps ...predicate.Model) *ModelDelete
Where adds a new predicate to the delete builder.
type ModelDeleteOne ¶
type ModelDeleteOne struct {
// contains filtered or unexported fields
}
ModelDeleteOne is the builder for deleting a single Model entity.
func (*ModelDeleteOne) Exec ¶
func (mdo *ModelDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ModelDeleteOne) ExecX ¶
func (mdo *ModelDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ModelGroupBy ¶
type ModelGroupBy struct {
// contains filtered or unexported fields
}
ModelGroupBy is the builder for group-by Model entities.
func (*ModelGroupBy) Aggregate ¶
func (mgb *ModelGroupBy) Aggregate(fns ...Aggregate) *ModelGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ModelGroupBy) Bools ¶
func (mgb *ModelGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*ModelGroupBy) BoolsX ¶
func (mgb *ModelGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ModelGroupBy) Float64s ¶
func (mgb *ModelGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*ModelGroupBy) Float64sX ¶
func (mgb *ModelGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ModelGroupBy) Ints ¶
func (mgb *ModelGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*ModelGroupBy) IntsX ¶
func (mgb *ModelGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ModelGroupBy) Scan ¶
func (mgb *ModelGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*ModelGroupBy) ScanX ¶
func (mgb *ModelGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ModelMutation ¶
type ModelMutation struct {
// contains filtered or unexported fields
}
ModelMutation represents an operation that mutate the Models nodes in the graph.
func (*ModelMutation) AddField ¶
func (m *ModelMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ModelMutation) AddedEdges ¶
func (m *ModelMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ModelMutation) AddedField ¶
func (m *ModelMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*ModelMutation) AddedFields ¶
func (m *ModelMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*ModelMutation) AddedIDs ¶
func (m *ModelMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*ModelMutation) ClearEdge ¶
func (m *ModelMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*ModelMutation) ClearField ¶
func (m *ModelMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*ModelMutation) ClearedEdges ¶
func (m *ModelMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ModelMutation) ClearedFields ¶
func (m *ModelMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ModelMutation) Client ¶
func (m ModelMutation) 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 (*ModelMutation) EdgeCleared ¶
func (m *ModelMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*ModelMutation) Field ¶
func (m *ModelMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*ModelMutation) FieldCleared ¶
func (m *ModelMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*ModelMutation) Fields ¶
func (m *ModelMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*ModelMutation) ID ¶
func (m *ModelMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*ModelMutation) Name ¶
func (m *ModelMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*ModelMutation) RemovedEdges ¶
func (m *ModelMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ModelMutation) RemovedIDs ¶
func (m *ModelMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*ModelMutation) ResetEdge ¶
func (m *ModelMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*ModelMutation) ResetField ¶
func (m *ModelMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*ModelMutation) ResetName ¶
func (m *ModelMutation) ResetName()
ResetName reset all changes of the name field.
func (*ModelMutation) SetField ¶
func (m *ModelMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ModelMutation) SetName ¶
func (m *ModelMutation) SetName(s string)
SetName sets the name field.
func (ModelMutation) Tx ¶
func (m ModelMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ModelMutation) Type ¶
func (m *ModelMutation) Type() string
Type returns the node type of this mutation (Model).
type ModelQuery ¶
type ModelQuery struct {
// contains filtered or unexported fields
}
ModelQuery is the builder for querying Model entities.
func (*ModelQuery) All ¶
func (mq *ModelQuery) All(ctx context.Context) ([]*Model, error)
All executes the query and returns a list of Models.
func (*ModelQuery) AllX ¶
func (mq *ModelQuery) AllX(ctx context.Context) []*Model
AllX is like All, but panics if an error occurs.
func (*ModelQuery) Clone ¶
func (mq *ModelQuery) Clone() *ModelQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ModelQuery) Count ¶
func (mq *ModelQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ModelQuery) CountX ¶
func (mq *ModelQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ModelQuery) Exist ¶
func (mq *ModelQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ModelQuery) ExistX ¶
func (mq *ModelQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ModelQuery) First ¶
func (mq *ModelQuery) First(ctx context.Context) (*Model, error)
First returns the first Model entity in the query. Returns *NotFoundError when no model was found.
func (*ModelQuery) FirstID ¶
func (mq *ModelQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Model id in the query. Returns *NotFoundError when no id was found.
func (*ModelQuery) FirstX ¶
func (mq *ModelQuery) FirstX(ctx context.Context) *Model
FirstX is like First, but panics if an error occurs.
func (*ModelQuery) FirstXID ¶
func (mq *ModelQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*ModelQuery) GroupBy ¶
func (mq *ModelQuery) GroupBy(field string, fields ...string) *ModelGroupBy
GroupBy 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.Model.Query().
GroupBy(model.FieldName).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*ModelQuery) IDs ¶
func (mq *ModelQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Model ids.
func (*ModelQuery) IDsX ¶
func (mq *ModelQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ModelQuery) Limit ¶
func (mq *ModelQuery) Limit(limit int) *ModelQuery
Limit adds a limit step to the query.
func (*ModelQuery) Offset ¶
func (mq *ModelQuery) Offset(offset int) *ModelQuery
Offset adds an offset step to the query.
func (*ModelQuery) Only ¶
func (mq *ModelQuery) Only(ctx context.Context) (*Model, error)
Only returns the only Model entity in the query, returns an error if not exactly one entity was returned.
func (*ModelQuery) OnlyID ¶
func (mq *ModelQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Model id in the query, returns an error if not exactly one id was returned.
func (*ModelQuery) OnlyX ¶
func (mq *ModelQuery) OnlyX(ctx context.Context) *Model
OnlyX is like Only, but panics if an error occurs.
func (*ModelQuery) OnlyXID ¶
func (mq *ModelQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*ModelQuery) Order ¶
func (mq *ModelQuery) Order(o ...Order) *ModelQuery
Order adds an order step to the query.
func (*ModelQuery) Select ¶
func (mq *ModelQuery) Select(field string, fields ...string) *ModelSelect
Select one or more fields from the given query.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.Model.Query().
Select(model.FieldName).
Scan(ctx, &v)
func (*ModelQuery) Where ¶
func (mq *ModelQuery) Where(ps ...predicate.Model) *ModelQuery
Where adds a new predicate for the builder.
type ModelSelect ¶
type ModelSelect struct {
// contains filtered or unexported fields
}
ModelSelect is the builder for select fields of Model entities.
func (*ModelSelect) Bools ¶
func (ms *ModelSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*ModelSelect) BoolsX ¶
func (ms *ModelSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ModelSelect) Float64s ¶
func (ms *ModelSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*ModelSelect) Float64sX ¶
func (ms *ModelSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ModelSelect) Ints ¶
func (ms *ModelSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*ModelSelect) IntsX ¶
func (ms *ModelSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ModelSelect) Scan ¶
func (ms *ModelSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*ModelSelect) ScanX ¶
func (ms *ModelSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ModelUpdate ¶
type ModelUpdate struct {
// contains filtered or unexported fields
}
ModelUpdate is the builder for updating Model entities.
func (*ModelUpdate) Exec ¶
func (mu *ModelUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ModelUpdate) ExecX ¶
func (mu *ModelUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelUpdate) Save ¶
func (mu *ModelUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*ModelUpdate) SaveX ¶
func (mu *ModelUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ModelUpdate) SetName ¶
func (mu *ModelUpdate) SetName(s string) *ModelUpdate
SetName sets the name field.
func (*ModelUpdate) SetNillableName ¶
func (mu *ModelUpdate) SetNillableName(s *string) *ModelUpdate
SetNillableName sets the name field if the given value is not nil.
func (*ModelUpdate) Where ¶
func (mu *ModelUpdate) Where(ps ...predicate.Model) *ModelUpdate
Where adds a new predicate for the builder.
type ModelUpdateOne ¶
type ModelUpdateOne struct {
// contains filtered or unexported fields
}
ModelUpdateOne is the builder for updating a single Model entity.
func (*ModelUpdateOne) Exec ¶
func (muo *ModelUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ModelUpdateOne) ExecX ¶
func (muo *ModelUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ModelUpdateOne) Save ¶
func (muo *ModelUpdateOne) Save(ctx context.Context) (*Model, error)
Save executes the query and returns the updated entity.
func (*ModelUpdateOne) SaveX ¶
func (muo *ModelUpdateOne) SaveX(ctx context.Context) *Model
SaveX is like Save, but panics if an error occurs.
func (*ModelUpdateOne) SetName ¶
func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne
SetName sets the name field.
func (*ModelUpdateOne) SetNillableName ¶
func (muo *ModelUpdateOne) SetNillableName(s *string) *ModelUpdateOne
SetNillableName sets the name field if the given value is not nil.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflict 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 Tx ¶
type Tx struct {
// Manufacturer is the client for interacting with the Manufacturer builders.
Manufacturer *ManufacturerClient
// Model is the client for interacting with the Model builders.
Model *ModelClient
// contains filtered or unexported fields
}
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns the Tx stored in a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
OnRollback adds a function to call on rollback.