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 Drop
- type DropClient
- func (c *DropClient) Create() *DropCreate
- func (c *DropClient) CreateBulk(builders ...*DropCreate) *DropCreateBulk
- func (c *DropClient) Delete() *DropDelete
- func (c *DropClient) DeleteOne(d *Drop) *DropDeleteOne
- func (c *DropClient) DeleteOneID(id uint32) *DropDeleteOne
- func (c *DropClient) Get(ctx context.Context, id uint32) (*Drop, error)
- func (c *DropClient) GetX(ctx context.Context, id uint32) *Drop
- func (c *DropClient) Hooks() []Hook
- func (c *DropClient) Query() *DropQuery
- func (c *DropClient) QuerySeries(d *Drop) *SeriesQuery
- func (c *DropClient) Update() *DropUpdate
- func (c *DropClient) UpdateOne(d *Drop) *DropUpdateOne
- func (c *DropClient) UpdateOneID(id uint32) *DropUpdateOne
- func (c *DropClient) Use(hooks ...Hook)
- type DropCreate
- func (dc *DropCreate) Mutation() *DropMutation
- func (dc *DropCreate) Save(ctx context.Context) (*Drop, error)
- func (dc *DropCreate) SaveX(ctx context.Context) *Drop
- func (dc *DropCreate) SetID(u uint32) *DropCreate
- func (dc *DropCreate) SetObjectID(u uint32) *DropCreate
- func (dc *DropCreate) SetRate(f float32) *DropCreate
- func (dc *DropCreate) SetSeries(s *Series) *DropCreate
- func (dc *DropCreate) SetSeriesID(u uint32) *DropCreate
- type DropCreateBulk
- type DropDelete
- type DropDeleteOne
- type DropEdges
- type DropGroupBy
- func (dgb *DropGroupBy) Aggregate(fns ...AggregateFunc) *DropGroupBy
- func (dgb *DropGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (dgb *DropGroupBy) BoolX(ctx context.Context) bool
- func (dgb *DropGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (dgb *DropGroupBy) BoolsX(ctx context.Context) []bool
- func (dgb *DropGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (dgb *DropGroupBy) Float64X(ctx context.Context) float64
- func (dgb *DropGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (dgb *DropGroupBy) Float64sX(ctx context.Context) []float64
- func (dgb *DropGroupBy) Int(ctx context.Context) (_ int, err error)
- func (dgb *DropGroupBy) IntX(ctx context.Context) int
- func (dgb *DropGroupBy) Ints(ctx context.Context) ([]int, error)
- func (dgb *DropGroupBy) IntsX(ctx context.Context) []int
- func (dgb *DropGroupBy) Scan(ctx context.Context, v interface{}) error
- func (dgb *DropGroupBy) ScanX(ctx context.Context, v interface{})
- func (dgb *DropGroupBy) String(ctx context.Context) (_ string, err error)
- func (dgb *DropGroupBy) StringX(ctx context.Context) string
- func (dgb *DropGroupBy) Strings(ctx context.Context) ([]string, error)
- func (dgb *DropGroupBy) StringsX(ctx context.Context) []string
- type DropMutation
- func (m *DropMutation) AddField(name string, value ent.Value) error
- func (m *DropMutation) AddObjectID(u uint32)
- func (m *DropMutation) AddRate(f float32)
- func (m *DropMutation) AddedEdges() []string
- func (m *DropMutation) AddedField(name string) (ent.Value, bool)
- func (m *DropMutation) AddedFields() []string
- func (m *DropMutation) AddedIDs(name string) []ent.Value
- func (m *DropMutation) AddedObjectID() (r uint32, exists bool)
- func (m *DropMutation) AddedRate() (r float32, exists bool)
- func (m *DropMutation) ClearEdge(name string) error
- func (m *DropMutation) ClearField(name string) error
- func (m *DropMutation) ClearSeries()
- func (m *DropMutation) ClearedEdges() []string
- func (m *DropMutation) ClearedFields() []string
- func (m DropMutation) Client() *Client
- func (m *DropMutation) EdgeCleared(name string) bool
- func (m *DropMutation) Field(name string) (ent.Value, bool)
- func (m *DropMutation) FieldCleared(name string) bool
- func (m *DropMutation) Fields() []string
- func (m *DropMutation) ID() (id uint32, exists bool)
- func (m *DropMutation) ObjectID() (r uint32, exists bool)
- func (m *DropMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *DropMutation) OldObjectID(ctx context.Context) (v uint32, err error)
- func (m *DropMutation) OldRate(ctx context.Context) (v float32, err error)
- func (m *DropMutation) OldSeriesID(ctx context.Context) (v uint32, err error)
- func (m *DropMutation) Op() Op
- func (m *DropMutation) Rate() (r float32, exists bool)
- func (m *DropMutation) RemovedEdges() []string
- func (m *DropMutation) RemovedIDs(name string) []ent.Value
- func (m *DropMutation) ResetEdge(name string) error
- func (m *DropMutation) ResetField(name string) error
- func (m *DropMutation) ResetObjectID()
- func (m *DropMutation) ResetRate()
- func (m *DropMutation) ResetSeries()
- func (m *DropMutation) ResetSeriesID()
- func (m *DropMutation) SeriesCleared() bool
- func (m *DropMutation) SeriesID() (r uint32, exists bool)
- func (m *DropMutation) SeriesIDs() (ids []uint32)
- func (m *DropMutation) SetField(name string, value ent.Value) error
- func (m *DropMutation) SetID(id uint32)
- func (m *DropMutation) SetObjectID(u uint32)
- func (m *DropMutation) SetRate(f float32)
- func (m *DropMutation) SetSeriesID(u uint32)
- func (m DropMutation) Tx() (*Tx, error)
- func (m *DropMutation) Type() string
- type DropQuery
- func (dq *DropQuery) All(ctx context.Context) ([]*Drop, error)
- func (dq *DropQuery) AllX(ctx context.Context) []*Drop
- func (dq *DropQuery) Clone() *DropQuery
- func (dq *DropQuery) Count(ctx context.Context) (int, error)
- func (dq *DropQuery) CountX(ctx context.Context) int
- func (dq *DropQuery) Exist(ctx context.Context) (bool, error)
- func (dq *DropQuery) ExistX(ctx context.Context) bool
- func (dq *DropQuery) First(ctx context.Context) (*Drop, error)
- func (dq *DropQuery) FirstID(ctx context.Context) (id uint32, err error)
- func (dq *DropQuery) FirstIDX(ctx context.Context) uint32
- func (dq *DropQuery) FirstX(ctx context.Context) *Drop
- func (dq *DropQuery) GroupBy(field string, fields ...string) *DropGroupBy
- func (dq *DropQuery) IDs(ctx context.Context) ([]uint32, error)
- func (dq *DropQuery) IDsX(ctx context.Context) []uint32
- func (dq *DropQuery) Limit(limit int) *DropQuery
- func (dq *DropQuery) Offset(offset int) *DropQuery
- func (dq *DropQuery) Only(ctx context.Context) (*Drop, error)
- func (dq *DropQuery) OnlyID(ctx context.Context) (id uint32, err error)
- func (dq *DropQuery) OnlyIDX(ctx context.Context) uint32
- func (dq *DropQuery) OnlyX(ctx context.Context) *Drop
- func (dq *DropQuery) Order(o ...OrderFunc) *DropQuery
- func (dq *DropQuery) QuerySeries() *SeriesQuery
- func (dq *DropQuery) Select(field string, fields ...string) *DropSelect
- func (dq *DropQuery) Where(ps ...predicate.Drop) *DropQuery
- func (dq *DropQuery) WithSeries(opts ...func(*SeriesQuery)) *DropQuery
- type DropSelect
- func (ds *DropSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ds *DropSelect) BoolX(ctx context.Context) bool
- func (ds *DropSelect) Bools(ctx context.Context) ([]bool, error)
- func (ds *DropSelect) BoolsX(ctx context.Context) []bool
- func (ds *DropSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ds *DropSelect) Float64X(ctx context.Context) float64
- func (ds *DropSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ds *DropSelect) Float64sX(ctx context.Context) []float64
- func (ds *DropSelect) Int(ctx context.Context) (_ int, err error)
- func (ds *DropSelect) IntX(ctx context.Context) int
- func (ds *DropSelect) Ints(ctx context.Context) ([]int, error)
- func (ds *DropSelect) IntsX(ctx context.Context) []int
- func (ds *DropSelect) Scan(ctx context.Context, v interface{}) error
- func (ds *DropSelect) ScanX(ctx context.Context, v interface{})
- func (ds *DropSelect) String(ctx context.Context) (_ string, err error)
- func (ds *DropSelect) StringX(ctx context.Context) string
- func (ds *DropSelect) Strings(ctx context.Context) ([]string, error)
- func (ds *DropSelect) StringsX(ctx context.Context) []string
- type DropUpdate
- func (du *DropUpdate) AddObjectID(u uint32) *DropUpdate
- func (du *DropUpdate) AddRate(f float32) *DropUpdate
- func (du *DropUpdate) ClearSeries() *DropUpdate
- func (du *DropUpdate) Exec(ctx context.Context) error
- func (du *DropUpdate) ExecX(ctx context.Context)
- func (du *DropUpdate) Mutation() *DropMutation
- func (du *DropUpdate) Save(ctx context.Context) (int, error)
- func (du *DropUpdate) SaveX(ctx context.Context) int
- func (du *DropUpdate) SetObjectID(u uint32) *DropUpdate
- func (du *DropUpdate) SetRate(f float32) *DropUpdate
- func (du *DropUpdate) SetSeries(s *Series) *DropUpdate
- func (du *DropUpdate) SetSeriesID(u uint32) *DropUpdate
- func (du *DropUpdate) Where(ps ...predicate.Drop) *DropUpdate
- type DropUpdateOne
- func (duo *DropUpdateOne) AddObjectID(u uint32) *DropUpdateOne
- func (duo *DropUpdateOne) AddRate(f float32) *DropUpdateOne
- func (duo *DropUpdateOne) ClearSeries() *DropUpdateOne
- func (duo *DropUpdateOne) Exec(ctx context.Context) error
- func (duo *DropUpdateOne) ExecX(ctx context.Context)
- func (duo *DropUpdateOne) Mutation() *DropMutation
- func (duo *DropUpdateOne) Save(ctx context.Context) (*Drop, error)
- func (duo *DropUpdateOne) SaveX(ctx context.Context) *Drop
- func (duo *DropUpdateOne) SetObjectID(u uint32) *DropUpdateOne
- func (duo *DropUpdateOne) SetRate(f float32) *DropUpdateOne
- func (duo *DropUpdateOne) SetSeries(s *Series) *DropUpdateOne
- func (duo *DropUpdateOne) SetSeriesID(u uint32) *DropUpdateOne
- type Drops
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Series
- type SeriesClient
- func (c *SeriesClient) Create() *SeriesCreate
- func (c *SeriesClient) CreateBulk(builders ...*SeriesCreate) *SeriesCreateBulk
- func (c *SeriesClient) Delete() *SeriesDelete
- func (c *SeriesClient) DeleteOne(s *Series) *SeriesDeleteOne
- func (c *SeriesClient) DeleteOneID(id uint32) *SeriesDeleteOne
- func (c *SeriesClient) Get(ctx context.Context, id uint32) (*Series, error)
- func (c *SeriesClient) GetX(ctx context.Context, id uint32) *Series
- func (c *SeriesClient) Hooks() []Hook
- func (c *SeriesClient) Query() *SeriesQuery
- func (c *SeriesClient) QueryDrops(s *Series) *DropQuery
- func (c *SeriesClient) Update() *SeriesUpdate
- func (c *SeriesClient) UpdateOne(s *Series) *SeriesUpdateOne
- func (c *SeriesClient) UpdateOneID(id uint32) *SeriesUpdateOne
- func (c *SeriesClient) Use(hooks ...Hook)
- type SeriesCreate
- func (sc *SeriesCreate) AddDropIDs(ids ...uint32) *SeriesCreate
- func (sc *SeriesCreate) AddDrops(d ...*Drop) *SeriesCreate
- func (sc *SeriesCreate) Mutation() *SeriesMutation
- func (sc *SeriesCreate) Save(ctx context.Context) (*Series, error)
- func (sc *SeriesCreate) SaveX(ctx context.Context) *Series
- func (sc *SeriesCreate) SetID(u uint32) *SeriesCreate
- func (sc *SeriesCreate) SetName(s string) *SeriesCreate
- type SeriesCreateBulk
- type SeriesDelete
- type SeriesDeleteOne
- type SeriesEdges
- type SeriesGroupBy
- func (sgb *SeriesGroupBy) Aggregate(fns ...AggregateFunc) *SeriesGroupBy
- func (sgb *SeriesGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (sgb *SeriesGroupBy) BoolX(ctx context.Context) bool
- func (sgb *SeriesGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (sgb *SeriesGroupBy) BoolsX(ctx context.Context) []bool
- func (sgb *SeriesGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (sgb *SeriesGroupBy) Float64X(ctx context.Context) float64
- func (sgb *SeriesGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (sgb *SeriesGroupBy) Float64sX(ctx context.Context) []float64
- func (sgb *SeriesGroupBy) Int(ctx context.Context) (_ int, err error)
- func (sgb *SeriesGroupBy) IntX(ctx context.Context) int
- func (sgb *SeriesGroupBy) Ints(ctx context.Context) ([]int, error)
- func (sgb *SeriesGroupBy) IntsX(ctx context.Context) []int
- func (sgb *SeriesGroupBy) Scan(ctx context.Context, v interface{}) error
- func (sgb *SeriesGroupBy) ScanX(ctx context.Context, v interface{})
- func (sgb *SeriesGroupBy) String(ctx context.Context) (_ string, err error)
- func (sgb *SeriesGroupBy) StringX(ctx context.Context) string
- func (sgb *SeriesGroupBy) Strings(ctx context.Context) ([]string, error)
- func (sgb *SeriesGroupBy) StringsX(ctx context.Context) []string
- type SeriesMutation
- func (m *SeriesMutation) AddDropIDs(ids ...uint32)
- func (m *SeriesMutation) AddField(name string, value ent.Value) error
- func (m *SeriesMutation) AddedEdges() []string
- func (m *SeriesMutation) AddedField(name string) (ent.Value, bool)
- func (m *SeriesMutation) AddedFields() []string
- func (m *SeriesMutation) AddedIDs(name string) []ent.Value
- func (m *SeriesMutation) ClearDrops()
- func (m *SeriesMutation) ClearEdge(name string) error
- func (m *SeriesMutation) ClearField(name string) error
- func (m *SeriesMutation) ClearedEdges() []string
- func (m *SeriesMutation) ClearedFields() []string
- func (m SeriesMutation) Client() *Client
- func (m *SeriesMutation) DropsCleared() bool
- func (m *SeriesMutation) DropsIDs() (ids []uint32)
- func (m *SeriesMutation) EdgeCleared(name string) bool
- func (m *SeriesMutation) Field(name string) (ent.Value, bool)
- func (m *SeriesMutation) FieldCleared(name string) bool
- func (m *SeriesMutation) Fields() []string
- func (m *SeriesMutation) ID() (id uint32, exists bool)
- func (m *SeriesMutation) Name() (r string, exists bool)
- func (m *SeriesMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *SeriesMutation) OldName(ctx context.Context) (v string, err error)
- func (m *SeriesMutation) Op() Op
- func (m *SeriesMutation) RemoveDropIDs(ids ...uint32)
- func (m *SeriesMutation) RemovedDropsIDs() (ids []uint32)
- func (m *SeriesMutation) RemovedEdges() []string
- func (m *SeriesMutation) RemovedIDs(name string) []ent.Value
- func (m *SeriesMutation) ResetDrops()
- func (m *SeriesMutation) ResetEdge(name string) error
- func (m *SeriesMutation) ResetField(name string) error
- func (m *SeriesMutation) ResetName()
- func (m *SeriesMutation) SetField(name string, value ent.Value) error
- func (m *SeriesMutation) SetID(id uint32)
- func (m *SeriesMutation) SetName(s string)
- func (m SeriesMutation) Tx() (*Tx, error)
- func (m *SeriesMutation) Type() string
- type SeriesQuery
- func (sq *SeriesQuery) All(ctx context.Context) ([]*Series, error)
- func (sq *SeriesQuery) AllX(ctx context.Context) []*Series
- func (sq *SeriesQuery) Clone() *SeriesQuery
- func (sq *SeriesQuery) Count(ctx context.Context) (int, error)
- func (sq *SeriesQuery) CountX(ctx context.Context) int
- func (sq *SeriesQuery) Exist(ctx context.Context) (bool, error)
- func (sq *SeriesQuery) ExistX(ctx context.Context) bool
- func (sq *SeriesQuery) First(ctx context.Context) (*Series, error)
- func (sq *SeriesQuery) FirstID(ctx context.Context) (id uint32, err error)
- func (sq *SeriesQuery) FirstIDX(ctx context.Context) uint32
- func (sq *SeriesQuery) FirstX(ctx context.Context) *Series
- func (sq *SeriesQuery) GroupBy(field string, fields ...string) *SeriesGroupBy
- func (sq *SeriesQuery) IDs(ctx context.Context) ([]uint32, error)
- func (sq *SeriesQuery) IDsX(ctx context.Context) []uint32
- func (sq *SeriesQuery) Limit(limit int) *SeriesQuery
- func (sq *SeriesQuery) Offset(offset int) *SeriesQuery
- func (sq *SeriesQuery) Only(ctx context.Context) (*Series, error)
- func (sq *SeriesQuery) OnlyID(ctx context.Context) (id uint32, err error)
- func (sq *SeriesQuery) OnlyIDX(ctx context.Context) uint32
- func (sq *SeriesQuery) OnlyX(ctx context.Context) *Series
- func (sq *SeriesQuery) Order(o ...OrderFunc) *SeriesQuery
- func (sq *SeriesQuery) QueryDrops() *DropQuery
- func (sq *SeriesQuery) Select(field string, fields ...string) *SeriesSelect
- func (sq *SeriesQuery) Where(ps ...predicate.Series) *SeriesQuery
- func (sq *SeriesQuery) WithDrops(opts ...func(*DropQuery)) *SeriesQuery
- type SeriesSelect
- func (ss *SeriesSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ss *SeriesSelect) BoolX(ctx context.Context) bool
- func (ss *SeriesSelect) Bools(ctx context.Context) ([]bool, error)
- func (ss *SeriesSelect) BoolsX(ctx context.Context) []bool
- func (ss *SeriesSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ss *SeriesSelect) Float64X(ctx context.Context) float64
- func (ss *SeriesSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ss *SeriesSelect) Float64sX(ctx context.Context) []float64
- func (ss *SeriesSelect) Int(ctx context.Context) (_ int, err error)
- func (ss *SeriesSelect) IntX(ctx context.Context) int
- func (ss *SeriesSelect) Ints(ctx context.Context) ([]int, error)
- func (ss *SeriesSelect) IntsX(ctx context.Context) []int
- func (ss *SeriesSelect) Scan(ctx context.Context, v interface{}) error
- func (ss *SeriesSelect) ScanX(ctx context.Context, v interface{})
- func (ss *SeriesSelect) String(ctx context.Context) (_ string, err error)
- func (ss *SeriesSelect) StringX(ctx context.Context) string
- func (ss *SeriesSelect) Strings(ctx context.Context) ([]string, error)
- func (ss *SeriesSelect) StringsX(ctx context.Context) []string
- type SeriesSlice
- type SeriesUpdate
- func (su *SeriesUpdate) AddDropIDs(ids ...uint32) *SeriesUpdate
- func (su *SeriesUpdate) AddDrops(d ...*Drop) *SeriesUpdate
- func (su *SeriesUpdate) ClearDrops() *SeriesUpdate
- func (su *SeriesUpdate) Exec(ctx context.Context) error
- func (su *SeriesUpdate) ExecX(ctx context.Context)
- func (su *SeriesUpdate) Mutation() *SeriesMutation
- func (su *SeriesUpdate) RemoveDropIDs(ids ...uint32) *SeriesUpdate
- func (su *SeriesUpdate) RemoveDrops(d ...*Drop) *SeriesUpdate
- func (su *SeriesUpdate) Save(ctx context.Context) (int, error)
- func (su *SeriesUpdate) SaveX(ctx context.Context) int
- func (su *SeriesUpdate) SetName(s string) *SeriesUpdate
- func (su *SeriesUpdate) Where(ps ...predicate.Series) *SeriesUpdate
- type SeriesUpdateOne
- func (suo *SeriesUpdateOne) AddDropIDs(ids ...uint32) *SeriesUpdateOne
- func (suo *SeriesUpdateOne) AddDrops(d ...*Drop) *SeriesUpdateOne
- func (suo *SeriesUpdateOne) ClearDrops() *SeriesUpdateOne
- func (suo *SeriesUpdateOne) Exec(ctx context.Context) error
- func (suo *SeriesUpdateOne) ExecX(ctx context.Context)
- func (suo *SeriesUpdateOne) Mutation() *SeriesMutation
- func (suo *SeriesUpdateOne) RemoveDropIDs(ids ...uint32) *SeriesUpdateOne
- func (suo *SeriesUpdateOne) RemoveDrops(d ...*Drop) *SeriesUpdateOne
- func (suo *SeriesUpdateOne) Save(ctx context.Context) (*Series, error)
- func (suo *SeriesUpdateOne) SaveX(ctx context.Context) *Series
- func (suo *SeriesUpdateOne) SetName(s string) *SeriesUpdateOne
- 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. TypeDrop = "Drop" TypeSeries = "Series" )
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 validaton 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 // Drop is the client for interacting with the Drop builders. Drop *DropClient // Series is the client for interacting with the Series builders. Series *SeriesClient // 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(). Drop. Query(). Count(ctx)
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Drop ¶
type Drop struct { // ID of the ent. ID uint32 `json:"id,omitempty"` // ObjectID holds the value of the "object_id" field. ObjectID uint32 `json:"object_id,omitempty"` // Rate holds the value of the "rate" field. Rate float32 `json:"rate,omitempty"` // SeriesID holds the value of the "series_id" field. SeriesID uint32 `json:"series_id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the DropQuery when eager-loading is set. Edges DropEdges `json:"edges"` // contains filtered or unexported fields }
Drop is the model entity for the Drop schema.
func (*Drop) QuerySeries ¶
func (d *Drop) QuerySeries() *SeriesQuery
QuerySeries queries the "series" edge of the Drop entity.
func (*Drop) Unwrap ¶
Unwrap unwraps the Drop 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 (*Drop) Update ¶
func (d *Drop) Update() *DropUpdateOne
Update returns a builder for updating this Drop. Note that you need to call Drop.Unwrap() before calling this method if this Drop was returned from a transaction, and the transaction was committed or rolled back.
type DropClient ¶
type DropClient struct {
// contains filtered or unexported fields
}
DropClient is a client for the Drop schema.
func NewDropClient ¶
func NewDropClient(c config) *DropClient
NewDropClient returns a client for the Drop from the given config.
func (*DropClient) Create ¶
func (c *DropClient) Create() *DropCreate
Create returns a create builder for Drop.
func (*DropClient) CreateBulk ¶
func (c *DropClient) CreateBulk(builders ...*DropCreate) *DropCreateBulk
CreateBulk returns a builder for creating a bulk of Drop entities.
func (*DropClient) Delete ¶
func (c *DropClient) Delete() *DropDelete
Delete returns a delete builder for Drop.
func (*DropClient) DeleteOne ¶
func (c *DropClient) DeleteOne(d *Drop) *DropDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*DropClient) DeleteOneID ¶
func (c *DropClient) DeleteOneID(id uint32) *DropDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*DropClient) GetX ¶
func (c *DropClient) GetX(ctx context.Context, id uint32) *Drop
GetX is like Get, but panics if an error occurs.
func (*DropClient) Query ¶
func (c *DropClient) Query() *DropQuery
Query returns a query builder for Drop.
func (*DropClient) QuerySeries ¶
func (c *DropClient) QuerySeries(d *Drop) *SeriesQuery
QuerySeries queries the series edge of a Drop.
func (*DropClient) Update ¶
func (c *DropClient) Update() *DropUpdate
Update returns an update builder for Drop.
func (*DropClient) UpdateOne ¶
func (c *DropClient) UpdateOne(d *Drop) *DropUpdateOne
UpdateOne returns an update builder for the given entity.
func (*DropClient) UpdateOneID ¶
func (c *DropClient) UpdateOneID(id uint32) *DropUpdateOne
UpdateOneID returns an update builder for the given id.
func (*DropClient) Use ¶
func (c *DropClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `drop.Hooks(f(g(h())))`.
type DropCreate ¶
type DropCreate struct {
// contains filtered or unexported fields
}
DropCreate is the builder for creating a Drop entity.
func (*DropCreate) Mutation ¶
func (dc *DropCreate) Mutation() *DropMutation
Mutation returns the DropMutation object of the builder.
func (*DropCreate) Save ¶
func (dc *DropCreate) Save(ctx context.Context) (*Drop, error)
Save creates the Drop in the database.
func (*DropCreate) SaveX ¶
func (dc *DropCreate) SaveX(ctx context.Context) *Drop
SaveX calls Save and panics if Save returns an error.
func (*DropCreate) SetID ¶
func (dc *DropCreate) SetID(u uint32) *DropCreate
SetID sets the "id" field.
func (*DropCreate) SetObjectID ¶
func (dc *DropCreate) SetObjectID(u uint32) *DropCreate
SetObjectID sets the "object_id" field.
func (*DropCreate) SetRate ¶
func (dc *DropCreate) SetRate(f float32) *DropCreate
SetRate sets the "rate" field.
func (*DropCreate) SetSeries ¶
func (dc *DropCreate) SetSeries(s *Series) *DropCreate
SetSeries sets the "series" edge to the Series entity.
func (*DropCreate) SetSeriesID ¶
func (dc *DropCreate) SetSeriesID(u uint32) *DropCreate
SetSeriesID sets the "series_id" field.
type DropCreateBulk ¶
type DropCreateBulk struct {
// contains filtered or unexported fields
}
DropCreateBulk is the builder for creating many Drop entities in bulk.
type DropDelete ¶
type DropDelete struct {
// contains filtered or unexported fields
}
DropDelete is the builder for deleting a Drop entity.
func (*DropDelete) Exec ¶
func (dd *DropDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*DropDelete) ExecX ¶
func (dd *DropDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*DropDelete) Where ¶
func (dd *DropDelete) Where(ps ...predicate.Drop) *DropDelete
Where adds a new predicate to the DropDelete builder.
type DropDeleteOne ¶
type DropDeleteOne struct {
// contains filtered or unexported fields
}
DropDeleteOne is the builder for deleting a single Drop entity.
func (*DropDeleteOne) Exec ¶
func (ddo *DropDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*DropDeleteOne) ExecX ¶
func (ddo *DropDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type DropEdges ¶
type DropEdges struct { // Series holds the value of the series edge. Series *Series `json:"series,omitempty"` // contains filtered or unexported fields }
DropEdges holds the relations/edges for other nodes in the graph.
func (DropEdges) SeriesOrErr ¶
SeriesOrErr returns the Series value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type DropGroupBy ¶
type DropGroupBy struct {
// contains filtered or unexported fields
}
DropGroupBy is the group-by builder for Drop entities.
func (*DropGroupBy) Aggregate ¶
func (dgb *DropGroupBy) Aggregate(fns ...AggregateFunc) *DropGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*DropGroupBy) Bool ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) BoolX ¶
func (dgb *DropGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*DropGroupBy) Bools ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) BoolsX ¶
func (dgb *DropGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DropGroupBy) Float64 ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) Float64X ¶
func (dgb *DropGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*DropGroupBy) Float64s ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) Float64sX ¶
func (dgb *DropGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DropGroupBy) Int ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) IntX ¶
func (dgb *DropGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*DropGroupBy) Ints ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) IntsX ¶
func (dgb *DropGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DropGroupBy) Scan ¶
func (dgb *DropGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*DropGroupBy) ScanX ¶
func (dgb *DropGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*DropGroupBy) String ¶
func (dgb *DropGroupBy) 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 (*DropGroupBy) StringX ¶
func (dgb *DropGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type DropMutation ¶
type DropMutation struct {
// contains filtered or unexported fields
}
DropMutation represents an operation that mutates the Drop nodes in the graph.
func (*DropMutation) AddField ¶
func (m *DropMutation) 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 (*DropMutation) AddObjectID ¶
func (m *DropMutation) AddObjectID(u uint32)
AddObjectID adds u to the "object_id" field.
func (*DropMutation) AddRate ¶
func (m *DropMutation) AddRate(f float32)
AddRate adds f to the "rate" field.
func (*DropMutation) AddedEdges ¶
func (m *DropMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*DropMutation) AddedField ¶
func (m *DropMutation) 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 (*DropMutation) AddedFields ¶
func (m *DropMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*DropMutation) AddedIDs ¶
func (m *DropMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*DropMutation) AddedObjectID ¶
func (m *DropMutation) AddedObjectID() (r uint32, exists bool)
AddedObjectID returns the value that was added to the "object_id" field in this mutation.
func (*DropMutation) AddedRate ¶
func (m *DropMutation) AddedRate() (r float32, exists bool)
AddedRate returns the value that was added to the "rate" field in this mutation.
func (*DropMutation) ClearEdge ¶
func (m *DropMutation) 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 (*DropMutation) ClearField ¶
func (m *DropMutation) 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 (*DropMutation) ClearSeries ¶
func (m *DropMutation) ClearSeries()
ClearSeries clears the "series" edge to the Series entity.
func (*DropMutation) ClearedEdges ¶
func (m *DropMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*DropMutation) ClearedFields ¶
func (m *DropMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (DropMutation) Client ¶
func (m DropMutation) 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 (*DropMutation) EdgeCleared ¶
func (m *DropMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*DropMutation) Field ¶
func (m *DropMutation) 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 (*DropMutation) FieldCleared ¶
func (m *DropMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*DropMutation) Fields ¶
func (m *DropMutation) 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 (*DropMutation) ID ¶
func (m *DropMutation) ID() (id uint32, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*DropMutation) ObjectID ¶
func (m *DropMutation) ObjectID() (r uint32, exists bool)
ObjectID returns the value of the "object_id" field in the mutation.
func (*DropMutation) 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 (*DropMutation) OldObjectID ¶
func (m *DropMutation) OldObjectID(ctx context.Context) (v uint32, err error)
OldObjectID returns the old "object_id" field's value of the Drop entity. If the Drop 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 (*DropMutation) OldRate ¶
func (m *DropMutation) OldRate(ctx context.Context) (v float32, err error)
OldRate returns the old "rate" field's value of the Drop entity. If the Drop 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 (*DropMutation) OldSeriesID ¶
func (m *DropMutation) OldSeriesID(ctx context.Context) (v uint32, err error)
OldSeriesID returns the old "series_id" field's value of the Drop entity. If the Drop 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 (*DropMutation) Rate ¶
func (m *DropMutation) Rate() (r float32, exists bool)
Rate returns the value of the "rate" field in the mutation.
func (*DropMutation) RemovedEdges ¶
func (m *DropMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*DropMutation) RemovedIDs ¶
func (m *DropMutation) 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 (*DropMutation) ResetEdge ¶
func (m *DropMutation) 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 (*DropMutation) ResetField ¶
func (m *DropMutation) 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 (*DropMutation) ResetObjectID ¶
func (m *DropMutation) ResetObjectID()
ResetObjectID resets all changes to the "object_id" field.
func (*DropMutation) ResetRate ¶
func (m *DropMutation) ResetRate()
ResetRate resets all changes to the "rate" field.
func (*DropMutation) ResetSeries ¶
func (m *DropMutation) ResetSeries()
ResetSeries resets all changes to the "series" edge.
func (*DropMutation) ResetSeriesID ¶
func (m *DropMutation) ResetSeriesID()
ResetSeriesID resets all changes to the "series_id" field.
func (*DropMutation) SeriesCleared ¶
func (m *DropMutation) SeriesCleared() bool
SeriesCleared returns if the "series" edge to the Series entity was cleared.
func (*DropMutation) SeriesID ¶
func (m *DropMutation) SeriesID() (r uint32, exists bool)
SeriesID returns the value of the "series_id" field in the mutation.
func (*DropMutation) SeriesIDs ¶
func (m *DropMutation) SeriesIDs() (ids []uint32)
SeriesIDs returns the "series" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use SeriesID instead. It exists only for internal usage by the builders.
func (*DropMutation) SetField ¶
func (m *DropMutation) 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 (*DropMutation) SetID ¶
func (m *DropMutation) SetID(id uint32)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Drop entities.
func (*DropMutation) SetObjectID ¶
func (m *DropMutation) SetObjectID(u uint32)
SetObjectID sets the "object_id" field.
func (*DropMutation) SetRate ¶
func (m *DropMutation) SetRate(f float32)
SetRate sets the "rate" field.
func (*DropMutation) SetSeriesID ¶
func (m *DropMutation) SetSeriesID(u uint32)
SetSeriesID sets the "series_id" field.
func (DropMutation) Tx ¶
func (m DropMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*DropMutation) Type ¶
func (m *DropMutation) Type() string
Type returns the node type of this mutation (Drop).
type DropQuery ¶
type DropQuery struct {
// contains filtered or unexported fields
}
DropQuery is the builder for querying Drop entities.
func (*DropQuery) Clone ¶
Clone returns a duplicate of the DropQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*DropQuery) First ¶
First returns the first Drop entity from the query. Returns a *NotFoundError when no Drop was found.
func (*DropQuery) FirstID ¶
FirstID returns the first Drop ID from the query. Returns a *NotFoundError when no Drop ID was found.
func (*DropQuery) GroupBy ¶
func (dq *DropQuery) GroupBy(field string, fields ...string) *DropGroupBy
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 { ObjectID uint32 `json:"object_id,omitempty"` Count int `json:"count,omitempty"` } client.Drop.Query(). GroupBy(drop.FieldObjectID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*DropQuery) Only ¶
Only returns a single Drop entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Drop entity is not found. Returns a *NotFoundError when no Drop entities are found.
func (*DropQuery) OnlyID ¶
OnlyID is like Only, but returns the only Drop ID in the query. Returns a *NotSingularError when exactly one Drop ID is not found. Returns a *NotFoundError when no entities are found.
func (*DropQuery) QuerySeries ¶
func (dq *DropQuery) QuerySeries() *SeriesQuery
QuerySeries chains the current query on the "series" edge.
func (*DropQuery) Select ¶
func (dq *DropQuery) Select(field string, fields ...string) *DropSelect
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 { ObjectID uint32 `json:"object_id,omitempty"` } client.Drop.Query(). Select(drop.FieldObjectID). Scan(ctx, &v)
func (*DropQuery) WithSeries ¶
func (dq *DropQuery) WithSeries(opts ...func(*SeriesQuery)) *DropQuery
WithSeries tells the query-builder to eager-load the nodes that are connected to the "series" edge. The optional arguments are used to configure the query builder of the edge.
type DropSelect ¶
type DropSelect struct { *DropQuery // contains filtered or unexported fields }
DropSelect is the builder for selecting fields of Drop entities.
func (*DropSelect) Bool ¶
func (ds *DropSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*DropSelect) BoolX ¶
func (ds *DropSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*DropSelect) Bools ¶
func (ds *DropSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*DropSelect) BoolsX ¶
func (ds *DropSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DropSelect) Float64 ¶
func (ds *DropSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*DropSelect) Float64X ¶
func (ds *DropSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*DropSelect) Float64s ¶
func (ds *DropSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*DropSelect) Float64sX ¶
func (ds *DropSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DropSelect) Int ¶
func (ds *DropSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*DropSelect) IntX ¶
func (ds *DropSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*DropSelect) Ints ¶
func (ds *DropSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*DropSelect) IntsX ¶
func (ds *DropSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DropSelect) Scan ¶
func (ds *DropSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*DropSelect) ScanX ¶
func (ds *DropSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*DropSelect) String ¶
func (ds *DropSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*DropSelect) StringX ¶
func (ds *DropSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type DropUpdate ¶
type DropUpdate struct {
// contains filtered or unexported fields
}
DropUpdate is the builder for updating Drop entities.
func (*DropUpdate) AddObjectID ¶
func (du *DropUpdate) AddObjectID(u uint32) *DropUpdate
AddObjectID adds u to the "object_id" field.
func (*DropUpdate) AddRate ¶
func (du *DropUpdate) AddRate(f float32) *DropUpdate
AddRate adds f to the "rate" field.
func (*DropUpdate) ClearSeries ¶
func (du *DropUpdate) ClearSeries() *DropUpdate
ClearSeries clears the "series" edge to the Series entity.
func (*DropUpdate) Exec ¶
func (du *DropUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*DropUpdate) ExecX ¶
func (du *DropUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DropUpdate) Mutation ¶
func (du *DropUpdate) Mutation() *DropMutation
Mutation returns the DropMutation object of the builder.
func (*DropUpdate) Save ¶
func (du *DropUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*DropUpdate) SaveX ¶
func (du *DropUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*DropUpdate) SetObjectID ¶
func (du *DropUpdate) SetObjectID(u uint32) *DropUpdate
SetObjectID sets the "object_id" field.
func (*DropUpdate) SetRate ¶
func (du *DropUpdate) SetRate(f float32) *DropUpdate
SetRate sets the "rate" field.
func (*DropUpdate) SetSeries ¶
func (du *DropUpdate) SetSeries(s *Series) *DropUpdate
SetSeries sets the "series" edge to the Series entity.
func (*DropUpdate) SetSeriesID ¶
func (du *DropUpdate) SetSeriesID(u uint32) *DropUpdate
SetSeriesID sets the "series_id" field.
func (*DropUpdate) Where ¶
func (du *DropUpdate) Where(ps ...predicate.Drop) *DropUpdate
Where adds a new predicate for the DropUpdate builder.
type DropUpdateOne ¶
type DropUpdateOne struct {
// contains filtered or unexported fields
}
DropUpdateOne is the builder for updating a single Drop entity.
func (*DropUpdateOne) AddObjectID ¶
func (duo *DropUpdateOne) AddObjectID(u uint32) *DropUpdateOne
AddObjectID adds u to the "object_id" field.
func (*DropUpdateOne) AddRate ¶
func (duo *DropUpdateOne) AddRate(f float32) *DropUpdateOne
AddRate adds f to the "rate" field.
func (*DropUpdateOne) ClearSeries ¶
func (duo *DropUpdateOne) ClearSeries() *DropUpdateOne
ClearSeries clears the "series" edge to the Series entity.
func (*DropUpdateOne) Exec ¶
func (duo *DropUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*DropUpdateOne) ExecX ¶
func (duo *DropUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DropUpdateOne) Mutation ¶
func (duo *DropUpdateOne) Mutation() *DropMutation
Mutation returns the DropMutation object of the builder.
func (*DropUpdateOne) Save ¶
func (duo *DropUpdateOne) Save(ctx context.Context) (*Drop, error)
Save executes the query and returns the updated Drop entity.
func (*DropUpdateOne) SaveX ¶
func (duo *DropUpdateOne) SaveX(ctx context.Context) *Drop
SaveX is like Save, but panics if an error occurs.
func (*DropUpdateOne) SetObjectID ¶
func (duo *DropUpdateOne) SetObjectID(u uint32) *DropUpdateOne
SetObjectID sets the "object_id" field.
func (*DropUpdateOne) SetRate ¶
func (duo *DropUpdateOne) SetRate(f float32) *DropUpdateOne
SetRate sets the "rate" field.
func (*DropUpdateOne) SetSeries ¶
func (duo *DropUpdateOne) SetSeries(s *Series) *DropUpdateOne
SetSeries sets the "series" edge to the Series entity.
func (*DropUpdateOne) SetSeriesID ¶
func (duo *DropUpdateOne) SetSeriesID(u uint32) *DropUpdateOne
SetSeriesID sets the "series_id" field.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollbacker method.
type Series ¶
type Series struct { // ID of the ent. ID uint32 `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SeriesQuery when eager-loading is set. Edges SeriesEdges `json:"edges"` // contains filtered or unexported fields }
Series is the model entity for the Series schema.
func (*Series) QueryDrops ¶
QueryDrops queries the "drops" edge of the Series entity.
func (*Series) Unwrap ¶
Unwrap unwraps the Series 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 (*Series) Update ¶
func (s *Series) Update() *SeriesUpdateOne
Update returns a builder for updating this Series. Note that you need to call Series.Unwrap() before calling this method if this Series was returned from a transaction, and the transaction was committed or rolled back.
type SeriesClient ¶
type SeriesClient struct {
// contains filtered or unexported fields
}
SeriesClient is a client for the Series schema.
func NewSeriesClient ¶
func NewSeriesClient(c config) *SeriesClient
NewSeriesClient returns a client for the Series from the given config.
func (*SeriesClient) Create ¶
func (c *SeriesClient) Create() *SeriesCreate
Create returns a create builder for Series.
func (*SeriesClient) CreateBulk ¶
func (c *SeriesClient) CreateBulk(builders ...*SeriesCreate) *SeriesCreateBulk
CreateBulk returns a builder for creating a bulk of Series entities.
func (*SeriesClient) Delete ¶
func (c *SeriesClient) Delete() *SeriesDelete
Delete returns a delete builder for Series.
func (*SeriesClient) DeleteOne ¶
func (c *SeriesClient) DeleteOne(s *Series) *SeriesDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*SeriesClient) DeleteOneID ¶
func (c *SeriesClient) DeleteOneID(id uint32) *SeriesDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*SeriesClient) GetX ¶
func (c *SeriesClient) GetX(ctx context.Context, id uint32) *Series
GetX is like Get, but panics if an error occurs.
func (*SeriesClient) Query ¶
func (c *SeriesClient) Query() *SeriesQuery
Query returns a query builder for Series.
func (*SeriesClient) QueryDrops ¶
func (c *SeriesClient) QueryDrops(s *Series) *DropQuery
QueryDrops queries the drops edge of a Series.
func (*SeriesClient) Update ¶
func (c *SeriesClient) Update() *SeriesUpdate
Update returns an update builder for Series.
func (*SeriesClient) UpdateOne ¶
func (c *SeriesClient) UpdateOne(s *Series) *SeriesUpdateOne
UpdateOne returns an update builder for the given entity.
func (*SeriesClient) UpdateOneID ¶
func (c *SeriesClient) UpdateOneID(id uint32) *SeriesUpdateOne
UpdateOneID returns an update builder for the given id.
func (*SeriesClient) Use ¶
func (c *SeriesClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `series.Hooks(f(g(h())))`.
type SeriesCreate ¶
type SeriesCreate struct {
// contains filtered or unexported fields
}
SeriesCreate is the builder for creating a Series entity.
func (*SeriesCreate) AddDropIDs ¶
func (sc *SeriesCreate) AddDropIDs(ids ...uint32) *SeriesCreate
AddDropIDs adds the "drops" edge to the Drop entity by IDs.
func (*SeriesCreate) AddDrops ¶
func (sc *SeriesCreate) AddDrops(d ...*Drop) *SeriesCreate
AddDrops adds the "drops" edges to the Drop entity.
func (*SeriesCreate) Mutation ¶
func (sc *SeriesCreate) Mutation() *SeriesMutation
Mutation returns the SeriesMutation object of the builder.
func (*SeriesCreate) Save ¶
func (sc *SeriesCreate) Save(ctx context.Context) (*Series, error)
Save creates the Series in the database.
func (*SeriesCreate) SaveX ¶
func (sc *SeriesCreate) SaveX(ctx context.Context) *Series
SaveX calls Save and panics if Save returns an error.
func (*SeriesCreate) SetID ¶
func (sc *SeriesCreate) SetID(u uint32) *SeriesCreate
SetID sets the "id" field.
func (*SeriesCreate) SetName ¶
func (sc *SeriesCreate) SetName(s string) *SeriesCreate
SetName sets the "name" field.
type SeriesCreateBulk ¶
type SeriesCreateBulk struct {
// contains filtered or unexported fields
}
SeriesCreateBulk is the builder for creating many Series entities in bulk.
type SeriesDelete ¶
type SeriesDelete struct {
// contains filtered or unexported fields
}
SeriesDelete is the builder for deleting a Series entity.
func (*SeriesDelete) Exec ¶
func (sd *SeriesDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*SeriesDelete) ExecX ¶
func (sd *SeriesDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*SeriesDelete) Where ¶
func (sd *SeriesDelete) Where(ps ...predicate.Series) *SeriesDelete
Where adds a new predicate to the SeriesDelete builder.
type SeriesDeleteOne ¶
type SeriesDeleteOne struct {
// contains filtered or unexported fields
}
SeriesDeleteOne is the builder for deleting a single Series entity.
func (*SeriesDeleteOne) Exec ¶
func (sdo *SeriesDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*SeriesDeleteOne) ExecX ¶
func (sdo *SeriesDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type SeriesEdges ¶
type SeriesEdges struct { // Drops holds the value of the drops edge. Drops []*Drop `json:"drops,omitempty"` // contains filtered or unexported fields }
SeriesEdges holds the relations/edges for other nodes in the graph.
func (SeriesEdges) DropsOrErr ¶
func (e SeriesEdges) DropsOrErr() ([]*Drop, error)
DropsOrErr returns the Drops value or an error if the edge was not loaded in eager-loading.
type SeriesGroupBy ¶
type SeriesGroupBy struct {
// contains filtered or unexported fields
}
SeriesGroupBy is the group-by builder for Series entities.
func (*SeriesGroupBy) Aggregate ¶
func (sgb *SeriesGroupBy) Aggregate(fns ...AggregateFunc) *SeriesGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*SeriesGroupBy) Bool ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) BoolX ¶
func (sgb *SeriesGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*SeriesGroupBy) Bools ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) BoolsX ¶
func (sgb *SeriesGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*SeriesGroupBy) Float64 ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) Float64X ¶
func (sgb *SeriesGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*SeriesGroupBy) Float64s ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) Float64sX ¶
func (sgb *SeriesGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*SeriesGroupBy) Int ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) IntX ¶
func (sgb *SeriesGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*SeriesGroupBy) Ints ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) IntsX ¶
func (sgb *SeriesGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*SeriesGroupBy) Scan ¶
func (sgb *SeriesGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*SeriesGroupBy) ScanX ¶
func (sgb *SeriesGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*SeriesGroupBy) String ¶
func (sgb *SeriesGroupBy) 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 (*SeriesGroupBy) StringX ¶
func (sgb *SeriesGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type SeriesMutation ¶
type SeriesMutation struct {
// contains filtered or unexported fields
}
SeriesMutation represents an operation that mutates the Series nodes in the graph.
func (*SeriesMutation) AddDropIDs ¶
func (m *SeriesMutation) AddDropIDs(ids ...uint32)
AddDropIDs adds the "drops" edge to the Drop entity by ids.
func (*SeriesMutation) AddField ¶
func (m *SeriesMutation) 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 (*SeriesMutation) AddedEdges ¶
func (m *SeriesMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*SeriesMutation) AddedField ¶
func (m *SeriesMutation) 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 (*SeriesMutation) AddedFields ¶
func (m *SeriesMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*SeriesMutation) AddedIDs ¶
func (m *SeriesMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*SeriesMutation) ClearDrops ¶
func (m *SeriesMutation) ClearDrops()
ClearDrops clears the "drops" edge to the Drop entity.
func (*SeriesMutation) ClearEdge ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ClearField ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ClearedEdges ¶
func (m *SeriesMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*SeriesMutation) ClearedFields ¶
func (m *SeriesMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (SeriesMutation) Client ¶
func (m SeriesMutation) 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 (*SeriesMutation) DropsCleared ¶
func (m *SeriesMutation) DropsCleared() bool
DropsCleared returns if the "drops" edge to the Drop entity was cleared.
func (*SeriesMutation) DropsIDs ¶
func (m *SeriesMutation) DropsIDs() (ids []uint32)
DropsIDs returns the "drops" edge IDs in the mutation.
func (*SeriesMutation) EdgeCleared ¶
func (m *SeriesMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*SeriesMutation) Field ¶
func (m *SeriesMutation) 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 (*SeriesMutation) FieldCleared ¶
func (m *SeriesMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*SeriesMutation) Fields ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ID ¶
func (m *SeriesMutation) ID() (id uint32, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*SeriesMutation) Name ¶
func (m *SeriesMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*SeriesMutation) 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 (*SeriesMutation) OldName ¶
func (m *SeriesMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Series entity. If the Series 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 (*SeriesMutation) RemoveDropIDs ¶
func (m *SeriesMutation) RemoveDropIDs(ids ...uint32)
RemoveDropIDs removes the "drops" edge to the Drop entity by IDs.
func (*SeriesMutation) RemovedDropsIDs ¶
func (m *SeriesMutation) RemovedDropsIDs() (ids []uint32)
RemovedDrops returns the removed IDs of the "drops" edge to the Drop entity.
func (*SeriesMutation) RemovedEdges ¶
func (m *SeriesMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*SeriesMutation) RemovedIDs ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ResetDrops ¶
func (m *SeriesMutation) ResetDrops()
ResetDrops resets all changes to the "drops" edge.
func (*SeriesMutation) ResetEdge ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ResetField ¶
func (m *SeriesMutation) 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 (*SeriesMutation) ResetName ¶
func (m *SeriesMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*SeriesMutation) SetField ¶
func (m *SeriesMutation) 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 (*SeriesMutation) SetID ¶
func (m *SeriesMutation) SetID(id uint32)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Series entities.
func (*SeriesMutation) SetName ¶
func (m *SeriesMutation) SetName(s string)
SetName sets the "name" field.
func (SeriesMutation) Tx ¶
func (m SeriesMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*SeriesMutation) Type ¶
func (m *SeriesMutation) Type() string
Type returns the node type of this mutation (Series).
type SeriesQuery ¶
type SeriesQuery struct {
// contains filtered or unexported fields
}
SeriesQuery is the builder for querying Series entities.
func (*SeriesQuery) All ¶
func (sq *SeriesQuery) All(ctx context.Context) ([]*Series, error)
All executes the query and returns a list of SeriesSlice.
func (*SeriesQuery) AllX ¶
func (sq *SeriesQuery) AllX(ctx context.Context) []*Series
AllX is like All, but panics if an error occurs.
func (*SeriesQuery) Clone ¶
func (sq *SeriesQuery) Clone() *SeriesQuery
Clone returns a duplicate of the SeriesQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*SeriesQuery) Count ¶
func (sq *SeriesQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*SeriesQuery) CountX ¶
func (sq *SeriesQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*SeriesQuery) Exist ¶
func (sq *SeriesQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*SeriesQuery) ExistX ¶
func (sq *SeriesQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*SeriesQuery) First ¶
func (sq *SeriesQuery) First(ctx context.Context) (*Series, error)
First returns the first Series entity from the query. Returns a *NotFoundError when no Series was found.
func (*SeriesQuery) FirstID ¶
func (sq *SeriesQuery) FirstID(ctx context.Context) (id uint32, err error)
FirstID returns the first Series ID from the query. Returns a *NotFoundError when no Series ID was found.
func (*SeriesQuery) FirstIDX ¶
func (sq *SeriesQuery) FirstIDX(ctx context.Context) uint32
FirstIDX is like FirstID, but panics if an error occurs.
func (*SeriesQuery) FirstX ¶
func (sq *SeriesQuery) FirstX(ctx context.Context) *Series
FirstX is like First, but panics if an error occurs.
func (*SeriesQuery) GroupBy ¶
func (sq *SeriesQuery) GroupBy(field string, fields ...string) *SeriesGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Series.Query(). GroupBy(series.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*SeriesQuery) IDs ¶
func (sq *SeriesQuery) IDs(ctx context.Context) ([]uint32, error)
IDs executes the query and returns a list of Series IDs.
func (*SeriesQuery) IDsX ¶
func (sq *SeriesQuery) IDsX(ctx context.Context) []uint32
IDsX is like IDs, but panics if an error occurs.
func (*SeriesQuery) Limit ¶
func (sq *SeriesQuery) Limit(limit int) *SeriesQuery
Limit adds a limit step to the query.
func (*SeriesQuery) Offset ¶
func (sq *SeriesQuery) Offset(offset int) *SeriesQuery
Offset adds an offset step to the query.
func (*SeriesQuery) Only ¶
func (sq *SeriesQuery) Only(ctx context.Context) (*Series, error)
Only returns a single Series entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Series entity is not found. Returns a *NotFoundError when no Series entities are found.
func (*SeriesQuery) OnlyID ¶
func (sq *SeriesQuery) OnlyID(ctx context.Context) (id uint32, err error)
OnlyID is like Only, but returns the only Series ID in the query. Returns a *NotSingularError when exactly one Series ID is not found. Returns a *NotFoundError when no entities are found.
func (*SeriesQuery) OnlyIDX ¶
func (sq *SeriesQuery) OnlyIDX(ctx context.Context) uint32
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*SeriesQuery) OnlyX ¶
func (sq *SeriesQuery) OnlyX(ctx context.Context) *Series
OnlyX is like Only, but panics if an error occurs.
func (*SeriesQuery) Order ¶
func (sq *SeriesQuery) Order(o ...OrderFunc) *SeriesQuery
Order adds an order step to the query.
func (*SeriesQuery) QueryDrops ¶
func (sq *SeriesQuery) QueryDrops() *DropQuery
QueryDrops chains the current query on the "drops" edge.
func (*SeriesQuery) Select ¶
func (sq *SeriesQuery) Select(field string, fields ...string) *SeriesSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Series.Query(). Select(series.FieldName). Scan(ctx, &v)
func (*SeriesQuery) Where ¶
func (sq *SeriesQuery) Where(ps ...predicate.Series) *SeriesQuery
Where adds a new predicate for the SeriesQuery builder.
func (*SeriesQuery) WithDrops ¶
func (sq *SeriesQuery) WithDrops(opts ...func(*DropQuery)) *SeriesQuery
WithDrops tells the query-builder to eager-load the nodes that are connected to the "drops" edge. The optional arguments are used to configure the query builder of the edge.
type SeriesSelect ¶
type SeriesSelect struct { *SeriesQuery // contains filtered or unexported fields }
SeriesSelect is the builder for selecting fields of Series entities.
func (*SeriesSelect) Bool ¶
func (ss *SeriesSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) BoolX ¶
func (ss *SeriesSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*SeriesSelect) Bools ¶
func (ss *SeriesSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) BoolsX ¶
func (ss *SeriesSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*SeriesSelect) Float64 ¶
func (ss *SeriesSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) Float64X ¶
func (ss *SeriesSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*SeriesSelect) Float64s ¶
func (ss *SeriesSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) Float64sX ¶
func (ss *SeriesSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*SeriesSelect) Int ¶
func (ss *SeriesSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) IntX ¶
func (ss *SeriesSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*SeriesSelect) Ints ¶
func (ss *SeriesSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) IntsX ¶
func (ss *SeriesSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*SeriesSelect) Scan ¶
func (ss *SeriesSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*SeriesSelect) ScanX ¶
func (ss *SeriesSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*SeriesSelect) String ¶
func (ss *SeriesSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*SeriesSelect) StringX ¶
func (ss *SeriesSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type SeriesUpdate ¶
type SeriesUpdate struct {
// contains filtered or unexported fields
}
SeriesUpdate is the builder for updating Series entities.
func (*SeriesUpdate) AddDropIDs ¶
func (su *SeriesUpdate) AddDropIDs(ids ...uint32) *SeriesUpdate
AddDropIDs adds the "drops" edge to the Drop entity by IDs.
func (*SeriesUpdate) AddDrops ¶
func (su *SeriesUpdate) AddDrops(d ...*Drop) *SeriesUpdate
AddDrops adds the "drops" edges to the Drop entity.
func (*SeriesUpdate) ClearDrops ¶
func (su *SeriesUpdate) ClearDrops() *SeriesUpdate
ClearDrops clears all "drops" edges to the Drop entity.
func (*SeriesUpdate) Exec ¶
func (su *SeriesUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*SeriesUpdate) ExecX ¶
func (su *SeriesUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SeriesUpdate) Mutation ¶
func (su *SeriesUpdate) Mutation() *SeriesMutation
Mutation returns the SeriesMutation object of the builder.
func (*SeriesUpdate) RemoveDropIDs ¶
func (su *SeriesUpdate) RemoveDropIDs(ids ...uint32) *SeriesUpdate
RemoveDropIDs removes the "drops" edge to Drop entities by IDs.
func (*SeriesUpdate) RemoveDrops ¶
func (su *SeriesUpdate) RemoveDrops(d ...*Drop) *SeriesUpdate
RemoveDrops removes "drops" edges to Drop entities.
func (*SeriesUpdate) Save ¶
func (su *SeriesUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*SeriesUpdate) SaveX ¶
func (su *SeriesUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*SeriesUpdate) SetName ¶
func (su *SeriesUpdate) SetName(s string) *SeriesUpdate
SetName sets the "name" field.
func (*SeriesUpdate) Where ¶
func (su *SeriesUpdate) Where(ps ...predicate.Series) *SeriesUpdate
Where adds a new predicate for the SeriesUpdate builder.
type SeriesUpdateOne ¶
type SeriesUpdateOne struct {
// contains filtered or unexported fields
}
SeriesUpdateOne is the builder for updating a single Series entity.
func (*SeriesUpdateOne) AddDropIDs ¶
func (suo *SeriesUpdateOne) AddDropIDs(ids ...uint32) *SeriesUpdateOne
AddDropIDs adds the "drops" edge to the Drop entity by IDs.
func (*SeriesUpdateOne) AddDrops ¶
func (suo *SeriesUpdateOne) AddDrops(d ...*Drop) *SeriesUpdateOne
AddDrops adds the "drops" edges to the Drop entity.
func (*SeriesUpdateOne) ClearDrops ¶
func (suo *SeriesUpdateOne) ClearDrops() *SeriesUpdateOne
ClearDrops clears all "drops" edges to the Drop entity.
func (*SeriesUpdateOne) Exec ¶
func (suo *SeriesUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*SeriesUpdateOne) ExecX ¶
func (suo *SeriesUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SeriesUpdateOne) Mutation ¶
func (suo *SeriesUpdateOne) Mutation() *SeriesMutation
Mutation returns the SeriesMutation object of the builder.
func (*SeriesUpdateOne) RemoveDropIDs ¶
func (suo *SeriesUpdateOne) RemoveDropIDs(ids ...uint32) *SeriesUpdateOne
RemoveDropIDs removes the "drops" edge to Drop entities by IDs.
func (*SeriesUpdateOne) RemoveDrops ¶
func (suo *SeriesUpdateOne) RemoveDrops(d ...*Drop) *SeriesUpdateOne
RemoveDrops removes "drops" edges to Drop entities.
func (*SeriesUpdateOne) Save ¶
func (suo *SeriesUpdateOne) Save(ctx context.Context) (*Series, error)
Save executes the query and returns the updated Series entity.
func (*SeriesUpdateOne) SaveX ¶
func (suo *SeriesUpdateOne) SaveX(ctx context.Context) *Series
SaveX is like Save, but panics if an error occurs.
func (*SeriesUpdateOne) SetName ¶
func (suo *SeriesUpdateOne) SetName(s string) *SeriesUpdateOne
SetName sets the "name" field.
type Tx ¶
type Tx struct { // Drop is the client for interacting with the Drop builders. Drop *DropClient // Series is the client for interacting with the Series builders. Series *SeriesClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.