ent

package
v0.0.0-...-acbaf2f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT, MIT Imports: 19 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.
	TypeOrder        = "Order"
	TypeSeckillGoods = "SeckillGoods"
	TypeSeckillOrder = "SeckillOrder"
)

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) 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
	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// SeckillGoods is the client for interacting with the SeckillGoods builders.
	SeckillGoods *SeckillGoodsClient
	// SeckillOrder is the client for interacting with the SeckillOrder builders.
	SeckillOrder *SeckillOrderClient
	// 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().
	Order.
	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 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 Order

type Order struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// Sn holds the value of the "sn" field.
	Sn string `json:"sn,omitempty"`
	// Gid holds the value of the "gid" field.
	Gid int64 `json:"gid,omitempty"`
	// UID holds the value of the "uid" field.
	UID int64 `json:"uid,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

Order is the model entity for the Order schema.

func (*Order) String

func (o *Order) String() string

String implements the fmt.Stringer.

func (*Order) Unwrap

func (o *Order) Unwrap() *Order

Unwrap unwraps the Order 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 (*Order) Update

func (o *Order) Update() *OrderUpdateOne

Update returns a builder for updating this Order. Note that you need to call Order.Unwrap() before calling this method if this Order was returned from a transaction, and the transaction was committed or rolled back.

type OrderClient

type OrderClient struct {
	// contains filtered or unexported fields
}

OrderClient is a client for the Order schema.

func NewOrderClient

func NewOrderClient(c config) *OrderClient

NewOrderClient returns a client for the Order from the given config.

func (*OrderClient) Create

func (c *OrderClient) Create() *OrderCreate

Create returns a create builder for Order.

func (*OrderClient) CreateBulk

func (c *OrderClient) CreateBulk(builders ...*OrderCreate) *OrderCreateBulk

CreateBulk returns a builder for creating a bulk of Order entities.

func (*OrderClient) Delete

func (c *OrderClient) Delete() *OrderDelete

Delete returns a delete builder for Order.

func (*OrderClient) DeleteOne

func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*OrderClient) DeleteOneID

func (c *OrderClient) DeleteOneID(id int64) *OrderDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*OrderClient) Get

func (c *OrderClient) Get(ctx context.Context, id int64) (*Order, error)

Get returns a Order entity by its id.

func (*OrderClient) GetX

func (c *OrderClient) GetX(ctx context.Context, id int64) *Order

GetX is like Get, but panics if an error occurs.

func (*OrderClient) Hooks

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

Hooks returns the client hooks.

func (*OrderClient) Query

func (c *OrderClient) Query() *OrderQuery

Query returns a query builder for Order.

func (*OrderClient) Update

func (c *OrderClient) Update() *OrderUpdate

Update returns an update builder for Order.

func (*OrderClient) UpdateOne

func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne

UpdateOne returns an update builder for the given entity.

func (*OrderClient) UpdateOneID

func (c *OrderClient) UpdateOneID(id int64) *OrderUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OrderClient) Use

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

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `order.Hooks(f(g(h())))`.

type OrderCreate

type OrderCreate struct {
	// contains filtered or unexported fields
}

OrderCreate is the builder for creating a Order entity.

func (*OrderCreate) Mutation

func (oc *OrderCreate) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderCreate) Save

func (oc *OrderCreate) Save(ctx context.Context) (*Order, error)

Save creates the Order in the database.

func (*OrderCreate) SaveX

func (oc *OrderCreate) SaveX(ctx context.Context) *Order

SaveX calls Save and panics if Save returns an error.

func (*OrderCreate) SetCreatedAt

func (oc *OrderCreate) SetCreatedAt(t time.Time) *OrderCreate

SetCreatedAt sets the "created_at" field.

func (*OrderCreate) SetGid

func (oc *OrderCreate) SetGid(i int64) *OrderCreate

SetGid sets the "gid" field.

func (*OrderCreate) SetID

func (oc *OrderCreate) SetID(i int64) *OrderCreate

SetID sets the "id" field.

func (*OrderCreate) SetNillableCreatedAt

func (oc *OrderCreate) SetNillableCreatedAt(t *time.Time) *OrderCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*OrderCreate) SetNillableUpdatedAt

func (oc *OrderCreate) SetNillableUpdatedAt(t *time.Time) *OrderCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*OrderCreate) SetSn

func (oc *OrderCreate) SetSn(s string) *OrderCreate

SetSn sets the "sn" field.

func (*OrderCreate) SetUID

func (oc *OrderCreate) SetUID(i int64) *OrderCreate

SetUID sets the "uid" field.

func (*OrderCreate) SetUpdatedAt

func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate

SetUpdatedAt sets the "updated_at" field.

type OrderCreateBulk

type OrderCreateBulk struct {
	// contains filtered or unexported fields
}

OrderCreateBulk is the builder for creating many Order entities in bulk.

func (*OrderCreateBulk) Save

func (ocb *OrderCreateBulk) Save(ctx context.Context) ([]*Order, error)

Save creates the Order entities in the database.

func (*OrderCreateBulk) SaveX

func (ocb *OrderCreateBulk) SaveX(ctx context.Context) []*Order

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

type OrderDelete

type OrderDelete struct {
	// contains filtered or unexported fields
}

OrderDelete is the builder for deleting a Order entity.

func (*OrderDelete) Exec

func (od *OrderDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*OrderDelete) ExecX

func (od *OrderDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*OrderDelete) Where

func (od *OrderDelete) Where(ps ...predicate.Order) *OrderDelete

Where adds a new predicate to the OrderDelete builder.

type OrderDeleteOne

type OrderDeleteOne struct {
	// contains filtered or unexported fields
}

OrderDeleteOne is the builder for deleting a single Order entity.

func (*OrderDeleteOne) Exec

func (odo *OrderDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OrderDeleteOne) ExecX

func (odo *OrderDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type OrderFunc

type OrderFunc func(*sql.Selector)

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 OrderGroupBy

type OrderGroupBy struct {
	// contains filtered or unexported fields
}

OrderGroupBy is the group-by builder for Order entities.

func (*OrderGroupBy) Aggregate

func (ogb *OrderGroupBy) Aggregate(fns ...AggregateFunc) *OrderGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*OrderGroupBy) Bool

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) BoolX

func (ogb *OrderGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*OrderGroupBy) Bools

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) BoolsX

func (ogb *OrderGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*OrderGroupBy) Float64

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) Float64X

func (ogb *OrderGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*OrderGroupBy) Float64s

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) Float64sX

func (ogb *OrderGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*OrderGroupBy) Int

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) IntX

func (ogb *OrderGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*OrderGroupBy) Ints

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) IntsX

func (ogb *OrderGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*OrderGroupBy) Scan

func (ogb *OrderGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*OrderGroupBy) ScanX

func (ogb *OrderGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*OrderGroupBy) String

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) StringX

func (ogb *OrderGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*OrderGroupBy) Strings

func (ogb *OrderGroupBy) 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 (*OrderGroupBy) StringsX

func (ogb *OrderGroupBy) StringsX(ctx context.Context) []string

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

type OrderMutation

type OrderMutation struct {
	// contains filtered or unexported fields
}

OrderMutation represents an operation that mutates the Order nodes in the graph.

func (*OrderMutation) AddField

func (m *OrderMutation) 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 (*OrderMutation) AddGid

func (m *OrderMutation) AddGid(i int64)

AddGid adds i to the "gid" field.

func (*OrderMutation) AddUID

func (m *OrderMutation) AddUID(i int64)

AddUID adds i to the "uid" field.

func (*OrderMutation) AddedEdges

func (m *OrderMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*OrderMutation) AddedField

func (m *OrderMutation) 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 (*OrderMutation) AddedFields

func (m *OrderMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*OrderMutation) AddedGid

func (m *OrderMutation) AddedGid() (r int64, exists bool)

AddedGid returns the value that was added to the "gid" field in this mutation.

func (*OrderMutation) AddedIDs

func (m *OrderMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*OrderMutation) AddedUID

func (m *OrderMutation) AddedUID() (r int64, exists bool)

AddedUID returns the value that was added to the "uid" field in this mutation.

func (*OrderMutation) ClearEdge

func (m *OrderMutation) 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 (*OrderMutation) ClearField

func (m *OrderMutation) 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 (*OrderMutation) ClearedEdges

func (m *OrderMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*OrderMutation) ClearedFields

func (m *OrderMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (OrderMutation) Client

func (m OrderMutation) 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 (*OrderMutation) CreatedAt

func (m *OrderMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*OrderMutation) EdgeCleared

func (m *OrderMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*OrderMutation) Field

func (m *OrderMutation) 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 (*OrderMutation) FieldCleared

func (m *OrderMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*OrderMutation) Fields

func (m *OrderMutation) 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 (*OrderMutation) Gid

func (m *OrderMutation) Gid() (r int64, exists bool)

Gid returns the value of the "gid" field in the mutation.

func (*OrderMutation) ID

func (m *OrderMutation) ID() (id int64, 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 (*OrderMutation) OldCreatedAt

func (m *OrderMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Order entity. If the Order 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 (*OrderMutation) OldField

func (m *OrderMutation) 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 (*OrderMutation) OldGid

func (m *OrderMutation) OldGid(ctx context.Context) (v int64, err error)

OldGid returns the old "gid" field's value of the Order entity. If the Order 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 (*OrderMutation) OldSn

func (m *OrderMutation) OldSn(ctx context.Context) (v string, err error)

OldSn returns the old "sn" field's value of the Order entity. If the Order 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 (*OrderMutation) OldUID

func (m *OrderMutation) OldUID(ctx context.Context) (v int64, err error)

OldUID returns the old "uid" field's value of the Order entity. If the Order 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 (*OrderMutation) OldUpdatedAt

func (m *OrderMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Order entity. If the Order 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 (*OrderMutation) Op

func (m *OrderMutation) Op() Op

Op returns the operation name.

func (*OrderMutation) RemovedEdges

func (m *OrderMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*OrderMutation) RemovedIDs

func (m *OrderMutation) 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 (*OrderMutation) ResetCreatedAt

func (m *OrderMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*OrderMutation) ResetEdge

func (m *OrderMutation) 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 (*OrderMutation) ResetField

func (m *OrderMutation) 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 (*OrderMutation) ResetGid

func (m *OrderMutation) ResetGid()

ResetGid resets all changes to the "gid" field.

func (*OrderMutation) ResetSn

func (m *OrderMutation) ResetSn()

ResetSn resets all changes to the "sn" field.

func (*OrderMutation) ResetUID

func (m *OrderMutation) ResetUID()

ResetUID resets all changes to the "uid" field.

func (*OrderMutation) ResetUpdatedAt

func (m *OrderMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*OrderMutation) SetCreatedAt

func (m *OrderMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*OrderMutation) SetField

func (m *OrderMutation) 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 (*OrderMutation) SetGid

func (m *OrderMutation) SetGid(i int64)

SetGid sets the "gid" field.

func (*OrderMutation) SetID

func (m *OrderMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Order entities.

func (*OrderMutation) SetSn

func (m *OrderMutation) SetSn(s string)

SetSn sets the "sn" field.

func (*OrderMutation) SetUID

func (m *OrderMutation) SetUID(i int64)

SetUID sets the "uid" field.

func (*OrderMutation) SetUpdatedAt

func (m *OrderMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*OrderMutation) Sn

func (m *OrderMutation) Sn() (r string, exists bool)

Sn returns the value of the "sn" field in the mutation.

func (OrderMutation) Tx

func (m OrderMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*OrderMutation) Type

func (m *OrderMutation) Type() string

Type returns the node type of this mutation (Order).

func (*OrderMutation) UID

func (m *OrderMutation) UID() (r int64, exists bool)

UID returns the value of the "uid" field in the mutation.

func (*OrderMutation) UpdatedAt

func (m *OrderMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

type OrderQuery

type OrderQuery struct {
	// contains filtered or unexported fields
}

OrderQuery is the builder for querying Order entities.

func (*OrderQuery) All

func (oq *OrderQuery) All(ctx context.Context) ([]*Order, error)

All executes the query and returns a list of Orders.

func (*OrderQuery) AllX

func (oq *OrderQuery) AllX(ctx context.Context) []*Order

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

func (*OrderQuery) Clone

func (oq *OrderQuery) Clone() *OrderQuery

Clone returns a duplicate of the OrderQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*OrderQuery) Count

func (oq *OrderQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OrderQuery) CountX

func (oq *OrderQuery) CountX(ctx context.Context) int

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

func (*OrderQuery) Exist

func (oq *OrderQuery) Exist(ctx context.Context) (bool, error)

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

func (*OrderQuery) ExistX

func (oq *OrderQuery) ExistX(ctx context.Context) bool

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

func (*OrderQuery) First

func (oq *OrderQuery) First(ctx context.Context) (*Order, error)

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

func (*OrderQuery) FirstID

func (oq *OrderQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*OrderQuery) FirstIDX

func (oq *OrderQuery) FirstIDX(ctx context.Context) int64

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

func (*OrderQuery) FirstX

func (oq *OrderQuery) FirstX(ctx context.Context) *Order

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

func (*OrderQuery) GroupBy

func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy

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 {
	Sn string `json:"sn,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Order.Query().
	GroupBy(order.FieldSn).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OrderQuery) IDs

func (oq *OrderQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*OrderQuery) IDsX

func (oq *OrderQuery) IDsX(ctx context.Context) []int64

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

func (*OrderQuery) Limit

func (oq *OrderQuery) Limit(limit int) *OrderQuery

Limit adds a limit step to the query.

func (*OrderQuery) Offset

func (oq *OrderQuery) Offset(offset int) *OrderQuery

Offset adds an offset step to the query.

func (*OrderQuery) Only

func (oq *OrderQuery) Only(ctx context.Context) (*Order, error)

Only returns a single Order entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Order entity is not found. Returns a *NotFoundError when no Order entities are found.

func (*OrderQuery) OnlyID

func (oq *OrderQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only Order ID in the query. Returns a *NotSingularError when exactly one Order ID is not found. Returns a *NotFoundError when no entities are found.

func (*OrderQuery) OnlyIDX

func (oq *OrderQuery) OnlyIDX(ctx context.Context) int64

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

func (*OrderQuery) OnlyX

func (oq *OrderQuery) OnlyX(ctx context.Context) *Order

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

func (*OrderQuery) Order

func (oq *OrderQuery) Order(o ...OrderFunc) *OrderQuery

Order adds an order step to the query.

func (*OrderQuery) Select

func (oq *OrderQuery) Select(field string, fields ...string) *OrderSelect

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 {
	Sn string `json:"sn,omitempty"`
}

client.Order.Query().
	Select(order.FieldSn).
	Scan(ctx, &v)

func (*OrderQuery) Unique

func (oq *OrderQuery) Unique(unique bool) *OrderQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*OrderQuery) Where

func (oq *OrderQuery) Where(ps ...predicate.Order) *OrderQuery

Where adds a new predicate for the OrderQuery builder.

type OrderSelect

type OrderSelect struct {
	*OrderQuery
	// contains filtered or unexported fields
}

OrderSelect is the builder for selecting fields of Order entities.

func (*OrderSelect) Bool

func (os *OrderSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*OrderSelect) BoolX

func (os *OrderSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*OrderSelect) Bools

func (os *OrderSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*OrderSelect) BoolsX

func (os *OrderSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*OrderSelect) Float64

func (os *OrderSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*OrderSelect) Float64X

func (os *OrderSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*OrderSelect) Float64s

func (os *OrderSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*OrderSelect) Float64sX

func (os *OrderSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*OrderSelect) Int

func (os *OrderSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*OrderSelect) IntX

func (os *OrderSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*OrderSelect) Ints

func (os *OrderSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*OrderSelect) IntsX

func (os *OrderSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*OrderSelect) Scan

func (os *OrderSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*OrderSelect) ScanX

func (os *OrderSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*OrderSelect) String

func (os *OrderSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*OrderSelect) StringX

func (os *OrderSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*OrderSelect) Strings

func (os *OrderSelect) Strings(ctx context.Context) ([]string, error)

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

func (*OrderSelect) StringsX

func (os *OrderSelect) StringsX(ctx context.Context) []string

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

type OrderUpdate

type OrderUpdate struct {
	// contains filtered or unexported fields
}

OrderUpdate is the builder for updating Order entities.

func (*OrderUpdate) AddGid

func (ou *OrderUpdate) AddGid(i int64) *OrderUpdate

AddGid adds i to the "gid" field.

func (*OrderUpdate) AddUID

func (ou *OrderUpdate) AddUID(i int64) *OrderUpdate

AddUID adds i to the "uid" field.

func (*OrderUpdate) Exec

func (ou *OrderUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderUpdate) ExecX

func (ou *OrderUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*OrderUpdate) Mutation

func (ou *OrderUpdate) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderUpdate) Save

func (ou *OrderUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*OrderUpdate) SaveX

func (ou *OrderUpdate) SaveX(ctx context.Context) int

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

func (*OrderUpdate) SetCreatedAt

func (ou *OrderUpdate) SetCreatedAt(t time.Time) *OrderUpdate

SetCreatedAt sets the "created_at" field.

func (*OrderUpdate) SetGid

func (ou *OrderUpdate) SetGid(i int64) *OrderUpdate

SetGid sets the "gid" field.

func (*OrderUpdate) SetNillableCreatedAt

func (ou *OrderUpdate) SetNillableCreatedAt(t *time.Time) *OrderUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*OrderUpdate) SetNillableUpdatedAt

func (ou *OrderUpdate) SetNillableUpdatedAt(t *time.Time) *OrderUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*OrderUpdate) SetSn

func (ou *OrderUpdate) SetSn(s string) *OrderUpdate

SetSn sets the "sn" field.

func (*OrderUpdate) SetUID

func (ou *OrderUpdate) SetUID(i int64) *OrderUpdate

SetUID sets the "uid" field.

func (*OrderUpdate) SetUpdatedAt

func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpdate) Where

func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate

Where adds a new predicate for the OrderUpdate builder.

type OrderUpdateOne

type OrderUpdateOne struct {
	// contains filtered or unexported fields
}

OrderUpdateOne is the builder for updating a single Order entity.

func (*OrderUpdateOne) AddGid

func (ouo *OrderUpdateOne) AddGid(i int64) *OrderUpdateOne

AddGid adds i to the "gid" field.

func (*OrderUpdateOne) AddUID

func (ouo *OrderUpdateOne) AddUID(i int64) *OrderUpdateOne

AddUID adds i to the "uid" field.

func (*OrderUpdateOne) Exec

func (ouo *OrderUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OrderUpdateOne) ExecX

func (ouo *OrderUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*OrderUpdateOne) Mutation

func (ouo *OrderUpdateOne) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderUpdateOne) Save

func (ouo *OrderUpdateOne) Save(ctx context.Context) (*Order, error)

Save executes the query and returns the updated Order entity.

func (*OrderUpdateOne) SaveX

func (ouo *OrderUpdateOne) SaveX(ctx context.Context) *Order

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

func (*OrderUpdateOne) Select

func (ouo *OrderUpdateOne) Select(field string, fields ...string) *OrderUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*OrderUpdateOne) SetCreatedAt

func (ouo *OrderUpdateOne) SetCreatedAt(t time.Time) *OrderUpdateOne

SetCreatedAt sets the "created_at" field.

func (*OrderUpdateOne) SetGid

func (ouo *OrderUpdateOne) SetGid(i int64) *OrderUpdateOne

SetGid sets the "gid" field.

func (*OrderUpdateOne) SetNillableCreatedAt

func (ouo *OrderUpdateOne) SetNillableCreatedAt(t *time.Time) *OrderUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableUpdatedAt

func (ouo *OrderUpdateOne) SetNillableUpdatedAt(t *time.Time) *OrderUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*OrderUpdateOne) SetSn

func (ouo *OrderUpdateOne) SetSn(s string) *OrderUpdateOne

SetSn sets the "sn" field.

func (*OrderUpdateOne) SetUID

func (ouo *OrderUpdateOne) SetUID(i int64) *OrderUpdateOne

SetUID sets the "uid" field.

func (*OrderUpdateOne) SetUpdatedAt

func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *OrderUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Orders

type Orders []*Order

Orders is a parsable slice of 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 SeckillGoods

type SeckillGoods struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// GoodsID holds the value of the "goods_id" field.
	GoodsID int64 `json:"goods_id,omitempty"`
	// SeckillPrice holds the value of the "seckill_price" field.
	SeckillPrice float64 `json:"seckill_price,omitempty"`
	// StockCount holds the value of the "stock_count" field.
	StockCount int64 `json:"stock_count,omitempty"`
	// StartDate holds the value of the "start_date" field.
	StartDate time.Time `json:"start_date,omitempty"`
	// EndDate holds the value of the "end_date" field.
	EndDate time.Time `json:"end_date,omitempty"`
	// contains filtered or unexported fields
}

SeckillGoods is the model entity for the SeckillGoods schema.

func (*SeckillGoods) String

func (sg *SeckillGoods) String() string

String implements the fmt.Stringer.

func (*SeckillGoods) Unwrap

func (sg *SeckillGoods) Unwrap() *SeckillGoods

Unwrap unwraps the SeckillGoods 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 (*SeckillGoods) Update

func (sg *SeckillGoods) Update() *SeckillGoodsUpdateOne

Update returns a builder for updating this SeckillGoods. Note that you need to call SeckillGoods.Unwrap() before calling this method if this SeckillGoods was returned from a transaction, and the transaction was committed or rolled back.

type SeckillGoodsClient

type SeckillGoodsClient struct {
	// contains filtered or unexported fields
}

SeckillGoodsClient is a client for the SeckillGoods schema.

func NewSeckillGoodsClient

func NewSeckillGoodsClient(c config) *SeckillGoodsClient

NewSeckillGoodsClient returns a client for the SeckillGoods from the given config.

func (*SeckillGoodsClient) Create

Create returns a create builder for SeckillGoods.

func (*SeckillGoodsClient) CreateBulk

func (c *SeckillGoodsClient) CreateBulk(builders ...*SeckillGoodsCreate) *SeckillGoodsCreateBulk

CreateBulk returns a builder for creating a bulk of SeckillGoods entities.

func (*SeckillGoodsClient) Delete

Delete returns a delete builder for SeckillGoods.

func (*SeckillGoodsClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*SeckillGoodsClient) DeleteOneID

func (c *SeckillGoodsClient) DeleteOneID(id int64) *SeckillGoodsDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*SeckillGoodsClient) Get

Get returns a SeckillGoods entity by its id.

func (*SeckillGoodsClient) GetX

GetX is like Get, but panics if an error occurs.

func (*SeckillGoodsClient) Hooks

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

Hooks returns the client hooks.

func (*SeckillGoodsClient) Query

Query returns a query builder for SeckillGoods.

func (*SeckillGoodsClient) Update

Update returns an update builder for SeckillGoods.

func (*SeckillGoodsClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SeckillGoodsClient) UpdateOneID

func (c *SeckillGoodsClient) UpdateOneID(id int64) *SeckillGoodsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SeckillGoodsClient) Use

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

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `seckillgoods.Hooks(f(g(h())))`.

type SeckillGoodsCreate

type SeckillGoodsCreate struct {
	// contains filtered or unexported fields
}

SeckillGoodsCreate is the builder for creating a SeckillGoods entity.

func (*SeckillGoodsCreate) Mutation

func (sgc *SeckillGoodsCreate) Mutation() *SeckillGoodsMutation

Mutation returns the SeckillGoodsMutation object of the builder.

func (*SeckillGoodsCreate) Save

Save creates the SeckillGoods in the database.

func (*SeckillGoodsCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*SeckillGoodsCreate) SetEndDate

func (sgc *SeckillGoodsCreate) SetEndDate(t time.Time) *SeckillGoodsCreate

SetEndDate sets the "end_date" field.

func (*SeckillGoodsCreate) SetGoodsID

func (sgc *SeckillGoodsCreate) SetGoodsID(i int64) *SeckillGoodsCreate

SetGoodsID sets the "goods_id" field.

func (*SeckillGoodsCreate) SetID

SetID sets the "id" field.

func (*SeckillGoodsCreate) SetSeckillPrice

func (sgc *SeckillGoodsCreate) SetSeckillPrice(f float64) *SeckillGoodsCreate

SetSeckillPrice sets the "seckill_price" field.

func (*SeckillGoodsCreate) SetStartDate

func (sgc *SeckillGoodsCreate) SetStartDate(t time.Time) *SeckillGoodsCreate

SetStartDate sets the "start_date" field.

func (*SeckillGoodsCreate) SetStockCount

func (sgc *SeckillGoodsCreate) SetStockCount(i int64) *SeckillGoodsCreate

SetStockCount sets the "stock_count" field.

type SeckillGoodsCreateBulk

type SeckillGoodsCreateBulk struct {
	// contains filtered or unexported fields
}

SeckillGoodsCreateBulk is the builder for creating many SeckillGoods entities in bulk.

func (*SeckillGoodsCreateBulk) Save

Save creates the SeckillGoods entities in the database.

func (*SeckillGoodsCreateBulk) SaveX

func (sgcb *SeckillGoodsCreateBulk) SaveX(ctx context.Context) []*SeckillGoods

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

type SeckillGoodsDelete

type SeckillGoodsDelete struct {
	// contains filtered or unexported fields
}

SeckillGoodsDelete is the builder for deleting a SeckillGoods entity.

func (*SeckillGoodsDelete) Exec

func (sgd *SeckillGoodsDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*SeckillGoodsDelete) ExecX

func (sgd *SeckillGoodsDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*SeckillGoodsDelete) Where

Where adds a new predicate to the SeckillGoodsDelete builder.

type SeckillGoodsDeleteOne

type SeckillGoodsDeleteOne struct {
	// contains filtered or unexported fields
}

SeckillGoodsDeleteOne is the builder for deleting a single SeckillGoods entity.

func (*SeckillGoodsDeleteOne) Exec

func (sgdo *SeckillGoodsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SeckillGoodsDeleteOne) ExecX

func (sgdo *SeckillGoodsDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type SeckillGoodsGroupBy

type SeckillGoodsGroupBy struct {
	// contains filtered or unexported fields
}

SeckillGoodsGroupBy is the group-by builder for SeckillGoods entities.

func (*SeckillGoodsGroupBy) Aggregate

func (sggb *SeckillGoodsGroupBy) Aggregate(fns ...AggregateFunc) *SeckillGoodsGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*SeckillGoodsGroupBy) Bool

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) BoolX

func (sggb *SeckillGoodsGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Bools

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) BoolsX

func (sggb *SeckillGoodsGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Float64

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) Float64X

func (sggb *SeckillGoodsGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Float64s

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) Float64sX

func (sggb *SeckillGoodsGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Int

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) IntX

func (sggb *SeckillGoodsGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Ints

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) IntsX

func (sggb *SeckillGoodsGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Scan

func (sggb *SeckillGoodsGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*SeckillGoodsGroupBy) ScanX

func (sggb *SeckillGoodsGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SeckillGoodsGroupBy) String

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) StringX

func (sggb *SeckillGoodsGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SeckillGoodsGroupBy) Strings

func (sggb *SeckillGoodsGroupBy) 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 (*SeckillGoodsGroupBy) StringsX

func (sggb *SeckillGoodsGroupBy) StringsX(ctx context.Context) []string

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

type SeckillGoodsMutation

type SeckillGoodsMutation struct {
	// contains filtered or unexported fields
}

SeckillGoodsMutation represents an operation that mutates the SeckillGoods nodes in the graph.

func (*SeckillGoodsMutation) AddField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) AddGoodsID

func (m *SeckillGoodsMutation) AddGoodsID(i int64)

AddGoodsID adds i to the "goods_id" field.

func (*SeckillGoodsMutation) AddSeckillPrice

func (m *SeckillGoodsMutation) AddSeckillPrice(f float64)

AddSeckillPrice adds f to the "seckill_price" field.

func (*SeckillGoodsMutation) AddStockCount

func (m *SeckillGoodsMutation) AddStockCount(i int64)

AddStockCount adds i to the "stock_count" field.

func (*SeckillGoodsMutation) AddedEdges

func (m *SeckillGoodsMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*SeckillGoodsMutation) AddedField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) AddedFields

func (m *SeckillGoodsMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*SeckillGoodsMutation) AddedGoodsID

func (m *SeckillGoodsMutation) AddedGoodsID() (r int64, exists bool)

AddedGoodsID returns the value that was added to the "goods_id" field in this mutation.

func (*SeckillGoodsMutation) AddedIDs

func (m *SeckillGoodsMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*SeckillGoodsMutation) AddedSeckillPrice

func (m *SeckillGoodsMutation) AddedSeckillPrice() (r float64, exists bool)

AddedSeckillPrice returns the value that was added to the "seckill_price" field in this mutation.

func (*SeckillGoodsMutation) AddedStockCount

func (m *SeckillGoodsMutation) AddedStockCount() (r int64, exists bool)

AddedStockCount returns the value that was added to the "stock_count" field in this mutation.

func (*SeckillGoodsMutation) ClearEdge

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) ClearField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) ClearedEdges

func (m *SeckillGoodsMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*SeckillGoodsMutation) ClearedFields

func (m *SeckillGoodsMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (SeckillGoodsMutation) Client

func (m SeckillGoodsMutation) 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 (*SeckillGoodsMutation) EdgeCleared

func (m *SeckillGoodsMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*SeckillGoodsMutation) EndDate

func (m *SeckillGoodsMutation) EndDate() (r time.Time, exists bool)

EndDate returns the value of the "end_date" field in the mutation.

func (*SeckillGoodsMutation) Field

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) FieldCleared

func (m *SeckillGoodsMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*SeckillGoodsMutation) Fields

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) GoodsID

func (m *SeckillGoodsMutation) GoodsID() (r int64, exists bool)

GoodsID returns the value of the "goods_id" field in the mutation.

func (*SeckillGoodsMutation) ID

func (m *SeckillGoodsMutation) ID() (id int64, 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 (*SeckillGoodsMutation) OldEndDate

func (m *SeckillGoodsMutation) OldEndDate(ctx context.Context) (v time.Time, err error)

OldEndDate returns the old "end_date" field's value of the SeckillGoods entity. If the SeckillGoods 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 (*SeckillGoodsMutation) OldField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) OldGoodsID

func (m *SeckillGoodsMutation) OldGoodsID(ctx context.Context) (v int64, err error)

OldGoodsID returns the old "goods_id" field's value of the SeckillGoods entity. If the SeckillGoods 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 (*SeckillGoodsMutation) OldSeckillPrice

func (m *SeckillGoodsMutation) OldSeckillPrice(ctx context.Context) (v float64, err error)

OldSeckillPrice returns the old "seckill_price" field's value of the SeckillGoods entity. If the SeckillGoods 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 (*SeckillGoodsMutation) OldStartDate

func (m *SeckillGoodsMutation) OldStartDate(ctx context.Context) (v time.Time, err error)

OldStartDate returns the old "start_date" field's value of the SeckillGoods entity. If the SeckillGoods 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 (*SeckillGoodsMutation) OldStockCount

func (m *SeckillGoodsMutation) OldStockCount(ctx context.Context) (v int64, err error)

OldStockCount returns the old "stock_count" field's value of the SeckillGoods entity. If the SeckillGoods 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 (*SeckillGoodsMutation) Op

func (m *SeckillGoodsMutation) Op() Op

Op returns the operation name.

func (*SeckillGoodsMutation) RemovedEdges

func (m *SeckillGoodsMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*SeckillGoodsMutation) RemovedIDs

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) ResetEdge

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) ResetEndDate

func (m *SeckillGoodsMutation) ResetEndDate()

ResetEndDate resets all changes to the "end_date" field.

func (*SeckillGoodsMutation) ResetField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) ResetGoodsID

func (m *SeckillGoodsMutation) ResetGoodsID()

ResetGoodsID resets all changes to the "goods_id" field.

func (*SeckillGoodsMutation) ResetSeckillPrice

func (m *SeckillGoodsMutation) ResetSeckillPrice()

ResetSeckillPrice resets all changes to the "seckill_price" field.

func (*SeckillGoodsMutation) ResetStartDate

func (m *SeckillGoodsMutation) ResetStartDate()

ResetStartDate resets all changes to the "start_date" field.

func (*SeckillGoodsMutation) ResetStockCount

func (m *SeckillGoodsMutation) ResetStockCount()

ResetStockCount resets all changes to the "stock_count" field.

func (*SeckillGoodsMutation) SeckillPrice

func (m *SeckillGoodsMutation) SeckillPrice() (r float64, exists bool)

SeckillPrice returns the value of the "seckill_price" field in the mutation.

func (*SeckillGoodsMutation) SetEndDate

func (m *SeckillGoodsMutation) SetEndDate(t time.Time)

SetEndDate sets the "end_date" field.

func (*SeckillGoodsMutation) SetField

func (m *SeckillGoodsMutation) 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 (*SeckillGoodsMutation) SetGoodsID

func (m *SeckillGoodsMutation) SetGoodsID(i int64)

SetGoodsID sets the "goods_id" field.

func (*SeckillGoodsMutation) SetID

func (m *SeckillGoodsMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of SeckillGoods entities.

func (*SeckillGoodsMutation) SetSeckillPrice

func (m *SeckillGoodsMutation) SetSeckillPrice(f float64)

SetSeckillPrice sets the "seckill_price" field.

func (*SeckillGoodsMutation) SetStartDate

func (m *SeckillGoodsMutation) SetStartDate(t time.Time)

SetStartDate sets the "start_date" field.

func (*SeckillGoodsMutation) SetStockCount

func (m *SeckillGoodsMutation) SetStockCount(i int64)

SetStockCount sets the "stock_count" field.

func (*SeckillGoodsMutation) StartDate

func (m *SeckillGoodsMutation) StartDate() (r time.Time, exists bool)

StartDate returns the value of the "start_date" field in the mutation.

func (*SeckillGoodsMutation) StockCount

func (m *SeckillGoodsMutation) StockCount() (r int64, exists bool)

StockCount returns the value of the "stock_count" field in the mutation.

func (SeckillGoodsMutation) Tx

func (m SeckillGoodsMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*SeckillGoodsMutation) Type

func (m *SeckillGoodsMutation) Type() string

Type returns the node type of this mutation (SeckillGoods).

type SeckillGoodsQuery

type SeckillGoodsQuery struct {
	// contains filtered or unexported fields
}

SeckillGoodsQuery is the builder for querying SeckillGoods entities.

func (*SeckillGoodsQuery) All

func (sgq *SeckillGoodsQuery) All(ctx context.Context) ([]*SeckillGoods, error)

All executes the query and returns a list of SeckillGoodsSlice.

func (*SeckillGoodsQuery) AllX

func (sgq *SeckillGoodsQuery) AllX(ctx context.Context) []*SeckillGoods

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

func (*SeckillGoodsQuery) Clone

func (sgq *SeckillGoodsQuery) Clone() *SeckillGoodsQuery

Clone returns a duplicate of the SeckillGoodsQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*SeckillGoodsQuery) Count

func (sgq *SeckillGoodsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SeckillGoodsQuery) CountX

func (sgq *SeckillGoodsQuery) CountX(ctx context.Context) int

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

func (*SeckillGoodsQuery) Exist

func (sgq *SeckillGoodsQuery) Exist(ctx context.Context) (bool, error)

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

func (*SeckillGoodsQuery) ExistX

func (sgq *SeckillGoodsQuery) ExistX(ctx context.Context) bool

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

func (*SeckillGoodsQuery) First

func (sgq *SeckillGoodsQuery) First(ctx context.Context) (*SeckillGoods, error)

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

func (*SeckillGoodsQuery) FirstID

func (sgq *SeckillGoodsQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*SeckillGoodsQuery) FirstIDX

func (sgq *SeckillGoodsQuery) FirstIDX(ctx context.Context) int64

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

func (*SeckillGoodsQuery) FirstX

func (sgq *SeckillGoodsQuery) FirstX(ctx context.Context) *SeckillGoods

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

func (*SeckillGoodsQuery) GroupBy

func (sgq *SeckillGoodsQuery) GroupBy(field string, fields ...string) *SeckillGoodsGroupBy

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 {
	GoodsID int64 `json:"goods_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.SeckillGoods.Query().
	GroupBy(seckillgoods.FieldGoodsID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SeckillGoodsQuery) IDs

func (sgq *SeckillGoodsQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*SeckillGoodsQuery) IDsX

func (sgq *SeckillGoodsQuery) IDsX(ctx context.Context) []int64

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

func (*SeckillGoodsQuery) Limit

func (sgq *SeckillGoodsQuery) Limit(limit int) *SeckillGoodsQuery

Limit adds a limit step to the query.

func (*SeckillGoodsQuery) Offset

func (sgq *SeckillGoodsQuery) Offset(offset int) *SeckillGoodsQuery

Offset adds an offset step to the query.

func (*SeckillGoodsQuery) Only

func (sgq *SeckillGoodsQuery) Only(ctx context.Context) (*SeckillGoods, error)

Only returns a single SeckillGoods entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one SeckillGoods entity is not found. Returns a *NotFoundError when no SeckillGoods entities are found.

func (*SeckillGoodsQuery) OnlyID

func (sgq *SeckillGoodsQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only SeckillGoods ID in the query. Returns a *NotSingularError when exactly one SeckillGoods ID is not found. Returns a *NotFoundError when no entities are found.

func (*SeckillGoodsQuery) OnlyIDX

func (sgq *SeckillGoodsQuery) OnlyIDX(ctx context.Context) int64

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

func (*SeckillGoodsQuery) OnlyX

func (sgq *SeckillGoodsQuery) OnlyX(ctx context.Context) *SeckillGoods

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

func (*SeckillGoodsQuery) Order

func (sgq *SeckillGoodsQuery) Order(o ...OrderFunc) *SeckillGoodsQuery

Order adds an order step to the query.

func (*SeckillGoodsQuery) Select

func (sgq *SeckillGoodsQuery) Select(field string, fields ...string) *SeckillGoodsSelect

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 {
	GoodsID int64 `json:"goods_id,omitempty"`
}

client.SeckillGoods.Query().
	Select(seckillgoods.FieldGoodsID).
	Scan(ctx, &v)

func (*SeckillGoodsQuery) Unique

func (sgq *SeckillGoodsQuery) Unique(unique bool) *SeckillGoodsQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*SeckillGoodsQuery) Where

Where adds a new predicate for the SeckillGoodsQuery builder.

type SeckillGoodsSelect

type SeckillGoodsSelect struct {
	*SeckillGoodsQuery
	// contains filtered or unexported fields
}

SeckillGoodsSelect is the builder for selecting fields of SeckillGoods entities.

func (*SeckillGoodsSelect) Bool

func (sgs *SeckillGoodsSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) BoolX

func (sgs *SeckillGoodsSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SeckillGoodsSelect) Bools

func (sgs *SeckillGoodsSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) BoolsX

func (sgs *SeckillGoodsSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SeckillGoodsSelect) Float64

func (sgs *SeckillGoodsSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) Float64X

func (sgs *SeckillGoodsSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SeckillGoodsSelect) Float64s

func (sgs *SeckillGoodsSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) Float64sX

func (sgs *SeckillGoodsSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SeckillGoodsSelect) Int

func (sgs *SeckillGoodsSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) IntX

func (sgs *SeckillGoodsSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SeckillGoodsSelect) Ints

func (sgs *SeckillGoodsSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) IntsX

func (sgs *SeckillGoodsSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SeckillGoodsSelect) Scan

func (sgs *SeckillGoodsSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*SeckillGoodsSelect) ScanX

func (sgs *SeckillGoodsSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SeckillGoodsSelect) String

func (sgs *SeckillGoodsSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*SeckillGoodsSelect) StringX

func (sgs *SeckillGoodsSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SeckillGoodsSelect) Strings

func (sgs *SeckillGoodsSelect) Strings(ctx context.Context) ([]string, error)

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

func (*SeckillGoodsSelect) StringsX

func (sgs *SeckillGoodsSelect) StringsX(ctx context.Context) []string

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

type SeckillGoodsSlice

type SeckillGoodsSlice []*SeckillGoods

SeckillGoodsSlice is a parsable slice of SeckillGoods.

type SeckillGoodsUpdate

type SeckillGoodsUpdate struct {
	// contains filtered or unexported fields
}

SeckillGoodsUpdate is the builder for updating SeckillGoods entities.

func (*SeckillGoodsUpdate) AddGoodsID

func (sgu *SeckillGoodsUpdate) AddGoodsID(i int64) *SeckillGoodsUpdate

AddGoodsID adds i to the "goods_id" field.

func (*SeckillGoodsUpdate) AddSeckillPrice

func (sgu *SeckillGoodsUpdate) AddSeckillPrice(f float64) *SeckillGoodsUpdate

AddSeckillPrice adds f to the "seckill_price" field.

func (*SeckillGoodsUpdate) AddStockCount

func (sgu *SeckillGoodsUpdate) AddStockCount(i int64) *SeckillGoodsUpdate

AddStockCount adds i to the "stock_count" field.

func (*SeckillGoodsUpdate) Exec

func (sgu *SeckillGoodsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SeckillGoodsUpdate) ExecX

func (sgu *SeckillGoodsUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SeckillGoodsUpdate) Mutation

func (sgu *SeckillGoodsUpdate) Mutation() *SeckillGoodsMutation

Mutation returns the SeckillGoodsMutation object of the builder.

func (*SeckillGoodsUpdate) Save

func (sgu *SeckillGoodsUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*SeckillGoodsUpdate) SaveX

func (sgu *SeckillGoodsUpdate) SaveX(ctx context.Context) int

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

func (*SeckillGoodsUpdate) SetEndDate

func (sgu *SeckillGoodsUpdate) SetEndDate(t time.Time) *SeckillGoodsUpdate

SetEndDate sets the "end_date" field.

func (*SeckillGoodsUpdate) SetGoodsID

func (sgu *SeckillGoodsUpdate) SetGoodsID(i int64) *SeckillGoodsUpdate

SetGoodsID sets the "goods_id" field.

func (*SeckillGoodsUpdate) SetSeckillPrice

func (sgu *SeckillGoodsUpdate) SetSeckillPrice(f float64) *SeckillGoodsUpdate

SetSeckillPrice sets the "seckill_price" field.

func (*SeckillGoodsUpdate) SetStartDate

func (sgu *SeckillGoodsUpdate) SetStartDate(t time.Time) *SeckillGoodsUpdate

SetStartDate sets the "start_date" field.

func (*SeckillGoodsUpdate) SetStockCount

func (sgu *SeckillGoodsUpdate) SetStockCount(i int64) *SeckillGoodsUpdate

SetStockCount sets the "stock_count" field.

func (*SeckillGoodsUpdate) Where

Where adds a new predicate for the SeckillGoodsUpdate builder.

type SeckillGoodsUpdateOne

type SeckillGoodsUpdateOne struct {
	// contains filtered or unexported fields
}

SeckillGoodsUpdateOne is the builder for updating a single SeckillGoods entity.

func (*SeckillGoodsUpdateOne) AddGoodsID

func (sguo *SeckillGoodsUpdateOne) AddGoodsID(i int64) *SeckillGoodsUpdateOne

AddGoodsID adds i to the "goods_id" field.

func (*SeckillGoodsUpdateOne) AddSeckillPrice

func (sguo *SeckillGoodsUpdateOne) AddSeckillPrice(f float64) *SeckillGoodsUpdateOne

AddSeckillPrice adds f to the "seckill_price" field.

func (*SeckillGoodsUpdateOne) AddStockCount

func (sguo *SeckillGoodsUpdateOne) AddStockCount(i int64) *SeckillGoodsUpdateOne

AddStockCount adds i to the "stock_count" field.

func (*SeckillGoodsUpdateOne) Exec

func (sguo *SeckillGoodsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SeckillGoodsUpdateOne) ExecX

func (sguo *SeckillGoodsUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SeckillGoodsUpdateOne) Mutation

func (sguo *SeckillGoodsUpdateOne) Mutation() *SeckillGoodsMutation

Mutation returns the SeckillGoodsMutation object of the builder.

func (*SeckillGoodsUpdateOne) Save

Save executes the query and returns the updated SeckillGoods entity.

func (*SeckillGoodsUpdateOne) SaveX

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

func (*SeckillGoodsUpdateOne) Select

func (sguo *SeckillGoodsUpdateOne) Select(field string, fields ...string) *SeckillGoodsUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*SeckillGoodsUpdateOne) SetEndDate

SetEndDate sets the "end_date" field.

func (*SeckillGoodsUpdateOne) SetGoodsID

func (sguo *SeckillGoodsUpdateOne) SetGoodsID(i int64) *SeckillGoodsUpdateOne

SetGoodsID sets the "goods_id" field.

func (*SeckillGoodsUpdateOne) SetSeckillPrice

func (sguo *SeckillGoodsUpdateOne) SetSeckillPrice(f float64) *SeckillGoodsUpdateOne

SetSeckillPrice sets the "seckill_price" field.

func (*SeckillGoodsUpdateOne) SetStartDate

func (sguo *SeckillGoodsUpdateOne) SetStartDate(t time.Time) *SeckillGoodsUpdateOne

SetStartDate sets the "start_date" field.

func (*SeckillGoodsUpdateOne) SetStockCount

func (sguo *SeckillGoodsUpdateOne) SetStockCount(i int64) *SeckillGoodsUpdateOne

SetStockCount sets the "stock_count" field.

type SeckillOrder

type SeckillOrder struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int64 `json:"user_id,omitempty"`
	// OrderID holds the value of the "order_id" field.
	OrderID int64 `json:"order_id,omitempty"`
	// GoodsID holds the value of the "goods_id" field.
	GoodsID int64 `json:"goods_id,omitempty"`
	// contains filtered or unexported fields
}

SeckillOrder is the model entity for the SeckillOrder schema.

func (*SeckillOrder) String

func (so *SeckillOrder) String() string

String implements the fmt.Stringer.

func (*SeckillOrder) Unwrap

func (so *SeckillOrder) Unwrap() *SeckillOrder

Unwrap unwraps the SeckillOrder 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 (*SeckillOrder) Update

func (so *SeckillOrder) Update() *SeckillOrderUpdateOne

Update returns a builder for updating this SeckillOrder. Note that you need to call SeckillOrder.Unwrap() before calling this method if this SeckillOrder was returned from a transaction, and the transaction was committed or rolled back.

type SeckillOrderClient

type SeckillOrderClient struct {
	// contains filtered or unexported fields
}

SeckillOrderClient is a client for the SeckillOrder schema.

func NewSeckillOrderClient

func NewSeckillOrderClient(c config) *SeckillOrderClient

NewSeckillOrderClient returns a client for the SeckillOrder from the given config.

func (*SeckillOrderClient) Create

Create returns a create builder for SeckillOrder.

func (*SeckillOrderClient) CreateBulk

func (c *SeckillOrderClient) CreateBulk(builders ...*SeckillOrderCreate) *SeckillOrderCreateBulk

CreateBulk returns a builder for creating a bulk of SeckillOrder entities.

func (*SeckillOrderClient) Delete

Delete returns a delete builder for SeckillOrder.

func (*SeckillOrderClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*SeckillOrderClient) DeleteOneID

func (c *SeckillOrderClient) DeleteOneID(id int64) *SeckillOrderDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*SeckillOrderClient) Get

Get returns a SeckillOrder entity by its id.

func (*SeckillOrderClient) GetX

GetX is like Get, but panics if an error occurs.

func (*SeckillOrderClient) Hooks

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

Hooks returns the client hooks.

func (*SeckillOrderClient) Query

Query returns a query builder for SeckillOrder.

func (*SeckillOrderClient) Update

Update returns an update builder for SeckillOrder.

func (*SeckillOrderClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SeckillOrderClient) UpdateOneID

func (c *SeckillOrderClient) UpdateOneID(id int64) *SeckillOrderUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SeckillOrderClient) Use

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

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `seckillorder.Hooks(f(g(h())))`.

type SeckillOrderCreate

type SeckillOrderCreate struct {
	// contains filtered or unexported fields
}

SeckillOrderCreate is the builder for creating a SeckillOrder entity.

func (*SeckillOrderCreate) Mutation

func (soc *SeckillOrderCreate) Mutation() *SeckillOrderMutation

Mutation returns the SeckillOrderMutation object of the builder.

func (*SeckillOrderCreate) Save

Save creates the SeckillOrder in the database.

func (*SeckillOrderCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*SeckillOrderCreate) SetGoodsID

func (soc *SeckillOrderCreate) SetGoodsID(i int64) *SeckillOrderCreate

SetGoodsID sets the "goods_id" field.

func (*SeckillOrderCreate) SetID

SetID sets the "id" field.

func (*SeckillOrderCreate) SetOrderID

func (soc *SeckillOrderCreate) SetOrderID(i int64) *SeckillOrderCreate

SetOrderID sets the "order_id" field.

func (*SeckillOrderCreate) SetUserID

func (soc *SeckillOrderCreate) SetUserID(i int64) *SeckillOrderCreate

SetUserID sets the "user_id" field.

type SeckillOrderCreateBulk

type SeckillOrderCreateBulk struct {
	// contains filtered or unexported fields
}

SeckillOrderCreateBulk is the builder for creating many SeckillOrder entities in bulk.

func (*SeckillOrderCreateBulk) Save

Save creates the SeckillOrder entities in the database.

func (*SeckillOrderCreateBulk) SaveX

func (socb *SeckillOrderCreateBulk) SaveX(ctx context.Context) []*SeckillOrder

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

type SeckillOrderDelete

type SeckillOrderDelete struct {
	// contains filtered or unexported fields
}

SeckillOrderDelete is the builder for deleting a SeckillOrder entity.

func (*SeckillOrderDelete) Exec

func (sod *SeckillOrderDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*SeckillOrderDelete) ExecX

func (sod *SeckillOrderDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*SeckillOrderDelete) Where

Where adds a new predicate to the SeckillOrderDelete builder.

type SeckillOrderDeleteOne

type SeckillOrderDeleteOne struct {
	// contains filtered or unexported fields
}

SeckillOrderDeleteOne is the builder for deleting a single SeckillOrder entity.

func (*SeckillOrderDeleteOne) Exec

func (sodo *SeckillOrderDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SeckillOrderDeleteOne) ExecX

func (sodo *SeckillOrderDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type SeckillOrderGroupBy

type SeckillOrderGroupBy struct {
	// contains filtered or unexported fields
}

SeckillOrderGroupBy is the group-by builder for SeckillOrder entities.

func (*SeckillOrderGroupBy) Aggregate

func (sogb *SeckillOrderGroupBy) Aggregate(fns ...AggregateFunc) *SeckillOrderGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*SeckillOrderGroupBy) Bool

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) BoolX

func (sogb *SeckillOrderGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SeckillOrderGroupBy) Bools

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) BoolsX

func (sogb *SeckillOrderGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SeckillOrderGroupBy) Float64

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) Float64X

func (sogb *SeckillOrderGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SeckillOrderGroupBy) Float64s

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) Float64sX

func (sogb *SeckillOrderGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SeckillOrderGroupBy) Int

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) IntX

func (sogb *SeckillOrderGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SeckillOrderGroupBy) Ints

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) IntsX

func (sogb *SeckillOrderGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SeckillOrderGroupBy) Scan

func (sogb *SeckillOrderGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*SeckillOrderGroupBy) ScanX

func (sogb *SeckillOrderGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SeckillOrderGroupBy) String

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) StringX

func (sogb *SeckillOrderGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SeckillOrderGroupBy) Strings

func (sogb *SeckillOrderGroupBy) 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 (*SeckillOrderGroupBy) StringsX

func (sogb *SeckillOrderGroupBy) StringsX(ctx context.Context) []string

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

type SeckillOrderMutation

type SeckillOrderMutation struct {
	// contains filtered or unexported fields
}

SeckillOrderMutation represents an operation that mutates the SeckillOrder nodes in the graph.

func (*SeckillOrderMutation) AddField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) AddGoodsID

func (m *SeckillOrderMutation) AddGoodsID(i int64)

AddGoodsID adds i to the "goods_id" field.

func (*SeckillOrderMutation) AddOrderID

func (m *SeckillOrderMutation) AddOrderID(i int64)

AddOrderID adds i to the "order_id" field.

func (*SeckillOrderMutation) AddUserID

func (m *SeckillOrderMutation) AddUserID(i int64)

AddUserID adds i to the "user_id" field.

func (*SeckillOrderMutation) AddedEdges

func (m *SeckillOrderMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*SeckillOrderMutation) AddedField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) AddedFields

func (m *SeckillOrderMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*SeckillOrderMutation) AddedGoodsID

func (m *SeckillOrderMutation) AddedGoodsID() (r int64, exists bool)

AddedGoodsID returns the value that was added to the "goods_id" field in this mutation.

func (*SeckillOrderMutation) AddedIDs

func (m *SeckillOrderMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*SeckillOrderMutation) AddedOrderID

func (m *SeckillOrderMutation) AddedOrderID() (r int64, exists bool)

AddedOrderID returns the value that was added to the "order_id" field in this mutation.

func (*SeckillOrderMutation) AddedUserID

func (m *SeckillOrderMutation) AddedUserID() (r int64, exists bool)

AddedUserID returns the value that was added to the "user_id" field in this mutation.

func (*SeckillOrderMutation) ClearEdge

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) ClearField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) ClearedEdges

func (m *SeckillOrderMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*SeckillOrderMutation) ClearedFields

func (m *SeckillOrderMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (SeckillOrderMutation) Client

func (m SeckillOrderMutation) 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 (*SeckillOrderMutation) EdgeCleared

func (m *SeckillOrderMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*SeckillOrderMutation) Field

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) FieldCleared

func (m *SeckillOrderMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*SeckillOrderMutation) Fields

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) GoodsID

func (m *SeckillOrderMutation) GoodsID() (r int64, exists bool)

GoodsID returns the value of the "goods_id" field in the mutation.

func (*SeckillOrderMutation) ID

func (m *SeckillOrderMutation) ID() (id int64, 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 (*SeckillOrderMutation) OldField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) OldGoodsID

func (m *SeckillOrderMutation) OldGoodsID(ctx context.Context) (v int64, err error)

OldGoodsID returns the old "goods_id" field's value of the SeckillOrder entity. If the SeckillOrder 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 (*SeckillOrderMutation) OldOrderID

func (m *SeckillOrderMutation) OldOrderID(ctx context.Context) (v int64, err error)

OldOrderID returns the old "order_id" field's value of the SeckillOrder entity. If the SeckillOrder 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 (*SeckillOrderMutation) OldUserID

func (m *SeckillOrderMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the SeckillOrder entity. If the SeckillOrder 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 (*SeckillOrderMutation) Op

func (m *SeckillOrderMutation) Op() Op

Op returns the operation name.

func (*SeckillOrderMutation) OrderID

func (m *SeckillOrderMutation) OrderID() (r int64, exists bool)

OrderID returns the value of the "order_id" field in the mutation.

func (*SeckillOrderMutation) RemovedEdges

func (m *SeckillOrderMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*SeckillOrderMutation) RemovedIDs

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) ResetEdge

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) ResetField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) ResetGoodsID

func (m *SeckillOrderMutation) ResetGoodsID()

ResetGoodsID resets all changes to the "goods_id" field.

func (*SeckillOrderMutation) ResetOrderID

func (m *SeckillOrderMutation) ResetOrderID()

ResetOrderID resets all changes to the "order_id" field.

func (*SeckillOrderMutation) ResetUserID

func (m *SeckillOrderMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*SeckillOrderMutation) SetField

func (m *SeckillOrderMutation) 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 (*SeckillOrderMutation) SetGoodsID

func (m *SeckillOrderMutation) SetGoodsID(i int64)

SetGoodsID sets the "goods_id" field.

func (*SeckillOrderMutation) SetID

func (m *SeckillOrderMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of SeckillOrder entities.

func (*SeckillOrderMutation) SetOrderID

func (m *SeckillOrderMutation) SetOrderID(i int64)

SetOrderID sets the "order_id" field.

func (*SeckillOrderMutation) SetUserID

func (m *SeckillOrderMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (SeckillOrderMutation) Tx

func (m SeckillOrderMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*SeckillOrderMutation) Type

func (m *SeckillOrderMutation) Type() string

Type returns the node type of this mutation (SeckillOrder).

func (*SeckillOrderMutation) UserID

func (m *SeckillOrderMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

type SeckillOrderQuery

type SeckillOrderQuery struct {
	// contains filtered or unexported fields
}

SeckillOrderQuery is the builder for querying SeckillOrder entities.

func (*SeckillOrderQuery) All

func (soq *SeckillOrderQuery) All(ctx context.Context) ([]*SeckillOrder, error)

All executes the query and returns a list of SeckillOrders.

func (*SeckillOrderQuery) AllX

func (soq *SeckillOrderQuery) AllX(ctx context.Context) []*SeckillOrder

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

func (*SeckillOrderQuery) Clone

func (soq *SeckillOrderQuery) Clone() *SeckillOrderQuery

Clone returns a duplicate of the SeckillOrderQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*SeckillOrderQuery) Count

func (soq *SeckillOrderQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SeckillOrderQuery) CountX

func (soq *SeckillOrderQuery) CountX(ctx context.Context) int

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

func (*SeckillOrderQuery) Exist

func (soq *SeckillOrderQuery) Exist(ctx context.Context) (bool, error)

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

func (*SeckillOrderQuery) ExistX

func (soq *SeckillOrderQuery) ExistX(ctx context.Context) bool

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

func (*SeckillOrderQuery) First

func (soq *SeckillOrderQuery) First(ctx context.Context) (*SeckillOrder, error)

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

func (*SeckillOrderQuery) FirstID

func (soq *SeckillOrderQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*SeckillOrderQuery) FirstIDX

func (soq *SeckillOrderQuery) FirstIDX(ctx context.Context) int64

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

func (*SeckillOrderQuery) FirstX

func (soq *SeckillOrderQuery) FirstX(ctx context.Context) *SeckillOrder

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

func (*SeckillOrderQuery) GroupBy

func (soq *SeckillOrderQuery) GroupBy(field string, fields ...string) *SeckillOrderGroupBy

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 {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.SeckillOrder.Query().
	GroupBy(seckillorder.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SeckillOrderQuery) IDs

func (soq *SeckillOrderQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*SeckillOrderQuery) IDsX

func (soq *SeckillOrderQuery) IDsX(ctx context.Context) []int64

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

func (*SeckillOrderQuery) Limit

func (soq *SeckillOrderQuery) Limit(limit int) *SeckillOrderQuery

Limit adds a limit step to the query.

func (*SeckillOrderQuery) Offset

func (soq *SeckillOrderQuery) Offset(offset int) *SeckillOrderQuery

Offset adds an offset step to the query.

func (*SeckillOrderQuery) Only

func (soq *SeckillOrderQuery) Only(ctx context.Context) (*SeckillOrder, error)

Only returns a single SeckillOrder entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one SeckillOrder entity is not found. Returns a *NotFoundError when no SeckillOrder entities are found.

func (*SeckillOrderQuery) OnlyID

func (soq *SeckillOrderQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only SeckillOrder ID in the query. Returns a *NotSingularError when exactly one SeckillOrder ID is not found. Returns a *NotFoundError when no entities are found.

func (*SeckillOrderQuery) OnlyIDX

func (soq *SeckillOrderQuery) OnlyIDX(ctx context.Context) int64

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

func (*SeckillOrderQuery) OnlyX

func (soq *SeckillOrderQuery) OnlyX(ctx context.Context) *SeckillOrder

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

func (*SeckillOrderQuery) Order

func (soq *SeckillOrderQuery) Order(o ...OrderFunc) *SeckillOrderQuery

Order adds an order step to the query.

func (*SeckillOrderQuery) Select

func (soq *SeckillOrderQuery) Select(field string, fields ...string) *SeckillOrderSelect

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 {
	UserID int64 `json:"user_id,omitempty"`
}

client.SeckillOrder.Query().
	Select(seckillorder.FieldUserID).
	Scan(ctx, &v)

func (*SeckillOrderQuery) Unique

func (soq *SeckillOrderQuery) Unique(unique bool) *SeckillOrderQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*SeckillOrderQuery) Where

Where adds a new predicate for the SeckillOrderQuery builder.

type SeckillOrderSelect

type SeckillOrderSelect struct {
	*SeckillOrderQuery
	// contains filtered or unexported fields
}

SeckillOrderSelect is the builder for selecting fields of SeckillOrder entities.

func (*SeckillOrderSelect) Bool

func (sos *SeckillOrderSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) BoolX

func (sos *SeckillOrderSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SeckillOrderSelect) Bools

func (sos *SeckillOrderSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) BoolsX

func (sos *SeckillOrderSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SeckillOrderSelect) Float64

func (sos *SeckillOrderSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) Float64X

func (sos *SeckillOrderSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SeckillOrderSelect) Float64s

func (sos *SeckillOrderSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) Float64sX

func (sos *SeckillOrderSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SeckillOrderSelect) Int

func (sos *SeckillOrderSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) IntX

func (sos *SeckillOrderSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SeckillOrderSelect) Ints

func (sos *SeckillOrderSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) IntsX

func (sos *SeckillOrderSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SeckillOrderSelect) Scan

func (sos *SeckillOrderSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*SeckillOrderSelect) ScanX

func (sos *SeckillOrderSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SeckillOrderSelect) String

func (sos *SeckillOrderSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*SeckillOrderSelect) StringX

func (sos *SeckillOrderSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SeckillOrderSelect) Strings

func (sos *SeckillOrderSelect) Strings(ctx context.Context) ([]string, error)

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

func (*SeckillOrderSelect) StringsX

func (sos *SeckillOrderSelect) StringsX(ctx context.Context) []string

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

type SeckillOrderUpdate

type SeckillOrderUpdate struct {
	// contains filtered or unexported fields
}

SeckillOrderUpdate is the builder for updating SeckillOrder entities.

func (*SeckillOrderUpdate) AddGoodsID

func (sou *SeckillOrderUpdate) AddGoodsID(i int64) *SeckillOrderUpdate

AddGoodsID adds i to the "goods_id" field.

func (*SeckillOrderUpdate) AddOrderID

func (sou *SeckillOrderUpdate) AddOrderID(i int64) *SeckillOrderUpdate

AddOrderID adds i to the "order_id" field.

func (*SeckillOrderUpdate) AddUserID

func (sou *SeckillOrderUpdate) AddUserID(i int64) *SeckillOrderUpdate

AddUserID adds i to the "user_id" field.

func (*SeckillOrderUpdate) Exec

func (sou *SeckillOrderUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SeckillOrderUpdate) ExecX

func (sou *SeckillOrderUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SeckillOrderUpdate) Mutation

func (sou *SeckillOrderUpdate) Mutation() *SeckillOrderMutation

Mutation returns the SeckillOrderMutation object of the builder.

func (*SeckillOrderUpdate) Save

func (sou *SeckillOrderUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*SeckillOrderUpdate) SaveX

func (sou *SeckillOrderUpdate) SaveX(ctx context.Context) int

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

func (*SeckillOrderUpdate) SetGoodsID

func (sou *SeckillOrderUpdate) SetGoodsID(i int64) *SeckillOrderUpdate

SetGoodsID sets the "goods_id" field.

func (*SeckillOrderUpdate) SetOrderID

func (sou *SeckillOrderUpdate) SetOrderID(i int64) *SeckillOrderUpdate

SetOrderID sets the "order_id" field.

func (*SeckillOrderUpdate) SetUserID

func (sou *SeckillOrderUpdate) SetUserID(i int64) *SeckillOrderUpdate

SetUserID sets the "user_id" field.

func (*SeckillOrderUpdate) Where

Where adds a new predicate for the SeckillOrderUpdate builder.

type SeckillOrderUpdateOne

type SeckillOrderUpdateOne struct {
	// contains filtered or unexported fields
}

SeckillOrderUpdateOne is the builder for updating a single SeckillOrder entity.

func (*SeckillOrderUpdateOne) AddGoodsID

func (souo *SeckillOrderUpdateOne) AddGoodsID(i int64) *SeckillOrderUpdateOne

AddGoodsID adds i to the "goods_id" field.

func (*SeckillOrderUpdateOne) AddOrderID

func (souo *SeckillOrderUpdateOne) AddOrderID(i int64) *SeckillOrderUpdateOne

AddOrderID adds i to the "order_id" field.

func (*SeckillOrderUpdateOne) AddUserID

AddUserID adds i to the "user_id" field.

func (*SeckillOrderUpdateOne) Exec

func (souo *SeckillOrderUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SeckillOrderUpdateOne) ExecX

func (souo *SeckillOrderUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SeckillOrderUpdateOne) Mutation

func (souo *SeckillOrderUpdateOne) Mutation() *SeckillOrderMutation

Mutation returns the SeckillOrderMutation object of the builder.

func (*SeckillOrderUpdateOne) Save

Save executes the query and returns the updated SeckillOrder entity.

func (*SeckillOrderUpdateOne) SaveX

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

func (*SeckillOrderUpdateOne) Select

func (souo *SeckillOrderUpdateOne) Select(field string, fields ...string) *SeckillOrderUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*SeckillOrderUpdateOne) SetGoodsID

func (souo *SeckillOrderUpdateOne) SetGoodsID(i int64) *SeckillOrderUpdateOne

SetGoodsID sets the "goods_id" field.

func (*SeckillOrderUpdateOne) SetOrderID

func (souo *SeckillOrderUpdateOne) SetOrderID(i int64) *SeckillOrderUpdateOne

SetOrderID sets the "order_id" field.

func (*SeckillOrderUpdateOne) SetUserID

SetUserID sets the "user_id" field.

type SeckillOrders

type SeckillOrders []*SeckillOrder

SeckillOrders is a parsable slice of SeckillOrder.

type Tx

type Tx struct {

	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// SeckillGoods is the client for interacting with the SeckillGoods builders.
	SeckillGoods *SeckillGoodsClient
	// SeckillOrder is the client for interacting with the SeckillOrder builders.
	SeckillOrder *SeckillOrderClient
	// 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