ent

package
v0.0.0-...-eb3c888 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validaton error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector, func(string) bool) string

AggregateFunc 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)

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

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

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) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Drop.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

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.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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 Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Committer method.

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) String

func (d *Drop) String() string

String implements the fmt.Stringer.

func (*Drop) Unwrap

func (d *Drop) Unwrap() *Drop

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) Get

func (c *DropClient) Get(ctx context.Context, id uint32) (*Drop, error)

Get returns a Drop entity by its 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) Hooks

func (c *DropClient) Hooks() []Hook

Hooks returns the client hooks.

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.

func (*DropCreateBulk) Save

func (dcb *DropCreateBulk) Save(ctx context.Context) ([]*Drop, error)

Save creates the Drop entities in the database.

func (*DropCreateBulk) SaveX

func (dcb *DropCreateBulk) SaveX(ctx context.Context) []*Drop

SaveX is like Save, but panics if an error occurs.

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

func (e DropEdges) SeriesOrErr() (*Series, error)

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.

func (*DropGroupBy) Strings

func (dgb *DropGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*DropGroupBy) StringsX

func (dgb *DropGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

func (m *DropMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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) Op

func (m *DropMutation) Op() Op

Op returns the operation name.

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) All

func (dq *DropQuery) All(ctx context.Context) ([]*Drop, error)

All executes the query and returns a list of Drops.

func (*DropQuery) AllX

func (dq *DropQuery) AllX(ctx context.Context) []*Drop

AllX is like All, but panics if an error occurs.

func (*DropQuery) Clone

func (dq *DropQuery) Clone() *DropQuery

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) Count

func (dq *DropQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DropQuery) CountX

func (dq *DropQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*DropQuery) Exist

func (dq *DropQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*DropQuery) ExistX

func (dq *DropQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*DropQuery) First

func (dq *DropQuery) First(ctx context.Context) (*Drop, error)

First returns the first Drop entity from the query. Returns a *NotFoundError when no Drop was found.

func (*DropQuery) FirstID

func (dq *DropQuery) FirstID(ctx context.Context) (id uint32, err error)

FirstID returns the first Drop ID from the query. Returns a *NotFoundError when no Drop ID was found.

func (*DropQuery) FirstIDX

func (dq *DropQuery) FirstIDX(ctx context.Context) uint32

FirstIDX is like FirstID, but panics if an error occurs.

func (*DropQuery) FirstX

func (dq *DropQuery) FirstX(ctx context.Context) *Drop

FirstX is like First, but panics if an error occurs.

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) IDs

func (dq *DropQuery) IDs(ctx context.Context) ([]uint32, error)

IDs executes the query and returns a list of Drop IDs.

func (*DropQuery) IDsX

func (dq *DropQuery) IDsX(ctx context.Context) []uint32

IDsX is like IDs, but panics if an error occurs.

func (*DropQuery) Limit

func (dq *DropQuery) Limit(limit int) *DropQuery

Limit adds a limit step to the query.

func (*DropQuery) Offset

func (dq *DropQuery) Offset(offset int) *DropQuery

Offset adds an offset step to the query.

func (*DropQuery) Only

func (dq *DropQuery) Only(ctx context.Context) (*Drop, error)

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

func (dq *DropQuery) OnlyID(ctx context.Context) (id uint32, err error)

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) OnlyIDX

func (dq *DropQuery) OnlyIDX(ctx context.Context) uint32

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*DropQuery) OnlyX

func (dq *DropQuery) OnlyX(ctx context.Context) *Drop

OnlyX is like Only, but panics if an error occurs.

func (*DropQuery) Order

func (dq *DropQuery) Order(o ...OrderFunc) *DropQuery

Order adds an order step to the query.

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) Where

func (dq *DropQuery) Where(ps ...predicate.Drop) *DropQuery

Where adds a new predicate for the DropQuery builder.

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.

func (*DropSelect) Strings

func (ds *DropSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*DropSelect) StringsX

func (ds *DropSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, 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 Drops

type Drops []*Drop

Drops is a parsable slice of Drop.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

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 Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

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.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

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

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

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

func (s *Series) QueryDrops() *DropQuery

QueryDrops queries the "drops" edge of the Series entity.

func (*Series) String

func (s *Series) String() string

String implements the fmt.Stringer.

func (*Series) Unwrap

func (s *Series) Unwrap() *Series

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) Get

func (c *SeriesClient) Get(ctx context.Context, id uint32) (*Series, error)

Get returns a Series entity by its 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) Hooks

func (c *SeriesClient) Hooks() []Hook

Hooks returns the client hooks.

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.

func (*SeriesCreateBulk) Save

func (scb *SeriesCreateBulk) Save(ctx context.Context) ([]*Series, error)

Save creates the Series entities in the database.

func (*SeriesCreateBulk) SaveX

func (scb *SeriesCreateBulk) SaveX(ctx context.Context) []*Series

SaveX is like Save, but panics if an error occurs.

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.

func (*SeriesGroupBy) Strings

func (sgb *SeriesGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*SeriesGroupBy) StringsX

func (sgb *SeriesGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

func (m *SeriesMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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) Op

func (m *SeriesMutation) Op() Op

Op returns the operation name.

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.

func (*SeriesSelect) Strings

func (ss *SeriesSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*SeriesSelect) StringsX

func (ss *SeriesSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type SeriesSlice

type SeriesSlice []*Series

SeriesSlice is a parsable slice of Series.

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

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

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.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL