ent

package
v0.0.0-...-393e050 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 24 Imported by: 2

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.
	TypeCampaign        = "Campaign"
	TypeCard            = "Card"
	TypeUser            = "User"
	TypeUserBalance     = "UserBalance"
	TypeUserVoucher     = "UserVoucher"
	TypeVoucher         = "Voucher"
	TypeVoucherCampaign = "VoucherCampaign"
)

Variables

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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 validation 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 Campaign

type Campaign struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// CurrentSlot holds the value of the "current_slot" field.
	CurrentSlot int64 `json:"current_slot,omitempty"`
	// StartDay holds the value of the "start_day" field.
	StartDay time.Time `json:"start_day,omitempty"`
	// EndDay holds the value of the "end_day" field.
	EndDay time.Time `json:"end_day,omitempty"`
	// TotalSlot holds the value of the "total_slot" field.
	TotalSlot int64 `json:"total_slot,omitempty"`
	// IsFull holds the value of the "is_full" field.
	IsFull bool `json:"is_full,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
}

Campaign is the model entity for the Campaign schema.

func (*Campaign) String

func (c *Campaign) String() string

String implements the fmt.Stringer.

func (*Campaign) Unwrap

func (c *Campaign) Unwrap() *Campaign

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

func (c *Campaign) Update() *CampaignUpdateOne

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

func (*Campaign) Value

func (c *Campaign) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Campaign. This includes values selected through modifiers, order, etc.

type CampaignClient

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

CampaignClient is a client for the Campaign schema.

func NewCampaignClient

func NewCampaignClient(c config) *CampaignClient

NewCampaignClient returns a client for the Campaign from the given config.

func (*CampaignClient) Create

func (c *CampaignClient) Create() *CampaignCreate

Create returns a builder for creating a Campaign entity.

func (*CampaignClient) CreateBulk

func (c *CampaignClient) CreateBulk(builders ...*CampaignCreate) *CampaignCreateBulk

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

func (*CampaignClient) Delete

func (c *CampaignClient) Delete() *CampaignDelete

Delete returns a delete builder for Campaign.

func (*CampaignClient) DeleteOne

func (c *CampaignClient) DeleteOne(ca *Campaign) *CampaignDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CampaignClient) DeleteOneID

func (c *CampaignClient) DeleteOneID(id int) *CampaignDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*CampaignClient) Get

func (c *CampaignClient) Get(ctx context.Context, id int) (*Campaign, error)

Get returns a Campaign entity by its id.

func (*CampaignClient) GetX

func (c *CampaignClient) GetX(ctx context.Context, id int) *Campaign

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

func (*CampaignClient) Hooks

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

Hooks returns the client hooks.

func (*CampaignClient) Intercept

func (c *CampaignClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `campaign.Intercept(f(g(h())))`.

func (*CampaignClient) Interceptors

func (c *CampaignClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*CampaignClient) MapCreateBulk

func (c *CampaignClient) MapCreateBulk(slice any, setFunc func(*CampaignCreate, int)) *CampaignCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*CampaignClient) Query

func (c *CampaignClient) Query() *CampaignQuery

Query returns a query builder for Campaign.

func (*CampaignClient) Update

func (c *CampaignClient) Update() *CampaignUpdate

Update returns an update builder for Campaign.

func (*CampaignClient) UpdateOne

func (c *CampaignClient) UpdateOne(ca *Campaign) *CampaignUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CampaignClient) UpdateOneID

func (c *CampaignClient) UpdateOneID(id int) *CampaignUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CampaignClient) Use

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

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

type CampaignCreate

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

CampaignCreate is the builder for creating a Campaign entity.

func (*CampaignCreate) Exec

func (cc *CampaignCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CampaignCreate) ExecX

func (cc *CampaignCreate) ExecX(ctx context.Context)

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

func (*CampaignCreate) Mutation

func (cc *CampaignCreate) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignCreate) Save

func (cc *CampaignCreate) Save(ctx context.Context) (*Campaign, error)

Save creates the Campaign in the database.

func (*CampaignCreate) SaveX

func (cc *CampaignCreate) SaveX(ctx context.Context) *Campaign

SaveX calls Save and panics if Save returns an error.

func (*CampaignCreate) SetCreatedAt

func (cc *CampaignCreate) SetCreatedAt(t time.Time) *CampaignCreate

SetCreatedAt sets the "created_at" field.

func (*CampaignCreate) SetCurrentSlot

func (cc *CampaignCreate) SetCurrentSlot(i int64) *CampaignCreate

SetCurrentSlot sets the "current_slot" field.

func (*CampaignCreate) SetEndDay

func (cc *CampaignCreate) SetEndDay(t time.Time) *CampaignCreate

SetEndDay sets the "end_day" field.

func (*CampaignCreate) SetIsFull

func (cc *CampaignCreate) SetIsFull(b bool) *CampaignCreate

SetIsFull sets the "is_full" field.

func (*CampaignCreate) SetName

func (cc *CampaignCreate) SetName(s string) *CampaignCreate

SetName sets the "name" field.

func (*CampaignCreate) SetNillableCreatedAt

func (cc *CampaignCreate) SetNillableCreatedAt(t *time.Time) *CampaignCreate

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

func (*CampaignCreate) SetNillableUpdatedAt

func (cc *CampaignCreate) SetNillableUpdatedAt(t *time.Time) *CampaignCreate

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

func (*CampaignCreate) SetStartDay

func (cc *CampaignCreate) SetStartDay(t time.Time) *CampaignCreate

SetStartDay sets the "start_day" field.

func (*CampaignCreate) SetTotalSlot

func (cc *CampaignCreate) SetTotalSlot(i int64) *CampaignCreate

SetTotalSlot sets the "total_slot" field.

func (*CampaignCreate) SetUpdatedAt

func (cc *CampaignCreate) SetUpdatedAt(t time.Time) *CampaignCreate

SetUpdatedAt sets the "updated_at" field.

type CampaignCreateBulk

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

CampaignCreateBulk is the builder for creating many Campaign entities in bulk.

func (*CampaignCreateBulk) Exec

func (ccb *CampaignCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CampaignCreateBulk) ExecX

func (ccb *CampaignCreateBulk) ExecX(ctx context.Context)

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

func (*CampaignCreateBulk) Save

func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error)

Save creates the Campaign entities in the database.

func (*CampaignCreateBulk) SaveX

func (ccb *CampaignCreateBulk) SaveX(ctx context.Context) []*Campaign

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

type CampaignDelete

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

CampaignDelete is the builder for deleting a Campaign entity.

func (*CampaignDelete) Exec

func (cd *CampaignDelete) Exec(ctx context.Context) (int, error)

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

func (*CampaignDelete) ExecX

func (cd *CampaignDelete) ExecX(ctx context.Context) int

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

func (*CampaignDelete) Where

func (cd *CampaignDelete) Where(ps ...predicate.Campaign) *CampaignDelete

Where appends a list predicates to the CampaignDelete builder.

type CampaignDeleteOne

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

CampaignDeleteOne is the builder for deleting a single Campaign entity.

func (*CampaignDeleteOne) Exec

func (cdo *CampaignDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CampaignDeleteOne) ExecX

func (cdo *CampaignDeleteOne) ExecX(ctx context.Context)

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

func (*CampaignDeleteOne) Where

Where appends a list predicates to the CampaignDelete builder.

type CampaignGroupBy

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

CampaignGroupBy is the group-by builder for Campaign entities.

func (*CampaignGroupBy) Aggregate

func (cgb *CampaignGroupBy) Aggregate(fns ...AggregateFunc) *CampaignGroupBy

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

func (*CampaignGroupBy) Bool

func (s *CampaignGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*CampaignGroupBy) BoolX

func (s *CampaignGroupBy) BoolX(ctx context.Context) bool

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

func (*CampaignGroupBy) Bools

func (s *CampaignGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*CampaignGroupBy) BoolsX

func (s *CampaignGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CampaignGroupBy) Float64

func (s *CampaignGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*CampaignGroupBy) Float64X

func (s *CampaignGroupBy) Float64X(ctx context.Context) float64

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

func (*CampaignGroupBy) Float64s

func (s *CampaignGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*CampaignGroupBy) Float64sX

func (s *CampaignGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CampaignGroupBy) Int

func (s *CampaignGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*CampaignGroupBy) IntX

func (s *CampaignGroupBy) IntX(ctx context.Context) int

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

func (*CampaignGroupBy) Ints

func (s *CampaignGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*CampaignGroupBy) IntsX

func (s *CampaignGroupBy) IntsX(ctx context.Context) []int

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

func (*CampaignGroupBy) Scan

func (cgb *CampaignGroupBy) Scan(ctx context.Context, v any) error

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

func (*CampaignGroupBy) ScanX

func (s *CampaignGroupBy) ScanX(ctx context.Context, v any)

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

func (*CampaignGroupBy) String

func (s *CampaignGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*CampaignGroupBy) StringX

func (s *CampaignGroupBy) StringX(ctx context.Context) string

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

func (*CampaignGroupBy) Strings

func (s *CampaignGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CampaignGroupBy) StringsX

func (s *CampaignGroupBy) StringsX(ctx context.Context) []string

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

type CampaignMutation

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

CampaignMutation represents an operation that mutates the Campaign nodes in the graph.

func (*CampaignMutation) AddCurrentSlot

func (m *CampaignMutation) AddCurrentSlot(i int64)

AddCurrentSlot adds i to the "current_slot" field.

func (*CampaignMutation) AddField

func (m *CampaignMutation) 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 (*CampaignMutation) AddTotalSlot

func (m *CampaignMutation) AddTotalSlot(i int64)

AddTotalSlot adds i to the "total_slot" field.

func (*CampaignMutation) AddedCurrentSlot

func (m *CampaignMutation) AddedCurrentSlot() (r int64, exists bool)

AddedCurrentSlot returns the value that was added to the "current_slot" field in this mutation.

func (*CampaignMutation) AddedEdges

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

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

func (*CampaignMutation) AddedField

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

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

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

func (*CampaignMutation) AddedIDs

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

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

func (*CampaignMutation) AddedTotalSlot

func (m *CampaignMutation) AddedTotalSlot() (r int64, exists bool)

AddedTotalSlot returns the value that was added to the "total_slot" field in this mutation.

func (*CampaignMutation) ClearEdge

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

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

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

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

func (*CampaignMutation) ClearedFields

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

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

func (CampaignMutation) Client

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

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

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

func (*CampaignMutation) CurrentSlot

func (m *CampaignMutation) CurrentSlot() (r int64, exists bool)

CurrentSlot returns the value of the "current_slot" field in the mutation.

func (*CampaignMutation) EdgeCleared

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

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

func (*CampaignMutation) EndDay

func (m *CampaignMutation) EndDay() (r time.Time, exists bool)

EndDay returns the value of the "end_day" field in the mutation.

func (*CampaignMutation) Field

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

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

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

func (*CampaignMutation) Fields

func (m *CampaignMutation) 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 (*CampaignMutation) ID

func (m *CampaignMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*CampaignMutation) IDs

func (m *CampaignMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*CampaignMutation) IsFull

func (m *CampaignMutation) IsFull() (r bool, exists bool)

IsFull returns the value of the "is_full" field in the mutation.

func (*CampaignMutation) Name

func (m *CampaignMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*CampaignMutation) OldCreatedAt

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

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

func (m *CampaignMutation) OldCurrentSlot(ctx context.Context) (v int64, err error)

OldCurrentSlot returns the old "current_slot" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldEndDay

func (m *CampaignMutation) OldEndDay(ctx context.Context) (v time.Time, err error)

OldEndDay returns the old "end_day" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldField

func (m *CampaignMutation) 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 (*CampaignMutation) OldIsFull

func (m *CampaignMutation) OldIsFull(ctx context.Context) (v bool, err error)

OldIsFull returns the old "is_full" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldName

func (m *CampaignMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldStartDay

func (m *CampaignMutation) OldStartDay(ctx context.Context) (v time.Time, err error)

OldStartDay returns the old "start_day" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldTotalSlot

func (m *CampaignMutation) OldTotalSlot(ctx context.Context) (v int64, err error)

OldTotalSlot returns the old "total_slot" field's value of the Campaign entity. If the Campaign 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 (*CampaignMutation) OldUpdatedAt

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

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

func (m *CampaignMutation) Op() Op

Op returns the operation name.

func (*CampaignMutation) RemovedEdges

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

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

func (*CampaignMutation) RemovedIDs

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

func (m *CampaignMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CampaignMutation) ResetCurrentSlot

func (m *CampaignMutation) ResetCurrentSlot()

ResetCurrentSlot resets all changes to the "current_slot" field.

func (*CampaignMutation) ResetEdge

func (m *CampaignMutation) 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 (*CampaignMutation) ResetEndDay

func (m *CampaignMutation) ResetEndDay()

ResetEndDay resets all changes to the "end_day" field.

func (*CampaignMutation) ResetField

func (m *CampaignMutation) 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 (*CampaignMutation) ResetIsFull

func (m *CampaignMutation) ResetIsFull()

ResetIsFull resets all changes to the "is_full" field.

func (*CampaignMutation) ResetName

func (m *CampaignMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CampaignMutation) ResetStartDay

func (m *CampaignMutation) ResetStartDay()

ResetStartDay resets all changes to the "start_day" field.

func (*CampaignMutation) ResetTotalSlot

func (m *CampaignMutation) ResetTotalSlot()

ResetTotalSlot resets all changes to the "total_slot" field.

func (*CampaignMutation) ResetUpdatedAt

func (m *CampaignMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CampaignMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CampaignMutation) SetCurrentSlot

func (m *CampaignMutation) SetCurrentSlot(i int64)

SetCurrentSlot sets the "current_slot" field.

func (*CampaignMutation) SetEndDay

func (m *CampaignMutation) SetEndDay(t time.Time)

SetEndDay sets the "end_day" field.

func (*CampaignMutation) SetField

func (m *CampaignMutation) 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 (*CampaignMutation) SetIsFull

func (m *CampaignMutation) SetIsFull(b bool)

SetIsFull sets the "is_full" field.

func (*CampaignMutation) SetName

func (m *CampaignMutation) SetName(s string)

SetName sets the "name" field.

func (*CampaignMutation) SetOp

func (m *CampaignMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CampaignMutation) SetStartDay

func (m *CampaignMutation) SetStartDay(t time.Time)

SetStartDay sets the "start_day" field.

func (*CampaignMutation) SetTotalSlot

func (m *CampaignMutation) SetTotalSlot(i int64)

SetTotalSlot sets the "total_slot" field.

func (*CampaignMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CampaignMutation) StartDay

func (m *CampaignMutation) StartDay() (r time.Time, exists bool)

StartDay returns the value of the "start_day" field in the mutation.

func (*CampaignMutation) TotalSlot

func (m *CampaignMutation) TotalSlot() (r int64, exists bool)

TotalSlot returns the value of the "total_slot" field in the mutation.

func (CampaignMutation) Tx

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

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

func (*CampaignMutation) Type

func (m *CampaignMutation) Type() string

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

func (*CampaignMutation) UpdatedAt

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

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

func (*CampaignMutation) Where

func (m *CampaignMutation) Where(ps ...predicate.Campaign)

Where appends a list predicates to the CampaignMutation builder.

func (*CampaignMutation) WhereP

func (m *CampaignMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the CampaignMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type CampaignQuery

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

CampaignQuery is the builder for querying Campaign entities.

func (*CampaignQuery) Aggregate

func (cq *CampaignQuery) Aggregate(fns ...AggregateFunc) *CampaignSelect

Aggregate returns a CampaignSelect configured with the given aggregations.

func (*CampaignQuery) All

func (cq *CampaignQuery) All(ctx context.Context) ([]*Campaign, error)

All executes the query and returns a list of Campaigns.

func (*CampaignQuery) AllX

func (cq *CampaignQuery) AllX(ctx context.Context) []*Campaign

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

func (*CampaignQuery) Clone

func (cq *CampaignQuery) Clone() *CampaignQuery

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

func (*CampaignQuery) Count

func (cq *CampaignQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CampaignQuery) CountX

func (cq *CampaignQuery) CountX(ctx context.Context) int

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

func (*CampaignQuery) Exist

func (cq *CampaignQuery) Exist(ctx context.Context) (bool, error)

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

func (*CampaignQuery) ExistX

func (cq *CampaignQuery) ExistX(ctx context.Context) bool

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

func (*CampaignQuery) First

func (cq *CampaignQuery) First(ctx context.Context) (*Campaign, error)

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

func (*CampaignQuery) FirstID

func (cq *CampaignQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CampaignQuery) FirstIDX

func (cq *CampaignQuery) FirstIDX(ctx context.Context) int

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

func (*CampaignQuery) FirstX

func (cq *CampaignQuery) FirstX(ctx context.Context) *Campaign

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

func (*CampaignQuery) GroupBy

func (cq *CampaignQuery) GroupBy(field string, fields ...string) *CampaignGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Campaign.Query().
	GroupBy(campaign.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CampaignQuery) IDs

func (cq *CampaignQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*CampaignQuery) IDsX

func (cq *CampaignQuery) IDsX(ctx context.Context) []int

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

func (*CampaignQuery) Limit

func (cq *CampaignQuery) Limit(limit int) *CampaignQuery

Limit the number of records to be returned by this query.

func (*CampaignQuery) Offset

func (cq *CampaignQuery) Offset(offset int) *CampaignQuery

Offset to start from.

func (*CampaignQuery) Only

func (cq *CampaignQuery) Only(ctx context.Context) (*Campaign, error)

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

func (*CampaignQuery) OnlyID

func (cq *CampaignQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CampaignQuery) OnlyIDX

func (cq *CampaignQuery) OnlyIDX(ctx context.Context) int

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

func (*CampaignQuery) OnlyX

func (cq *CampaignQuery) OnlyX(ctx context.Context) *Campaign

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

func (*CampaignQuery) Order

Order specifies how the records should be ordered.

func (*CampaignQuery) Select

func (cq *CampaignQuery) Select(fields ...string) *CampaignSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Campaign.Query().
	Select(campaign.FieldName).
	Scan(ctx, &v)

func (*CampaignQuery) Unique

func (cq *CampaignQuery) Unique(unique bool) *CampaignQuery

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 (*CampaignQuery) Where

func (cq *CampaignQuery) Where(ps ...predicate.Campaign) *CampaignQuery

Where adds a new predicate for the CampaignQuery builder.

type CampaignSelect

type CampaignSelect struct {
	*CampaignQuery
	// contains filtered or unexported fields
}

CampaignSelect is the builder for selecting fields of Campaign entities.

func (*CampaignSelect) Aggregate

func (cs *CampaignSelect) Aggregate(fns ...AggregateFunc) *CampaignSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CampaignSelect) Bool

func (s *CampaignSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CampaignSelect) BoolX

func (s *CampaignSelect) BoolX(ctx context.Context) bool

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

func (*CampaignSelect) Bools

func (s *CampaignSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CampaignSelect) BoolsX

func (s *CampaignSelect) BoolsX(ctx context.Context) []bool

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

func (*CampaignSelect) Float64

func (s *CampaignSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CampaignSelect) Float64X

func (s *CampaignSelect) Float64X(ctx context.Context) float64

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

func (*CampaignSelect) Float64s

func (s *CampaignSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CampaignSelect) Float64sX

func (s *CampaignSelect) Float64sX(ctx context.Context) []float64

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

func (*CampaignSelect) Int

func (s *CampaignSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CampaignSelect) IntX

func (s *CampaignSelect) IntX(ctx context.Context) int

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

func (*CampaignSelect) Ints

func (s *CampaignSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CampaignSelect) IntsX

func (s *CampaignSelect) IntsX(ctx context.Context) []int

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

func (*CampaignSelect) Scan

func (cs *CampaignSelect) Scan(ctx context.Context, v any) error

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

func (*CampaignSelect) ScanX

func (s *CampaignSelect) ScanX(ctx context.Context, v any)

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

func (*CampaignSelect) String

func (s *CampaignSelect) String(ctx context.Context) (_ string, err error)

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

func (*CampaignSelect) StringX

func (s *CampaignSelect) StringX(ctx context.Context) string

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

func (*CampaignSelect) Strings

func (s *CampaignSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CampaignSelect) StringsX

func (s *CampaignSelect) StringsX(ctx context.Context) []string

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

type CampaignUpdate

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

CampaignUpdate is the builder for updating Campaign entities.

func (*CampaignUpdate) AddCurrentSlot

func (cu *CampaignUpdate) AddCurrentSlot(i int64) *CampaignUpdate

AddCurrentSlot adds i to the "current_slot" field.

func (*CampaignUpdate) AddTotalSlot

func (cu *CampaignUpdate) AddTotalSlot(i int64) *CampaignUpdate

AddTotalSlot adds i to the "total_slot" field.

func (*CampaignUpdate) Exec

func (cu *CampaignUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CampaignUpdate) ExecX

func (cu *CampaignUpdate) ExecX(ctx context.Context)

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

func (*CampaignUpdate) Mutation

func (cu *CampaignUpdate) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignUpdate) Save

func (cu *CampaignUpdate) Save(ctx context.Context) (int, error)

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

func (*CampaignUpdate) SaveX

func (cu *CampaignUpdate) SaveX(ctx context.Context) int

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

func (*CampaignUpdate) SetCurrentSlot

func (cu *CampaignUpdate) SetCurrentSlot(i int64) *CampaignUpdate

SetCurrentSlot sets the "current_slot" field.

func (*CampaignUpdate) SetEndDay

func (cu *CampaignUpdate) SetEndDay(t time.Time) *CampaignUpdate

SetEndDay sets the "end_day" field.

func (*CampaignUpdate) SetIsFull

func (cu *CampaignUpdate) SetIsFull(b bool) *CampaignUpdate

SetIsFull sets the "is_full" field.

func (*CampaignUpdate) SetName

func (cu *CampaignUpdate) SetName(s string) *CampaignUpdate

SetName sets the "name" field.

func (*CampaignUpdate) SetStartDay

func (cu *CampaignUpdate) SetStartDay(t time.Time) *CampaignUpdate

SetStartDay sets the "start_day" field.

func (*CampaignUpdate) SetTotalSlot

func (cu *CampaignUpdate) SetTotalSlot(i int64) *CampaignUpdate

SetTotalSlot sets the "total_slot" field.

func (*CampaignUpdate) SetUpdatedAt

func (cu *CampaignUpdate) SetUpdatedAt(t time.Time) *CampaignUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CampaignUpdate) Where

func (cu *CampaignUpdate) Where(ps ...predicate.Campaign) *CampaignUpdate

Where appends a list predicates to the CampaignUpdate builder.

type CampaignUpdateOne

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

CampaignUpdateOne is the builder for updating a single Campaign entity.

func (*CampaignUpdateOne) AddCurrentSlot

func (cuo *CampaignUpdateOne) AddCurrentSlot(i int64) *CampaignUpdateOne

AddCurrentSlot adds i to the "current_slot" field.

func (*CampaignUpdateOne) AddTotalSlot

func (cuo *CampaignUpdateOne) AddTotalSlot(i int64) *CampaignUpdateOne

AddTotalSlot adds i to the "total_slot" field.

func (*CampaignUpdateOne) Exec

func (cuo *CampaignUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CampaignUpdateOne) ExecX

func (cuo *CampaignUpdateOne) ExecX(ctx context.Context)

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

func (*CampaignUpdateOne) Mutation

func (cuo *CampaignUpdateOne) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignUpdateOne) Save

func (cuo *CampaignUpdateOne) Save(ctx context.Context) (*Campaign, error)

Save executes the query and returns the updated Campaign entity.

func (*CampaignUpdateOne) SaveX

func (cuo *CampaignUpdateOne) SaveX(ctx context.Context) *Campaign

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

func (*CampaignUpdateOne) Select

func (cuo *CampaignUpdateOne) Select(field string, fields ...string) *CampaignUpdateOne

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

func (*CampaignUpdateOne) SetCurrentSlot

func (cuo *CampaignUpdateOne) SetCurrentSlot(i int64) *CampaignUpdateOne

SetCurrentSlot sets the "current_slot" field.

func (*CampaignUpdateOne) SetEndDay

func (cuo *CampaignUpdateOne) SetEndDay(t time.Time) *CampaignUpdateOne

SetEndDay sets the "end_day" field.

func (*CampaignUpdateOne) SetIsFull

func (cuo *CampaignUpdateOne) SetIsFull(b bool) *CampaignUpdateOne

SetIsFull sets the "is_full" field.

func (*CampaignUpdateOne) SetName

func (cuo *CampaignUpdateOne) SetName(s string) *CampaignUpdateOne

SetName sets the "name" field.

func (*CampaignUpdateOne) SetStartDay

func (cuo *CampaignUpdateOne) SetStartDay(t time.Time) *CampaignUpdateOne

SetStartDay sets the "start_day" field.

func (*CampaignUpdateOne) SetTotalSlot

func (cuo *CampaignUpdateOne) SetTotalSlot(i int64) *CampaignUpdateOne

SetTotalSlot sets the "total_slot" field.

func (*CampaignUpdateOne) SetUpdatedAt

func (cuo *CampaignUpdateOne) SetUpdatedAt(t time.Time) *CampaignUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CampaignUpdateOne) Where

Where appends a list predicates to the CampaignUpdate builder.

type Campaigns

type Campaigns []*Campaign

Campaigns is a parsable slice of Campaign.

type Card

type Card struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Value holds the value of the "value" field.
	Value float64 `json:"value,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
}

Card is the model entity for the Card schema.

func (*Card) GetValue

func (c *Card) GetValue(name string) (ent.Value, error)

GetValue returns the ent.Value that was dynamically selected and assigned to the Card. This includes values selected through modifiers, order, etc.

func (*Card) String

func (c *Card) String() string

String implements the fmt.Stringer.

func (*Card) Unwrap

func (c *Card) Unwrap() *Card

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

func (c *Card) Update() *CardUpdateOne

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

type CardClient

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

CardClient is a client for the Card schema.

func NewCardClient

func NewCardClient(c config) *CardClient

NewCardClient returns a client for the Card from the given config.

func (*CardClient) Create

func (c *CardClient) Create() *CardCreate

Create returns a builder for creating a Card entity.

func (*CardClient) CreateBulk

func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk

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

func (*CardClient) Delete

func (c *CardClient) Delete() *CardDelete

Delete returns a delete builder for Card.

func (*CardClient) DeleteOne

func (c *CardClient) DeleteOne(ca *Card) *CardDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CardClient) DeleteOneID

func (c *CardClient) DeleteOneID(id int) *CardDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*CardClient) Get

func (c *CardClient) Get(ctx context.Context, id int) (*Card, error)

Get returns a Card entity by its id.

func (*CardClient) GetX

func (c *CardClient) GetX(ctx context.Context, id int) *Card

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

func (*CardClient) Hooks

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

Hooks returns the client hooks.

func (*CardClient) Intercept

func (c *CardClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `card.Intercept(f(g(h())))`.

func (*CardClient) Interceptors

func (c *CardClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*CardClient) MapCreateBulk

func (c *CardClient) MapCreateBulk(slice any, setFunc func(*CardCreate, int)) *CardCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*CardClient) Query

func (c *CardClient) Query() *CardQuery

Query returns a query builder for Card.

func (*CardClient) Update

func (c *CardClient) Update() *CardUpdate

Update returns an update builder for Card.

func (*CardClient) UpdateOne

func (c *CardClient) UpdateOne(ca *Card) *CardUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CardClient) UpdateOneID

func (c *CardClient) UpdateOneID(id int) *CardUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CardClient) Use

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

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

type CardCreate

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

CardCreate is the builder for creating a Card entity.

func (*CardCreate) Exec

func (cc *CardCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CardCreate) ExecX

func (cc *CardCreate) ExecX(ctx context.Context)

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

func (*CardCreate) Mutation

func (cc *CardCreate) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardCreate) Save

func (cc *CardCreate) Save(ctx context.Context) (*Card, error)

Save creates the Card in the database.

func (*CardCreate) SaveX

func (cc *CardCreate) SaveX(ctx context.Context) *Card

SaveX calls Save and panics if Save returns an error.

func (*CardCreate) SetCreatedAt

func (cc *CardCreate) SetCreatedAt(t time.Time) *CardCreate

SetCreatedAt sets the "created_at" field.

func (*CardCreate) SetName

func (cc *CardCreate) SetName(s string) *CardCreate

SetName sets the "name" field.

func (*CardCreate) SetNillableCreatedAt

func (cc *CardCreate) SetNillableCreatedAt(t *time.Time) *CardCreate

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

func (*CardCreate) SetNillableUpdatedAt

func (cc *CardCreate) SetNillableUpdatedAt(t *time.Time) *CardCreate

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

func (*CardCreate) SetType

func (cc *CardCreate) SetType(s string) *CardCreate

SetType sets the "type" field.

func (*CardCreate) SetUpdatedAt

func (cc *CardCreate) SetUpdatedAt(t time.Time) *CardCreate

SetUpdatedAt sets the "updated_at" field.

func (*CardCreate) SetValue

func (cc *CardCreate) SetValue(f float64) *CardCreate

SetValue sets the "value" field.

type CardCreateBulk

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

CardCreateBulk is the builder for creating many Card entities in bulk.

func (*CardCreateBulk) Exec

func (ccb *CardCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CardCreateBulk) ExecX

func (ccb *CardCreateBulk) ExecX(ctx context.Context)

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

func (*CardCreateBulk) Save

func (ccb *CardCreateBulk) Save(ctx context.Context) ([]*Card, error)

Save creates the Card entities in the database.

func (*CardCreateBulk) SaveX

func (ccb *CardCreateBulk) SaveX(ctx context.Context) []*Card

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

type CardDelete

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

CardDelete is the builder for deleting a Card entity.

func (*CardDelete) Exec

func (cd *CardDelete) Exec(ctx context.Context) (int, error)

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

func (*CardDelete) ExecX

func (cd *CardDelete) ExecX(ctx context.Context) int

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

func (*CardDelete) Where

func (cd *CardDelete) Where(ps ...predicate.Card) *CardDelete

Where appends a list predicates to the CardDelete builder.

type CardDeleteOne

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

CardDeleteOne is the builder for deleting a single Card entity.

func (*CardDeleteOne) Exec

func (cdo *CardDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CardDeleteOne) ExecX

func (cdo *CardDeleteOne) ExecX(ctx context.Context)

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

func (*CardDeleteOne) Where

func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne

Where appends a list predicates to the CardDelete builder.

type CardGroupBy

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

CardGroupBy is the group-by builder for Card entities.

func (*CardGroupBy) Aggregate

func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy

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

func (*CardGroupBy) Bool

func (s *CardGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*CardGroupBy) BoolX

func (s *CardGroupBy) BoolX(ctx context.Context) bool

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

func (*CardGroupBy) Bools

func (s *CardGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*CardGroupBy) BoolsX

func (s *CardGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CardGroupBy) Float64

func (s *CardGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*CardGroupBy) Float64X

func (s *CardGroupBy) Float64X(ctx context.Context) float64

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

func (*CardGroupBy) Float64s

func (s *CardGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*CardGroupBy) Float64sX

func (s *CardGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CardGroupBy) Int

func (s *CardGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*CardGroupBy) IntX

func (s *CardGroupBy) IntX(ctx context.Context) int

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

func (*CardGroupBy) Ints

func (s *CardGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*CardGroupBy) IntsX

func (s *CardGroupBy) IntsX(ctx context.Context) []int

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

func (*CardGroupBy) Scan

func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error

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

func (*CardGroupBy) ScanX

func (s *CardGroupBy) ScanX(ctx context.Context, v any)

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

func (*CardGroupBy) String

func (s *CardGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*CardGroupBy) StringX

func (s *CardGroupBy) StringX(ctx context.Context) string

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

func (*CardGroupBy) Strings

func (s *CardGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CardGroupBy) StringsX

func (s *CardGroupBy) StringsX(ctx context.Context) []string

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

type CardMutation

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

CardMutation represents an operation that mutates the Card nodes in the graph.

func (*CardMutation) AddField

func (m *CardMutation) 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 (*CardMutation) AddValue

func (m *CardMutation) AddValue(f float64)

AddValue adds f to the "value" field.

func (*CardMutation) AddedEdges

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

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

func (*CardMutation) AddedField

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

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

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

func (*CardMutation) AddedIDs

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

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

func (*CardMutation) AddedValue

func (m *CardMutation) AddedValue() (r float64, exists bool)

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

func (*CardMutation) ClearEdge

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

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

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

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

func (*CardMutation) ClearedFields

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

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

func (CardMutation) Client

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

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

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

func (*CardMutation) EdgeCleared

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

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

func (*CardMutation) Field

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

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

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

func (*CardMutation) Fields

func (m *CardMutation) 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 (*CardMutation) GetType

func (m *CardMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*CardMutation) ID

func (m *CardMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*CardMutation) IDs

func (m *CardMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*CardMutation) Name

func (m *CardMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*CardMutation) OldCreatedAt

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

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

func (m *CardMutation) 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 (*CardMutation) OldName

func (m *CardMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Card entity. If the Card 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 (*CardMutation) OldType

func (m *CardMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Card entity. If the Card 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 (*CardMutation) OldUpdatedAt

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

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

func (m *CardMutation) OldValue(ctx context.Context) (v float64, err error)

OldValue returns the old "value" field's value of the Card entity. If the Card 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 (*CardMutation) Op

func (m *CardMutation) Op() Op

Op returns the operation name.

func (*CardMutation) RemovedEdges

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

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

func (*CardMutation) RemovedIDs

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

func (m *CardMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CardMutation) ResetEdge

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

func (m *CardMutation) 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 (*CardMutation) ResetName

func (m *CardMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CardMutation) ResetType

func (m *CardMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*CardMutation) ResetUpdatedAt

func (m *CardMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CardMutation) ResetValue

func (m *CardMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*CardMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CardMutation) SetField

func (m *CardMutation) 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 (*CardMutation) SetName

func (m *CardMutation) SetName(s string)

SetName sets the "name" field.

func (*CardMutation) SetOp

func (m *CardMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CardMutation) SetType

func (m *CardMutation) SetType(s string)

SetType sets the "type" field.

func (*CardMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CardMutation) SetValue

func (m *CardMutation) SetValue(f float64)

SetValue sets the "value" field.

func (CardMutation) Tx

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

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

func (*CardMutation) Type

func (m *CardMutation) Type() string

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

func (*CardMutation) UpdatedAt

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

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

func (*CardMutation) Value

func (m *CardMutation) Value() (r float64, exists bool)

Value returns the value of the "value" field in the mutation.

func (*CardMutation) Where

func (m *CardMutation) Where(ps ...predicate.Card)

Where appends a list predicates to the CardMutation builder.

func (*CardMutation) WhereP

func (m *CardMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the CardMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type CardQuery

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

CardQuery is the builder for querying Card entities.

func (*CardQuery) Aggregate

func (cq *CardQuery) Aggregate(fns ...AggregateFunc) *CardSelect

Aggregate returns a CardSelect configured with the given aggregations.

func (*CardQuery) All

func (cq *CardQuery) All(ctx context.Context) ([]*Card, error)

All executes the query and returns a list of Cards.

func (*CardQuery) AllX

func (cq *CardQuery) AllX(ctx context.Context) []*Card

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

func (*CardQuery) Clone

func (cq *CardQuery) Clone() *CardQuery

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

func (*CardQuery) Count

func (cq *CardQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CardQuery) CountX

func (cq *CardQuery) CountX(ctx context.Context) int

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

func (*CardQuery) Exist

func (cq *CardQuery) Exist(ctx context.Context) (bool, error)

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

func (*CardQuery) ExistX

func (cq *CardQuery) ExistX(ctx context.Context) bool

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

func (*CardQuery) First

func (cq *CardQuery) First(ctx context.Context) (*Card, error)

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

func (*CardQuery) FirstID

func (cq *CardQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CardQuery) FirstIDX

func (cq *CardQuery) FirstIDX(ctx context.Context) int

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

func (*CardQuery) FirstX

func (cq *CardQuery) FirstX(ctx context.Context) *Card

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

func (*CardQuery) GroupBy

func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Card.Query().
	GroupBy(card.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CardQuery) IDs

func (cq *CardQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*CardQuery) IDsX

func (cq *CardQuery) IDsX(ctx context.Context) []int

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

func (*CardQuery) Limit

func (cq *CardQuery) Limit(limit int) *CardQuery

Limit the number of records to be returned by this query.

func (*CardQuery) Offset

func (cq *CardQuery) Offset(offset int) *CardQuery

Offset to start from.

func (*CardQuery) Only

func (cq *CardQuery) Only(ctx context.Context) (*Card, error)

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

func (*CardQuery) OnlyID

func (cq *CardQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CardQuery) OnlyIDX

func (cq *CardQuery) OnlyIDX(ctx context.Context) int

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

func (*CardQuery) OnlyX

func (cq *CardQuery) OnlyX(ctx context.Context) *Card

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

func (*CardQuery) Order

func (cq *CardQuery) Order(o ...card.OrderOption) *CardQuery

Order specifies how the records should be ordered.

func (*CardQuery) Select

func (cq *CardQuery) Select(fields ...string) *CardSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Card.Query().
	Select(card.FieldName).
	Scan(ctx, &v)

func (*CardQuery) Unique

func (cq *CardQuery) Unique(unique bool) *CardQuery

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 (*CardQuery) Where

func (cq *CardQuery) Where(ps ...predicate.Card) *CardQuery

Where adds a new predicate for the CardQuery builder.

type CardSelect

type CardSelect struct {
	*CardQuery
	// contains filtered or unexported fields
}

CardSelect is the builder for selecting fields of Card entities.

func (*CardSelect) Aggregate

func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CardSelect) Bool

func (s *CardSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CardSelect) BoolX

func (s *CardSelect) BoolX(ctx context.Context) bool

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

func (*CardSelect) Bools

func (s *CardSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CardSelect) BoolsX

func (s *CardSelect) BoolsX(ctx context.Context) []bool

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

func (*CardSelect) Float64

func (s *CardSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CardSelect) Float64X

func (s *CardSelect) Float64X(ctx context.Context) float64

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

func (*CardSelect) Float64s

func (s *CardSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CardSelect) Float64sX

func (s *CardSelect) Float64sX(ctx context.Context) []float64

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

func (*CardSelect) Int

func (s *CardSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CardSelect) IntX

func (s *CardSelect) IntX(ctx context.Context) int

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

func (*CardSelect) Ints

func (s *CardSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CardSelect) IntsX

func (s *CardSelect) IntsX(ctx context.Context) []int

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

func (*CardSelect) Scan

func (cs *CardSelect) Scan(ctx context.Context, v any) error

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

func (*CardSelect) ScanX

func (s *CardSelect) ScanX(ctx context.Context, v any)

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

func (*CardSelect) String

func (s *CardSelect) String(ctx context.Context) (_ string, err error)

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

func (*CardSelect) StringX

func (s *CardSelect) StringX(ctx context.Context) string

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

func (*CardSelect) Strings

func (s *CardSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CardSelect) StringsX

func (s *CardSelect) StringsX(ctx context.Context) []string

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

type CardUpdate

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

CardUpdate is the builder for updating Card entities.

func (*CardUpdate) AddValue

func (cu *CardUpdate) AddValue(f float64) *CardUpdate

AddValue adds f to the "value" field.

func (*CardUpdate) Exec

func (cu *CardUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CardUpdate) ExecX

func (cu *CardUpdate) ExecX(ctx context.Context)

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

func (*CardUpdate) Mutation

func (cu *CardUpdate) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardUpdate) Save

func (cu *CardUpdate) Save(ctx context.Context) (int, error)

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

func (*CardUpdate) SaveX

func (cu *CardUpdate) SaveX(ctx context.Context) int

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

func (*CardUpdate) SetName

func (cu *CardUpdate) SetName(s string) *CardUpdate

SetName sets the "name" field.

func (*CardUpdate) SetType

func (cu *CardUpdate) SetType(s string) *CardUpdate

SetType sets the "type" field.

func (*CardUpdate) SetUpdatedAt

func (cu *CardUpdate) SetUpdatedAt(t time.Time) *CardUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CardUpdate) SetValue

func (cu *CardUpdate) SetValue(f float64) *CardUpdate

SetValue sets the "value" field.

func (*CardUpdate) Where

func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate

Where appends a list predicates to the CardUpdate builder.

type CardUpdateOne

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

CardUpdateOne is the builder for updating a single Card entity.

func (*CardUpdateOne) AddValue

func (cuo *CardUpdateOne) AddValue(f float64) *CardUpdateOne

AddValue adds f to the "value" field.

func (*CardUpdateOne) Exec

func (cuo *CardUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CardUpdateOne) ExecX

func (cuo *CardUpdateOne) ExecX(ctx context.Context)

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

func (*CardUpdateOne) Mutation

func (cuo *CardUpdateOne) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardUpdateOne) Save

func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error)

Save executes the query and returns the updated Card entity.

func (*CardUpdateOne) SaveX

func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card

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

func (*CardUpdateOne) Select

func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne

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

func (*CardUpdateOne) SetName

func (cuo *CardUpdateOne) SetName(s string) *CardUpdateOne

SetName sets the "name" field.

func (*CardUpdateOne) SetType

func (cuo *CardUpdateOne) SetType(s string) *CardUpdateOne

SetType sets the "type" field.

func (*CardUpdateOne) SetUpdatedAt

func (cuo *CardUpdateOne) SetUpdatedAt(t time.Time) *CardUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CardUpdateOne) SetValue

func (cuo *CardUpdateOne) SetValue(f float64) *CardUpdateOne

SetValue sets the "value" field.

func (*CardUpdateOne) Where

func (cuo *CardUpdateOne) Where(ps ...predicate.Card) *CardUpdateOne

Where appends a list predicates to the CardUpdate builder.

type Cards

type Cards []*Card

Cards is a parsable slice of Card.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Campaign is the client for interacting with the Campaign builders.
	Campaign *CampaignClient
	// Card is the client for interacting with the Card builders.
	Card *CardClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserBalance is the client for interacting with the UserBalance builders.
	UserBalance *UserBalanceClient
	// UserVoucher is the client for interacting with the UserVoucher builders.
	UserVoucher *UserVoucherClient
	// Voucher is the client for interacting with the Voucher builders.
	Voucher *VoucherClient
	// VoucherCampaign is the client for interacting with the VoucherCampaign builders.
	VoucherCampaign *VoucherCampaignClient
	// 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().
	Campaign.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit 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 InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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 QueryContext

type QueryContext = ent.QueryContext

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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Campaign is the client for interacting with the Campaign builders.
	Campaign *CampaignClient
	// Card is the client for interacting with the Card builders.
	Card *CardClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserBalance is the client for interacting with the UserBalance builders.
	UserBalance *UserBalanceClient
	// UserVoucher is the client for interacting with the UserVoucher builders.
	UserVoucher *UserVoucherClient
	// Voucher is the client for interacting with the Voucher builders.
	Voucher *VoucherClient
	// VoucherCampaign is the client for interacting with the VoucherCampaign builders.
	VoucherCampaign *VoucherCampaignClient
	// 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 User

type User struct {

	// ID of the ent.
	ID int `json:"id,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"`
	// UserID holds the value of the "user_id" field.
	UserID *string `json:"user_id,omitempty"`
	// Account holds the value of the "account" field.
	Account string `json:"account,omitempty"`
	// FullName holds the value of the "full_name" field.
	FullName string `json:"full_name,omitempty"`
	// PhoneNumer holds the value of the "phone_numer" field.
	PhoneNumer *string `json:"phone_numer,omitempty"`
	// Email holds the value of the "email" field.
	Email *string `json:"email,omitempty"`
	// UserName holds the value of the "user_name" field.
	UserName *string `json:"user_name,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// Birthday holds the value of the "birthday" field.
	Birthday time.Time `json:"birthday,omitempty"`
	// LatestLogin holds the value of the "latest_login" field.
	LatestLogin time.Time `json:"latest_login,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (u *User) Update() *UserUpdateOne

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

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the User. This includes values selected through modifiers, order, etc.

type UserBalance

type UserBalance struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID string `json:"user_id,omitempty"`
	// Balance holds the value of the "balance" field.
	Balance float64 `json:"balance,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
}

UserBalance is the model entity for the UserBalance schema.

func (*UserBalance) String

func (ub *UserBalance) String() string

String implements the fmt.Stringer.

func (*UserBalance) Unwrap

func (ub *UserBalance) Unwrap() *UserBalance

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

func (ub *UserBalance) Update() *UserBalanceUpdateOne

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

func (*UserBalance) Value

func (ub *UserBalance) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserBalance. This includes values selected through modifiers, order, etc.

type UserBalanceClient

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

UserBalanceClient is a client for the UserBalance schema.

func NewUserBalanceClient

func NewUserBalanceClient(c config) *UserBalanceClient

NewUserBalanceClient returns a client for the UserBalance from the given config.

func (*UserBalanceClient) Create

func (c *UserBalanceClient) Create() *UserBalanceCreate

Create returns a builder for creating a UserBalance entity.

func (*UserBalanceClient) CreateBulk

func (c *UserBalanceClient) CreateBulk(builders ...*UserBalanceCreate) *UserBalanceCreateBulk

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

func (*UserBalanceClient) Delete

func (c *UserBalanceClient) Delete() *UserBalanceDelete

Delete returns a delete builder for UserBalance.

func (*UserBalanceClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserBalanceClient) DeleteOneID

func (c *UserBalanceClient) DeleteOneID(id int) *UserBalanceDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserBalanceClient) Get

func (c *UserBalanceClient) Get(ctx context.Context, id int) (*UserBalance, error)

Get returns a UserBalance entity by its id.

func (*UserBalanceClient) GetX

func (c *UserBalanceClient) GetX(ctx context.Context, id int) *UserBalance

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

func (*UserBalanceClient) Hooks

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

Hooks returns the client hooks.

func (*UserBalanceClient) Intercept

func (c *UserBalanceClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `userbalance.Intercept(f(g(h())))`.

func (*UserBalanceClient) Interceptors

func (c *UserBalanceClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserBalanceClient) MapCreateBulk

func (c *UserBalanceClient) MapCreateBulk(slice any, setFunc func(*UserBalanceCreate, int)) *UserBalanceCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserBalanceClient) Query

func (c *UserBalanceClient) Query() *UserBalanceQuery

Query returns a query builder for UserBalance.

func (*UserBalanceClient) Update

func (c *UserBalanceClient) Update() *UserBalanceUpdate

Update returns an update builder for UserBalance.

func (*UserBalanceClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserBalanceClient) UpdateOneID

func (c *UserBalanceClient) UpdateOneID(id int) *UserBalanceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserBalanceClient) Use

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

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

type UserBalanceCreate

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

UserBalanceCreate is the builder for creating a UserBalance entity.

func (*UserBalanceCreate) Exec

func (ubc *UserBalanceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserBalanceCreate) ExecX

func (ubc *UserBalanceCreate) ExecX(ctx context.Context)

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

func (*UserBalanceCreate) Mutation

func (ubc *UserBalanceCreate) Mutation() *UserBalanceMutation

Mutation returns the UserBalanceMutation object of the builder.

func (*UserBalanceCreate) Save

func (ubc *UserBalanceCreate) Save(ctx context.Context) (*UserBalance, error)

Save creates the UserBalance in the database.

func (*UserBalanceCreate) SaveX

func (ubc *UserBalanceCreate) SaveX(ctx context.Context) *UserBalance

SaveX calls Save and panics if Save returns an error.

func (*UserBalanceCreate) SetBalance

func (ubc *UserBalanceCreate) SetBalance(f float64) *UserBalanceCreate

SetBalance sets the "balance" field.

func (*UserBalanceCreate) SetCreatedAt

func (ubc *UserBalanceCreate) SetCreatedAt(t time.Time) *UserBalanceCreate

SetCreatedAt sets the "created_at" field.

func (*UserBalanceCreate) SetNillableCreatedAt

func (ubc *UserBalanceCreate) SetNillableCreatedAt(t *time.Time) *UserBalanceCreate

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

func (*UserBalanceCreate) SetNillableUpdatedAt

func (ubc *UserBalanceCreate) SetNillableUpdatedAt(t *time.Time) *UserBalanceCreate

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

func (*UserBalanceCreate) SetUpdatedAt

func (ubc *UserBalanceCreate) SetUpdatedAt(t time.Time) *UserBalanceCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserBalanceCreate) SetUserID

func (ubc *UserBalanceCreate) SetUserID(s string) *UserBalanceCreate

SetUserID sets the "user_id" field.

type UserBalanceCreateBulk

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

UserBalanceCreateBulk is the builder for creating many UserBalance entities in bulk.

func (*UserBalanceCreateBulk) Exec

func (ubcb *UserBalanceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserBalanceCreateBulk) ExecX

func (ubcb *UserBalanceCreateBulk) ExecX(ctx context.Context)

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

func (*UserBalanceCreateBulk) Save

func (ubcb *UserBalanceCreateBulk) Save(ctx context.Context) ([]*UserBalance, error)

Save creates the UserBalance entities in the database.

func (*UserBalanceCreateBulk) SaveX

func (ubcb *UserBalanceCreateBulk) SaveX(ctx context.Context) []*UserBalance

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

type UserBalanceDelete

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

UserBalanceDelete is the builder for deleting a UserBalance entity.

func (*UserBalanceDelete) Exec

func (ubd *UserBalanceDelete) Exec(ctx context.Context) (int, error)

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

func (*UserBalanceDelete) ExecX

func (ubd *UserBalanceDelete) ExecX(ctx context.Context) int

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

func (*UserBalanceDelete) Where

Where appends a list predicates to the UserBalanceDelete builder.

type UserBalanceDeleteOne

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

UserBalanceDeleteOne is the builder for deleting a single UserBalance entity.

func (*UserBalanceDeleteOne) Exec

func (ubdo *UserBalanceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserBalanceDeleteOne) ExecX

func (ubdo *UserBalanceDeleteOne) ExecX(ctx context.Context)

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

func (*UserBalanceDeleteOne) Where

Where appends a list predicates to the UserBalanceDelete builder.

type UserBalanceGroupBy

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

UserBalanceGroupBy is the group-by builder for UserBalance entities.

func (*UserBalanceGroupBy) Aggregate

func (ubgb *UserBalanceGroupBy) Aggregate(fns ...AggregateFunc) *UserBalanceGroupBy

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

func (*UserBalanceGroupBy) Bool

func (s *UserBalanceGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserBalanceGroupBy) BoolX

func (s *UserBalanceGroupBy) BoolX(ctx context.Context) bool

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

func (*UserBalanceGroupBy) Bools

func (s *UserBalanceGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*UserBalanceGroupBy) BoolsX

func (s *UserBalanceGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserBalanceGroupBy) Float64

func (s *UserBalanceGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserBalanceGroupBy) Float64X

func (s *UserBalanceGroupBy) Float64X(ctx context.Context) float64

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

func (*UserBalanceGroupBy) Float64s

func (s *UserBalanceGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserBalanceGroupBy) Float64sX

func (s *UserBalanceGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserBalanceGroupBy) Int

func (s *UserBalanceGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*UserBalanceGroupBy) IntX

func (s *UserBalanceGroupBy) IntX(ctx context.Context) int

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

func (*UserBalanceGroupBy) Ints

func (s *UserBalanceGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*UserBalanceGroupBy) IntsX

func (s *UserBalanceGroupBy) IntsX(ctx context.Context) []int

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

func (*UserBalanceGroupBy) Scan

func (ubgb *UserBalanceGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserBalanceGroupBy) ScanX

func (s *UserBalanceGroupBy) ScanX(ctx context.Context, v any)

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

func (*UserBalanceGroupBy) String

func (s *UserBalanceGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*UserBalanceGroupBy) StringX

func (s *UserBalanceGroupBy) StringX(ctx context.Context) string

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

func (*UserBalanceGroupBy) Strings

func (s *UserBalanceGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*UserBalanceGroupBy) StringsX

func (s *UserBalanceGroupBy) StringsX(ctx context.Context) []string

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

type UserBalanceMutation

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

UserBalanceMutation represents an operation that mutates the UserBalance nodes in the graph.

func (*UserBalanceMutation) AddBalance

func (m *UserBalanceMutation) AddBalance(f float64)

AddBalance adds f to the "balance" field.

func (*UserBalanceMutation) AddField

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) AddedBalance

func (m *UserBalanceMutation) AddedBalance() (r float64, exists bool)

AddedBalance returns the value that was added to the "balance" field in this mutation.

func (*UserBalanceMutation) AddedEdges

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

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

func (*UserBalanceMutation) AddedField

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

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

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

func (*UserBalanceMutation) AddedIDs

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

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

func (*UserBalanceMutation) Balance

func (m *UserBalanceMutation) Balance() (r float64, exists bool)

Balance returns the value of the "balance" field in the mutation.

func (*UserBalanceMutation) ClearEdge

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

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

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

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

func (*UserBalanceMutation) ClearedFields

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

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

func (UserBalanceMutation) Client

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

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

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

func (*UserBalanceMutation) EdgeCleared

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

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

func (*UserBalanceMutation) Field

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

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

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

func (*UserBalanceMutation) Fields

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) ID

func (m *UserBalanceMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserBalanceMutation) IDs

func (m *UserBalanceMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserBalanceMutation) OldBalance

func (m *UserBalanceMutation) OldBalance(ctx context.Context) (v float64, err error)

OldBalance returns the old "balance" field's value of the UserBalance entity. If the UserBalance 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 (*UserBalanceMutation) OldCreatedAt

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

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

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) OldUpdatedAt

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

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

func (m *UserBalanceMutation) OldUserID(ctx context.Context) (v string, err error)

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

func (m *UserBalanceMutation) Op() Op

Op returns the operation name.

func (*UserBalanceMutation) RemovedEdges

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

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

func (*UserBalanceMutation) RemovedIDs

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) ResetBalance

func (m *UserBalanceMutation) ResetBalance()

ResetBalance resets all changes to the "balance" field.

func (*UserBalanceMutation) ResetCreatedAt

func (m *UserBalanceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserBalanceMutation) ResetEdge

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

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) ResetUpdatedAt

func (m *UserBalanceMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserBalanceMutation) ResetUserID

func (m *UserBalanceMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserBalanceMutation) SetBalance

func (m *UserBalanceMutation) SetBalance(f float64)

SetBalance sets the "balance" field.

func (*UserBalanceMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserBalanceMutation) SetField

func (m *UserBalanceMutation) 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 (*UserBalanceMutation) SetOp

func (m *UserBalanceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserBalanceMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserBalanceMutation) SetUserID

func (m *UserBalanceMutation) SetUserID(s string)

SetUserID sets the "user_id" field.

func (UserBalanceMutation) Tx

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

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

func (*UserBalanceMutation) Type

func (m *UserBalanceMutation) Type() string

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

func (*UserBalanceMutation) UpdatedAt

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

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

func (*UserBalanceMutation) UserID

func (m *UserBalanceMutation) UserID() (r string, exists bool)

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

func (*UserBalanceMutation) Where

func (m *UserBalanceMutation) Where(ps ...predicate.UserBalance)

Where appends a list predicates to the UserBalanceMutation builder.

func (*UserBalanceMutation) WhereP

func (m *UserBalanceMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserBalanceMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserBalanceQuery

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

UserBalanceQuery is the builder for querying UserBalance entities.

func (*UserBalanceQuery) Aggregate

func (ubq *UserBalanceQuery) Aggregate(fns ...AggregateFunc) *UserBalanceSelect

Aggregate returns a UserBalanceSelect configured with the given aggregations.

func (*UserBalanceQuery) All

func (ubq *UserBalanceQuery) All(ctx context.Context) ([]*UserBalance, error)

All executes the query and returns a list of UserBalances.

func (*UserBalanceQuery) AllX

func (ubq *UserBalanceQuery) AllX(ctx context.Context) []*UserBalance

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

func (*UserBalanceQuery) Clone

func (ubq *UserBalanceQuery) Clone() *UserBalanceQuery

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

func (*UserBalanceQuery) Count

func (ubq *UserBalanceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserBalanceQuery) CountX

func (ubq *UserBalanceQuery) CountX(ctx context.Context) int

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

func (*UserBalanceQuery) Exist

func (ubq *UserBalanceQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserBalanceQuery) ExistX

func (ubq *UserBalanceQuery) ExistX(ctx context.Context) bool

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

func (*UserBalanceQuery) First

func (ubq *UserBalanceQuery) First(ctx context.Context) (*UserBalance, error)

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

func (*UserBalanceQuery) FirstID

func (ubq *UserBalanceQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserBalanceQuery) FirstIDX

func (ubq *UserBalanceQuery) FirstIDX(ctx context.Context) int

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

func (*UserBalanceQuery) FirstX

func (ubq *UserBalanceQuery) FirstX(ctx context.Context) *UserBalance

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

func (*UserBalanceQuery) GroupBy

func (ubq *UserBalanceQuery) GroupBy(field string, fields ...string) *UserBalanceGroupBy

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

client.UserBalance.Query().
	GroupBy(userbalance.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserBalanceQuery) IDs

func (ubq *UserBalanceQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*UserBalanceQuery) IDsX

func (ubq *UserBalanceQuery) IDsX(ctx context.Context) []int

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

func (*UserBalanceQuery) Limit

func (ubq *UserBalanceQuery) Limit(limit int) *UserBalanceQuery

Limit the number of records to be returned by this query.

func (*UserBalanceQuery) Offset

func (ubq *UserBalanceQuery) Offset(offset int) *UserBalanceQuery

Offset to start from.

func (*UserBalanceQuery) Only

func (ubq *UserBalanceQuery) Only(ctx context.Context) (*UserBalance, error)

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

func (*UserBalanceQuery) OnlyID

func (ubq *UserBalanceQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserBalanceQuery) OnlyIDX

func (ubq *UserBalanceQuery) OnlyIDX(ctx context.Context) int

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

func (*UserBalanceQuery) OnlyX

func (ubq *UserBalanceQuery) OnlyX(ctx context.Context) *UserBalance

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

func (*UserBalanceQuery) Order

Order specifies how the records should be ordered.

func (*UserBalanceQuery) Select

func (ubq *UserBalanceQuery) Select(fields ...string) *UserBalanceSelect

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

client.UserBalance.Query().
	Select(userbalance.FieldUserID).
	Scan(ctx, &v)

func (*UserBalanceQuery) Unique

func (ubq *UserBalanceQuery) Unique(unique bool) *UserBalanceQuery

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 (*UserBalanceQuery) Where

Where adds a new predicate for the UserBalanceQuery builder.

type UserBalanceSelect

type UserBalanceSelect struct {
	*UserBalanceQuery
	// contains filtered or unexported fields
}

UserBalanceSelect is the builder for selecting fields of UserBalance entities.

func (*UserBalanceSelect) Aggregate

func (ubs *UserBalanceSelect) Aggregate(fns ...AggregateFunc) *UserBalanceSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserBalanceSelect) Bool

func (s *UserBalanceSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserBalanceSelect) BoolX

func (s *UserBalanceSelect) BoolX(ctx context.Context) bool

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

func (*UserBalanceSelect) Bools

func (s *UserBalanceSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserBalanceSelect) BoolsX

func (s *UserBalanceSelect) BoolsX(ctx context.Context) []bool

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

func (*UserBalanceSelect) Float64

func (s *UserBalanceSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserBalanceSelect) Float64X

func (s *UserBalanceSelect) Float64X(ctx context.Context) float64

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

func (*UserBalanceSelect) Float64s

func (s *UserBalanceSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserBalanceSelect) Float64sX

func (s *UserBalanceSelect) Float64sX(ctx context.Context) []float64

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

func (*UserBalanceSelect) Int

func (s *UserBalanceSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserBalanceSelect) IntX

func (s *UserBalanceSelect) IntX(ctx context.Context) int

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

func (*UserBalanceSelect) Ints

func (s *UserBalanceSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserBalanceSelect) IntsX

func (s *UserBalanceSelect) IntsX(ctx context.Context) []int

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

func (*UserBalanceSelect) Scan

func (ubs *UserBalanceSelect) Scan(ctx context.Context, v any) error

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

func (*UserBalanceSelect) ScanX

func (s *UserBalanceSelect) ScanX(ctx context.Context, v any)

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

func (*UserBalanceSelect) String

func (s *UserBalanceSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserBalanceSelect) StringX

func (s *UserBalanceSelect) StringX(ctx context.Context) string

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

func (*UserBalanceSelect) Strings

func (s *UserBalanceSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserBalanceSelect) StringsX

func (s *UserBalanceSelect) StringsX(ctx context.Context) []string

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

type UserBalanceUpdate

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

UserBalanceUpdate is the builder for updating UserBalance entities.

func (*UserBalanceUpdate) AddBalance

func (ubu *UserBalanceUpdate) AddBalance(f float64) *UserBalanceUpdate

AddBalance adds f to the "balance" field.

func (*UserBalanceUpdate) Exec

func (ubu *UserBalanceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserBalanceUpdate) ExecX

func (ubu *UserBalanceUpdate) ExecX(ctx context.Context)

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

func (*UserBalanceUpdate) Mutation

func (ubu *UserBalanceUpdate) Mutation() *UserBalanceMutation

Mutation returns the UserBalanceMutation object of the builder.

func (*UserBalanceUpdate) Save

func (ubu *UserBalanceUpdate) Save(ctx context.Context) (int, error)

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

func (*UserBalanceUpdate) SaveX

func (ubu *UserBalanceUpdate) SaveX(ctx context.Context) int

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

func (*UserBalanceUpdate) SetBalance

func (ubu *UserBalanceUpdate) SetBalance(f float64) *UserBalanceUpdate

SetBalance sets the "balance" field.

func (*UserBalanceUpdate) SetUpdatedAt

func (ubu *UserBalanceUpdate) SetUpdatedAt(t time.Time) *UserBalanceUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserBalanceUpdate) SetUserID

func (ubu *UserBalanceUpdate) SetUserID(s string) *UserBalanceUpdate

SetUserID sets the "user_id" field.

func (*UserBalanceUpdate) Where

Where appends a list predicates to the UserBalanceUpdate builder.

type UserBalanceUpdateOne

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

UserBalanceUpdateOne is the builder for updating a single UserBalance entity.

func (*UserBalanceUpdateOne) AddBalance

func (ubuo *UserBalanceUpdateOne) AddBalance(f float64) *UserBalanceUpdateOne

AddBalance adds f to the "balance" field.

func (*UserBalanceUpdateOne) Exec

func (ubuo *UserBalanceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserBalanceUpdateOne) ExecX

func (ubuo *UserBalanceUpdateOne) ExecX(ctx context.Context)

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

func (*UserBalanceUpdateOne) Mutation

func (ubuo *UserBalanceUpdateOne) Mutation() *UserBalanceMutation

Mutation returns the UserBalanceMutation object of the builder.

func (*UserBalanceUpdateOne) Save

Save executes the query and returns the updated UserBalance entity.

func (*UserBalanceUpdateOne) SaveX

func (ubuo *UserBalanceUpdateOne) SaveX(ctx context.Context) *UserBalance

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

func (*UserBalanceUpdateOne) Select

func (ubuo *UserBalanceUpdateOne) Select(field string, fields ...string) *UserBalanceUpdateOne

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

func (*UserBalanceUpdateOne) SetBalance

func (ubuo *UserBalanceUpdateOne) SetBalance(f float64) *UserBalanceUpdateOne

SetBalance sets the "balance" field.

func (*UserBalanceUpdateOne) SetUpdatedAt

func (ubuo *UserBalanceUpdateOne) SetUpdatedAt(t time.Time) *UserBalanceUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserBalanceUpdateOne) SetUserID

func (ubuo *UserBalanceUpdateOne) SetUserID(s string) *UserBalanceUpdateOne

SetUserID sets the "user_id" field.

func (*UserBalanceUpdateOne) Where

Where appends a list predicates to the UserBalanceUpdate builder.

type UserBalances

type UserBalances []*UserBalance

UserBalances is a parsable slice of UserBalance.

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAccount

func (uc *UserCreate) SetAccount(s string) *UserCreate

SetAccount sets the "account" field.

func (*UserCreate) SetBirthday

func (uc *UserCreate) SetBirthday(t time.Time) *UserCreate

SetBirthday sets the "birthday" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetFullName

func (uc *UserCreate) SetFullName(s string) *UserCreate

SetFullName sets the "full_name" field.

func (*UserCreate) SetLatestLogin

func (uc *UserCreate) SetLatestLogin(t time.Time) *UserCreate

SetLatestLogin sets the "latest_login" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetPhoneNumer

func (uc *UserCreate) SetPhoneNumer(s string) *UserCreate

SetPhoneNumer sets the "phone_numer" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUserID

func (uc *UserCreate) SetUserID(s string) *UserCreate

SetUserID sets the "user_id" field.

func (*UserCreate) SetUserName

func (uc *UserCreate) SetUserName(s string) *UserCreate

SetUserName sets the "user_name" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

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

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

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

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

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

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

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

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

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

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) Account

func (m *UserMutation) Account() (r string, exists bool)

Account returns the value of the "account" field in the mutation.

func (*UserMutation) AddField

func (m *UserMutation) 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 (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) Birthday

func (m *UserMutation) Birthday() (r time.Time, exists bool)

Birthday returns the value of the "birthday" field in the mutation.

func (*UserMutation) ClearEdge

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

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

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

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

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

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

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

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

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

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

func (*UserMutation) Fields

func (m *UserMutation) 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 (*UserMutation) FullName

func (m *UserMutation) FullName() (r string, exists bool)

FullName returns the value of the "full_name" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) LatestLogin

func (m *UserMutation) LatestLogin() (r time.Time, exists bool)

LatestLogin returns the value of the "latest_login" field in the mutation.

func (*UserMutation) OldAccount

func (m *UserMutation) OldAccount(ctx context.Context) (v string, err error)

OldAccount returns the old "account" field's value of the User entity. If the User 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 (*UserMutation) OldBirthday

func (m *UserMutation) OldBirthday(ctx context.Context) (v time.Time, err error)

OldBirthday returns the old "birthday" field's value of the User entity. If the User 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 (*UserMutation) OldCreatedAt

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

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

func (m *UserMutation) OldEmail(ctx context.Context) (v *string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User 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 (*UserMutation) OldField

func (m *UserMutation) 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 (*UserMutation) OldFullName

func (m *UserMutation) OldFullName(ctx context.Context) (v string, err error)

OldFullName returns the old "full_name" field's value of the User entity. If the User 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 (*UserMutation) OldLatestLogin

func (m *UserMutation) OldLatestLogin(ctx context.Context) (v time.Time, err error)

OldLatestLogin returns the old "latest_login" field's value of the User entity. If the User 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 (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User 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 (*UserMutation) OldPhoneNumer

func (m *UserMutation) OldPhoneNumer(ctx context.Context) (v *string, err error)

OldPhoneNumer returns the old "phone_numer" field's value of the User entity. If the User 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 (*UserMutation) OldUpdatedAt

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

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

func (m *UserMutation) OldUserID(ctx context.Context) (v *string, err error)

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

func (m *UserMutation) OldUserName(ctx context.Context) (v *string, err error)

OldUserName returns the old "user_name" field's value of the User entity. If the User 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) PhoneNumer

func (m *UserMutation) PhoneNumer() (r string, exists bool)

PhoneNumer returns the value of the "phone_numer" field in the mutation.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

func (m *UserMutation) 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 (*UserMutation) ResetAccount

func (m *UserMutation) ResetAccount()

ResetAccount resets all changes to the "account" field.

func (*UserMutation) ResetBirthday

func (m *UserMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) 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 (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) 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 (*UserMutation) ResetFullName

func (m *UserMutation) ResetFullName()

ResetFullName resets all changes to the "full_name" field.

func (*UserMutation) ResetLatestLogin

func (m *UserMutation) ResetLatestLogin()

ResetLatestLogin resets all changes to the "latest_login" field.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPhoneNumer

func (m *UserMutation) ResetPhoneNumer()

ResetPhoneNumer resets all changes to the "phone_numer" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUserID

func (m *UserMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserMutation) ResetUserName

func (m *UserMutation) ResetUserName()

ResetUserName resets all changes to the "user_name" field.

func (*UserMutation) SetAccount

func (m *UserMutation) SetAccount(s string)

SetAccount sets the "account" field.

func (*UserMutation) SetBirthday

func (m *UserMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) 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 (*UserMutation) SetFullName

func (m *UserMutation) SetFullName(s string)

SetFullName sets the "full_name" field.

func (*UserMutation) SetLatestLogin

func (m *UserMutation) SetLatestLogin(t time.Time)

SetLatestLogin sets the "latest_login" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetPhoneNumer

func (m *UserMutation) SetPhoneNumer(s string)

SetPhoneNumer sets the "phone_numer" field.

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUserID

func (m *UserMutation) SetUserID(s string)

SetUserID sets the "user_id" field.

func (*UserMutation) SetUserName

func (m *UserMutation) SetUserName(s string)

SetUserName sets the "user_name" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdatedAt

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

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

func (*UserMutation) UserID

func (m *UserMutation) UserID() (r string, exists bool)

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

func (*UserMutation) UserName

func (m *UserMutation) UserName() (r string, exists bool)

UserName returns the value of the "user_name" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

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 (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

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

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetAccount

func (uu *UserUpdate) SetAccount(s string) *UserUpdate

SetAccount sets the "account" field.

func (*UserUpdate) SetBirthday

func (uu *UserUpdate) SetBirthday(t time.Time) *UserUpdate

SetBirthday sets the "birthday" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetFullName

func (uu *UserUpdate) SetFullName(s string) *UserUpdate

SetFullName sets the "full_name" field.

func (*UserUpdate) SetLatestLogin

func (uu *UserUpdate) SetLatestLogin(t time.Time) *UserUpdate

SetLatestLogin sets the "latest_login" field.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetPhoneNumer

func (uu *UserUpdate) SetPhoneNumer(s string) *UserUpdate

SetPhoneNumer sets the "phone_numer" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUserID

func (uu *UserUpdate) SetUserID(s string) *UserUpdate

SetUserID sets the "user_id" field.

func (*UserUpdate) SetUserName

func (uu *UserUpdate) SetUserName(s string) *UserUpdate

SetUserName sets the "user_name" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetAccount

func (uuo *UserUpdateOne) SetAccount(s string) *UserUpdateOne

SetAccount sets the "account" field.

func (*UserUpdateOne) SetBirthday

func (uuo *UserUpdateOne) SetBirthday(t time.Time) *UserUpdateOne

SetBirthday sets the "birthday" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetFullName

func (uuo *UserUpdateOne) SetFullName(s string) *UserUpdateOne

SetFullName sets the "full_name" field.

func (*UserUpdateOne) SetLatestLogin

func (uuo *UserUpdateOne) SetLatestLogin(t time.Time) *UserUpdateOne

SetLatestLogin sets the "latest_login" field.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetPhoneNumer

func (uuo *UserUpdateOne) SetPhoneNumer(s string) *UserUpdateOne

SetPhoneNumer sets the "phone_numer" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUserID

func (uuo *UserUpdateOne) SetUserID(s string) *UserUpdateOne

SetUserID sets the "user_id" field.

func (*UserUpdateOne) SetUserName

func (uuo *UserUpdateOne) SetUserName(s string) *UserUpdateOne

SetUserName sets the "user_name" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserVoucher

type UserVoucher struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// VoucherCampaignID holds the value of the "voucher_campaign_id" field.
	VoucherCampaignID int64 `json:"voucher_campaign_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID string `json:"user_id,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
}

UserVoucher is the model entity for the UserVoucher schema.

func (*UserVoucher) String

func (uv *UserVoucher) String() string

String implements the fmt.Stringer.

func (*UserVoucher) Unwrap

func (uv *UserVoucher) Unwrap() *UserVoucher

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

func (uv *UserVoucher) Update() *UserVoucherUpdateOne

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

func (*UserVoucher) Value

func (uv *UserVoucher) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserVoucher. This includes values selected through modifiers, order, etc.

type UserVoucherClient

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

UserVoucherClient is a client for the UserVoucher schema.

func NewUserVoucherClient

func NewUserVoucherClient(c config) *UserVoucherClient

NewUserVoucherClient returns a client for the UserVoucher from the given config.

func (*UserVoucherClient) Create

func (c *UserVoucherClient) Create() *UserVoucherCreate

Create returns a builder for creating a UserVoucher entity.

func (*UserVoucherClient) CreateBulk

func (c *UserVoucherClient) CreateBulk(builders ...*UserVoucherCreate) *UserVoucherCreateBulk

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

func (*UserVoucherClient) Delete

func (c *UserVoucherClient) Delete() *UserVoucherDelete

Delete returns a delete builder for UserVoucher.

func (*UserVoucherClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserVoucherClient) DeleteOneID

func (c *UserVoucherClient) DeleteOneID(id int) *UserVoucherDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserVoucherClient) Get

func (c *UserVoucherClient) Get(ctx context.Context, id int) (*UserVoucher, error)

Get returns a UserVoucher entity by its id.

func (*UserVoucherClient) GetX

func (c *UserVoucherClient) GetX(ctx context.Context, id int) *UserVoucher

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

func (*UserVoucherClient) Hooks

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

Hooks returns the client hooks.

func (*UserVoucherClient) Intercept

func (c *UserVoucherClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `uservoucher.Intercept(f(g(h())))`.

func (*UserVoucherClient) Interceptors

func (c *UserVoucherClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserVoucherClient) MapCreateBulk

func (c *UserVoucherClient) MapCreateBulk(slice any, setFunc func(*UserVoucherCreate, int)) *UserVoucherCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserVoucherClient) Query

func (c *UserVoucherClient) Query() *UserVoucherQuery

Query returns a query builder for UserVoucher.

func (*UserVoucherClient) Update

func (c *UserVoucherClient) Update() *UserVoucherUpdate

Update returns an update builder for UserVoucher.

func (*UserVoucherClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserVoucherClient) UpdateOneID

func (c *UserVoucherClient) UpdateOneID(id int) *UserVoucherUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserVoucherClient) Use

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

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

type UserVoucherCreate

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

UserVoucherCreate is the builder for creating a UserVoucher entity.

func (*UserVoucherCreate) Exec

func (uvc *UserVoucherCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserVoucherCreate) ExecX

func (uvc *UserVoucherCreate) ExecX(ctx context.Context)

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

func (*UserVoucherCreate) Mutation

func (uvc *UserVoucherCreate) Mutation() *UserVoucherMutation

Mutation returns the UserVoucherMutation object of the builder.

func (*UserVoucherCreate) Save

func (uvc *UserVoucherCreate) Save(ctx context.Context) (*UserVoucher, error)

Save creates the UserVoucher in the database.

func (*UserVoucherCreate) SaveX

func (uvc *UserVoucherCreate) SaveX(ctx context.Context) *UserVoucher

SaveX calls Save and panics if Save returns an error.

func (*UserVoucherCreate) SetCreatedAt

func (uvc *UserVoucherCreate) SetCreatedAt(t time.Time) *UserVoucherCreate

SetCreatedAt sets the "created_at" field.

func (*UserVoucherCreate) SetNillableCreatedAt

func (uvc *UserVoucherCreate) SetNillableCreatedAt(t *time.Time) *UserVoucherCreate

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

func (*UserVoucherCreate) SetNillableUpdatedAt

func (uvc *UserVoucherCreate) SetNillableUpdatedAt(t *time.Time) *UserVoucherCreate

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

func (*UserVoucherCreate) SetUpdatedAt

func (uvc *UserVoucherCreate) SetUpdatedAt(t time.Time) *UserVoucherCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserVoucherCreate) SetUserID

func (uvc *UserVoucherCreate) SetUserID(s string) *UserVoucherCreate

SetUserID sets the "user_id" field.

func (*UserVoucherCreate) SetVoucherCampaignID

func (uvc *UserVoucherCreate) SetVoucherCampaignID(i int64) *UserVoucherCreate

SetVoucherCampaignID sets the "voucher_campaign_id" field.

type UserVoucherCreateBulk

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

UserVoucherCreateBulk is the builder for creating many UserVoucher entities in bulk.

func (*UserVoucherCreateBulk) Exec

func (uvcb *UserVoucherCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserVoucherCreateBulk) ExecX

func (uvcb *UserVoucherCreateBulk) ExecX(ctx context.Context)

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

func (*UserVoucherCreateBulk) Save

func (uvcb *UserVoucherCreateBulk) Save(ctx context.Context) ([]*UserVoucher, error)

Save creates the UserVoucher entities in the database.

func (*UserVoucherCreateBulk) SaveX

func (uvcb *UserVoucherCreateBulk) SaveX(ctx context.Context) []*UserVoucher

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

type UserVoucherDelete

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

UserVoucherDelete is the builder for deleting a UserVoucher entity.

func (*UserVoucherDelete) Exec

func (uvd *UserVoucherDelete) Exec(ctx context.Context) (int, error)

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

func (*UserVoucherDelete) ExecX

func (uvd *UserVoucherDelete) ExecX(ctx context.Context) int

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

func (*UserVoucherDelete) Where

Where appends a list predicates to the UserVoucherDelete builder.

type UserVoucherDeleteOne

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

UserVoucherDeleteOne is the builder for deleting a single UserVoucher entity.

func (*UserVoucherDeleteOne) Exec

func (uvdo *UserVoucherDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserVoucherDeleteOne) ExecX

func (uvdo *UserVoucherDeleteOne) ExecX(ctx context.Context)

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

func (*UserVoucherDeleteOne) Where

Where appends a list predicates to the UserVoucherDelete builder.

type UserVoucherGroupBy

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

UserVoucherGroupBy is the group-by builder for UserVoucher entities.

func (*UserVoucherGroupBy) Aggregate

func (uvgb *UserVoucherGroupBy) Aggregate(fns ...AggregateFunc) *UserVoucherGroupBy

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

func (*UserVoucherGroupBy) Bool

func (s *UserVoucherGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserVoucherGroupBy) BoolX

func (s *UserVoucherGroupBy) BoolX(ctx context.Context) bool

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

func (*UserVoucherGroupBy) Bools

func (s *UserVoucherGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*UserVoucherGroupBy) BoolsX

func (s *UserVoucherGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserVoucherGroupBy) Float64

func (s *UserVoucherGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserVoucherGroupBy) Float64X

func (s *UserVoucherGroupBy) Float64X(ctx context.Context) float64

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

func (*UserVoucherGroupBy) Float64s

func (s *UserVoucherGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserVoucherGroupBy) Float64sX

func (s *UserVoucherGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserVoucherGroupBy) Int

func (s *UserVoucherGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*UserVoucherGroupBy) IntX

func (s *UserVoucherGroupBy) IntX(ctx context.Context) int

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

func (*UserVoucherGroupBy) Ints

func (s *UserVoucherGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*UserVoucherGroupBy) IntsX

func (s *UserVoucherGroupBy) IntsX(ctx context.Context) []int

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

func (*UserVoucherGroupBy) Scan

func (uvgb *UserVoucherGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserVoucherGroupBy) ScanX

func (s *UserVoucherGroupBy) ScanX(ctx context.Context, v any)

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

func (*UserVoucherGroupBy) String

func (s *UserVoucherGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*UserVoucherGroupBy) StringX

func (s *UserVoucherGroupBy) StringX(ctx context.Context) string

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

func (*UserVoucherGroupBy) Strings

func (s *UserVoucherGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*UserVoucherGroupBy) StringsX

func (s *UserVoucherGroupBy) StringsX(ctx context.Context) []string

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

type UserVoucherMutation

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

UserVoucherMutation represents an operation that mutates the UserVoucher nodes in the graph.

func (*UserVoucherMutation) AddField

func (m *UserVoucherMutation) 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 (*UserVoucherMutation) AddVoucherCampaignID

func (m *UserVoucherMutation) AddVoucherCampaignID(i int64)

AddVoucherCampaignID adds i to the "voucher_campaign_id" field.

func (*UserVoucherMutation) AddedEdges

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

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

func (*UserVoucherMutation) AddedField

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

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

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

func (*UserVoucherMutation) AddedIDs

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

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

func (*UserVoucherMutation) AddedVoucherCampaignID

func (m *UserVoucherMutation) AddedVoucherCampaignID() (r int64, exists bool)

AddedVoucherCampaignID returns the value that was added to the "voucher_campaign_id" field in this mutation.

func (*UserVoucherMutation) ClearEdge

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

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

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

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

func (*UserVoucherMutation) ClearedFields

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

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

func (UserVoucherMutation) Client

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

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

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

func (*UserVoucherMutation) EdgeCleared

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

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

func (*UserVoucherMutation) Field

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

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

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

func (*UserVoucherMutation) Fields

func (m *UserVoucherMutation) 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 (*UserVoucherMutation) ID

func (m *UserVoucherMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserVoucherMutation) IDs

func (m *UserVoucherMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserVoucherMutation) OldCreatedAt

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

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

func (m *UserVoucherMutation) 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 (*UserVoucherMutation) OldUpdatedAt

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

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

func (m *UserVoucherMutation) OldUserID(ctx context.Context) (v string, err error)

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

func (m *UserVoucherMutation) OldVoucherCampaignID(ctx context.Context) (v int64, err error)

OldVoucherCampaignID returns the old "voucher_campaign_id" field's value of the UserVoucher entity. If the UserVoucher 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 (*UserVoucherMutation) Op

func (m *UserVoucherMutation) Op() Op

Op returns the operation name.

func (*UserVoucherMutation) RemovedEdges

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

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

func (*UserVoucherMutation) RemovedIDs

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

func (m *UserVoucherMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserVoucherMutation) ResetEdge

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

func (m *UserVoucherMutation) 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 (*UserVoucherMutation) ResetUpdatedAt

func (m *UserVoucherMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserVoucherMutation) ResetUserID

func (m *UserVoucherMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserVoucherMutation) ResetVoucherCampaignID

func (m *UserVoucherMutation) ResetVoucherCampaignID()

ResetVoucherCampaignID resets all changes to the "voucher_campaign_id" field.

func (*UserVoucherMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserVoucherMutation) SetField

func (m *UserVoucherMutation) 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 (*UserVoucherMutation) SetOp

func (m *UserVoucherMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserVoucherMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserVoucherMutation) SetUserID

func (m *UserVoucherMutation) SetUserID(s string)

SetUserID sets the "user_id" field.

func (*UserVoucherMutation) SetVoucherCampaignID

func (m *UserVoucherMutation) SetVoucherCampaignID(i int64)

SetVoucherCampaignID sets the "voucher_campaign_id" field.

func (UserVoucherMutation) Tx

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

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

func (*UserVoucherMutation) Type

func (m *UserVoucherMutation) Type() string

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

func (*UserVoucherMutation) UpdatedAt

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

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

func (*UserVoucherMutation) UserID

func (m *UserVoucherMutation) UserID() (r string, exists bool)

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

func (*UserVoucherMutation) VoucherCampaignID

func (m *UserVoucherMutation) VoucherCampaignID() (r int64, exists bool)

VoucherCampaignID returns the value of the "voucher_campaign_id" field in the mutation.

func (*UserVoucherMutation) Where

func (m *UserVoucherMutation) Where(ps ...predicate.UserVoucher)

Where appends a list predicates to the UserVoucherMutation builder.

func (*UserVoucherMutation) WhereP

func (m *UserVoucherMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserVoucherMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserVoucherQuery

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

UserVoucherQuery is the builder for querying UserVoucher entities.

func (*UserVoucherQuery) Aggregate

func (uvq *UserVoucherQuery) Aggregate(fns ...AggregateFunc) *UserVoucherSelect

Aggregate returns a UserVoucherSelect configured with the given aggregations.

func (*UserVoucherQuery) All

func (uvq *UserVoucherQuery) All(ctx context.Context) ([]*UserVoucher, error)

All executes the query and returns a list of UserVouchers.

func (*UserVoucherQuery) AllX

func (uvq *UserVoucherQuery) AllX(ctx context.Context) []*UserVoucher

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

func (*UserVoucherQuery) Clone

func (uvq *UserVoucherQuery) Clone() *UserVoucherQuery

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

func (*UserVoucherQuery) Count

func (uvq *UserVoucherQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserVoucherQuery) CountX

func (uvq *UserVoucherQuery) CountX(ctx context.Context) int

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

func (*UserVoucherQuery) Exist

func (uvq *UserVoucherQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserVoucherQuery) ExistX

func (uvq *UserVoucherQuery) ExistX(ctx context.Context) bool

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

func (*UserVoucherQuery) First

func (uvq *UserVoucherQuery) First(ctx context.Context) (*UserVoucher, error)

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

func (*UserVoucherQuery) FirstID

func (uvq *UserVoucherQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserVoucherQuery) FirstIDX

func (uvq *UserVoucherQuery) FirstIDX(ctx context.Context) int

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

func (*UserVoucherQuery) FirstX

func (uvq *UserVoucherQuery) FirstX(ctx context.Context) *UserVoucher

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

func (*UserVoucherQuery) GroupBy

func (uvq *UserVoucherQuery) GroupBy(field string, fields ...string) *UserVoucherGroupBy

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

client.UserVoucher.Query().
	GroupBy(uservoucher.FieldVoucherCampaignID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserVoucherQuery) IDs

func (uvq *UserVoucherQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*UserVoucherQuery) IDsX

func (uvq *UserVoucherQuery) IDsX(ctx context.Context) []int

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

func (*UserVoucherQuery) Limit

func (uvq *UserVoucherQuery) Limit(limit int) *UserVoucherQuery

Limit the number of records to be returned by this query.

func (*UserVoucherQuery) Offset

func (uvq *UserVoucherQuery) Offset(offset int) *UserVoucherQuery

Offset to start from.

func (*UserVoucherQuery) Only

func (uvq *UserVoucherQuery) Only(ctx context.Context) (*UserVoucher, error)

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

func (*UserVoucherQuery) OnlyID

func (uvq *UserVoucherQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserVoucherQuery) OnlyIDX

func (uvq *UserVoucherQuery) OnlyIDX(ctx context.Context) int

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

func (*UserVoucherQuery) OnlyX

func (uvq *UserVoucherQuery) OnlyX(ctx context.Context) *UserVoucher

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

func (*UserVoucherQuery) Order

Order specifies how the records should be ordered.

func (*UserVoucherQuery) Select

func (uvq *UserVoucherQuery) Select(fields ...string) *UserVoucherSelect

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

client.UserVoucher.Query().
	Select(uservoucher.FieldVoucherCampaignID).
	Scan(ctx, &v)

func (*UserVoucherQuery) Unique

func (uvq *UserVoucherQuery) Unique(unique bool) *UserVoucherQuery

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 (*UserVoucherQuery) Where

Where adds a new predicate for the UserVoucherQuery builder.

type UserVoucherSelect

type UserVoucherSelect struct {
	*UserVoucherQuery
	// contains filtered or unexported fields
}

UserVoucherSelect is the builder for selecting fields of UserVoucher entities.

func (*UserVoucherSelect) Aggregate

func (uvs *UserVoucherSelect) Aggregate(fns ...AggregateFunc) *UserVoucherSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserVoucherSelect) Bool

func (s *UserVoucherSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserVoucherSelect) BoolX

func (s *UserVoucherSelect) BoolX(ctx context.Context) bool

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

func (*UserVoucherSelect) Bools

func (s *UserVoucherSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserVoucherSelect) BoolsX

func (s *UserVoucherSelect) BoolsX(ctx context.Context) []bool

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

func (*UserVoucherSelect) Float64

func (s *UserVoucherSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserVoucherSelect) Float64X

func (s *UserVoucherSelect) Float64X(ctx context.Context) float64

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

func (*UserVoucherSelect) Float64s

func (s *UserVoucherSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserVoucherSelect) Float64sX

func (s *UserVoucherSelect) Float64sX(ctx context.Context) []float64

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

func (*UserVoucherSelect) Int

func (s *UserVoucherSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserVoucherSelect) IntX

func (s *UserVoucherSelect) IntX(ctx context.Context) int

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

func (*UserVoucherSelect) Ints

func (s *UserVoucherSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserVoucherSelect) IntsX

func (s *UserVoucherSelect) IntsX(ctx context.Context) []int

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

func (*UserVoucherSelect) Scan

func (uvs *UserVoucherSelect) Scan(ctx context.Context, v any) error

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

func (*UserVoucherSelect) ScanX

func (s *UserVoucherSelect) ScanX(ctx context.Context, v any)

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

func (*UserVoucherSelect) String

func (s *UserVoucherSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserVoucherSelect) StringX

func (s *UserVoucherSelect) StringX(ctx context.Context) string

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

func (*UserVoucherSelect) Strings

func (s *UserVoucherSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserVoucherSelect) StringsX

func (s *UserVoucherSelect) StringsX(ctx context.Context) []string

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

type UserVoucherUpdate

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

UserVoucherUpdate is the builder for updating UserVoucher entities.

func (*UserVoucherUpdate) AddVoucherCampaignID

func (uvu *UserVoucherUpdate) AddVoucherCampaignID(i int64) *UserVoucherUpdate

AddVoucherCampaignID adds i to the "voucher_campaign_id" field.

func (*UserVoucherUpdate) Exec

func (uvu *UserVoucherUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserVoucherUpdate) ExecX

func (uvu *UserVoucherUpdate) ExecX(ctx context.Context)

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

func (*UserVoucherUpdate) Mutation

func (uvu *UserVoucherUpdate) Mutation() *UserVoucherMutation

Mutation returns the UserVoucherMutation object of the builder.

func (*UserVoucherUpdate) Save

func (uvu *UserVoucherUpdate) Save(ctx context.Context) (int, error)

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

func (*UserVoucherUpdate) SaveX

func (uvu *UserVoucherUpdate) SaveX(ctx context.Context) int

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

func (*UserVoucherUpdate) SetUpdatedAt

func (uvu *UserVoucherUpdate) SetUpdatedAt(t time.Time) *UserVoucherUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserVoucherUpdate) SetUserID

func (uvu *UserVoucherUpdate) SetUserID(s string) *UserVoucherUpdate

SetUserID sets the "user_id" field.

func (*UserVoucherUpdate) SetVoucherCampaignID

func (uvu *UserVoucherUpdate) SetVoucherCampaignID(i int64) *UserVoucherUpdate

SetVoucherCampaignID sets the "voucher_campaign_id" field.

func (*UserVoucherUpdate) Where

Where appends a list predicates to the UserVoucherUpdate builder.

type UserVoucherUpdateOne

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

UserVoucherUpdateOne is the builder for updating a single UserVoucher entity.

func (*UserVoucherUpdateOne) AddVoucherCampaignID

func (uvuo *UserVoucherUpdateOne) AddVoucherCampaignID(i int64) *UserVoucherUpdateOne

AddVoucherCampaignID adds i to the "voucher_campaign_id" field.

func (*UserVoucherUpdateOne) Exec

func (uvuo *UserVoucherUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserVoucherUpdateOne) ExecX

func (uvuo *UserVoucherUpdateOne) ExecX(ctx context.Context)

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

func (*UserVoucherUpdateOne) Mutation

func (uvuo *UserVoucherUpdateOne) Mutation() *UserVoucherMutation

Mutation returns the UserVoucherMutation object of the builder.

func (*UserVoucherUpdateOne) Save

Save executes the query and returns the updated UserVoucher entity.

func (*UserVoucherUpdateOne) SaveX

func (uvuo *UserVoucherUpdateOne) SaveX(ctx context.Context) *UserVoucher

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

func (*UserVoucherUpdateOne) Select

func (uvuo *UserVoucherUpdateOne) Select(field string, fields ...string) *UserVoucherUpdateOne

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

func (*UserVoucherUpdateOne) SetUpdatedAt

func (uvuo *UserVoucherUpdateOne) SetUpdatedAt(t time.Time) *UserVoucherUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserVoucherUpdateOne) SetUserID

func (uvuo *UserVoucherUpdateOne) SetUserID(s string) *UserVoucherUpdateOne

SetUserID sets the "user_id" field.

func (*UserVoucherUpdateOne) SetVoucherCampaignID

func (uvuo *UserVoucherUpdateOne) SetVoucherCampaignID(i int64) *UserVoucherUpdateOne

SetVoucherCampaignID sets the "voucher_campaign_id" field.

func (*UserVoucherUpdateOne) Where

Where appends a list predicates to the UserVoucherUpdate builder.

type UserVouchers

type UserVouchers []*UserVoucher

UserVouchers is a parsable slice of UserVoucher.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

type Voucher

type Voucher struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Value holds the value of the "value" field.
	Value float64 `json:"value,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
}

Voucher is the model entity for the Voucher schema.

func (*Voucher) GetValue

func (v *Voucher) GetValue(name string) (ent.Value, error)

GetValue returns the ent.Value that was dynamically selected and assigned to the Voucher. This includes values selected through modifiers, order, etc.

func (*Voucher) String

func (v *Voucher) String() string

String implements the fmt.Stringer.

func (*Voucher) Unwrap

func (v *Voucher) Unwrap() *Voucher

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

func (v *Voucher) Update() *VoucherUpdateOne

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

type VoucherCampaign

type VoucherCampaign struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CampaignID holds the value of the "campaign_id" field.
	CampaignID int64 `json:"campaign_id,omitempty"`
	// VoucherID holds the value of the "voucher_id" field.
	VoucherID int64 `json:"voucher_id,omitempty"`
	// StartDay holds the value of the "start_day" field.
	StartDay time.Time `json:"start_day,omitempty"`
	// ValidTo holds the value of the "valid_to" field.
	ValidTo time.Time `json:"valid_to,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
}

VoucherCampaign is the model entity for the VoucherCampaign schema.

func (*VoucherCampaign) String

func (vc *VoucherCampaign) String() string

String implements the fmt.Stringer.

func (*VoucherCampaign) Unwrap

func (vc *VoucherCampaign) Unwrap() *VoucherCampaign

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

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

func (*VoucherCampaign) Value

func (vc *VoucherCampaign) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the VoucherCampaign. This includes values selected through modifiers, order, etc.

type VoucherCampaignClient

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

VoucherCampaignClient is a client for the VoucherCampaign schema.

func NewVoucherCampaignClient

func NewVoucherCampaignClient(c config) *VoucherCampaignClient

NewVoucherCampaignClient returns a client for the VoucherCampaign from the given config.

func (*VoucherCampaignClient) Create

Create returns a builder for creating a VoucherCampaign entity.

func (*VoucherCampaignClient) CreateBulk

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

func (*VoucherCampaignClient) Delete

Delete returns a delete builder for VoucherCampaign.

func (*VoucherCampaignClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VoucherCampaignClient) DeleteOneID

DeleteOneID returns a builder for deleting the given entity by its id.

func (*VoucherCampaignClient) Get

Get returns a VoucherCampaign entity by its id.

func (*VoucherCampaignClient) GetX

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

func (*VoucherCampaignClient) Hooks

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

Hooks returns the client hooks.

func (*VoucherCampaignClient) Intercept

func (c *VoucherCampaignClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `vouchercampaign.Intercept(f(g(h())))`.

func (*VoucherCampaignClient) Interceptors

func (c *VoucherCampaignClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*VoucherCampaignClient) MapCreateBulk

func (c *VoucherCampaignClient) MapCreateBulk(slice any, setFunc func(*VoucherCampaignCreate, int)) *VoucherCampaignCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*VoucherCampaignClient) Query

Query returns a query builder for VoucherCampaign.

func (*VoucherCampaignClient) Update

Update returns an update builder for VoucherCampaign.

func (*VoucherCampaignClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*VoucherCampaignClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*VoucherCampaignClient) Use

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

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

type VoucherCampaignCreate

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

VoucherCampaignCreate is the builder for creating a VoucherCampaign entity.

func (*VoucherCampaignCreate) Exec

func (vcc *VoucherCampaignCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoucherCampaignCreate) ExecX

func (vcc *VoucherCampaignCreate) ExecX(ctx context.Context)

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

func (*VoucherCampaignCreate) Mutation

Mutation returns the VoucherCampaignMutation object of the builder.

func (*VoucherCampaignCreate) Save

Save creates the VoucherCampaign in the database.

func (*VoucherCampaignCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*VoucherCampaignCreate) SetCampaignID

func (vcc *VoucherCampaignCreate) SetCampaignID(i int64) *VoucherCampaignCreate

SetCampaignID sets the "campaign_id" field.

func (*VoucherCampaignCreate) SetCreatedAt

func (vcc *VoucherCampaignCreate) SetCreatedAt(t time.Time) *VoucherCampaignCreate

SetCreatedAt sets the "created_at" field.

func (*VoucherCampaignCreate) SetNillableCreatedAt

func (vcc *VoucherCampaignCreate) SetNillableCreatedAt(t *time.Time) *VoucherCampaignCreate

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

func (*VoucherCampaignCreate) SetNillableUpdatedAt

func (vcc *VoucherCampaignCreate) SetNillableUpdatedAt(t *time.Time) *VoucherCampaignCreate

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

func (*VoucherCampaignCreate) SetStartDay

SetStartDay sets the "start_day" field.

func (*VoucherCampaignCreate) SetUpdatedAt

func (vcc *VoucherCampaignCreate) SetUpdatedAt(t time.Time) *VoucherCampaignCreate

SetUpdatedAt sets the "updated_at" field.

func (*VoucherCampaignCreate) SetValidTo

SetValidTo sets the "valid_to" field.

func (*VoucherCampaignCreate) SetVoucherID

func (vcc *VoucherCampaignCreate) SetVoucherID(i int64) *VoucherCampaignCreate

SetVoucherID sets the "voucher_id" field.

type VoucherCampaignCreateBulk

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

VoucherCampaignCreateBulk is the builder for creating many VoucherCampaign entities in bulk.

func (*VoucherCampaignCreateBulk) Exec

Exec executes the query.

func (*VoucherCampaignCreateBulk) ExecX

func (vccb *VoucherCampaignCreateBulk) ExecX(ctx context.Context)

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

func (*VoucherCampaignCreateBulk) Save

Save creates the VoucherCampaign entities in the database.

func (*VoucherCampaignCreateBulk) SaveX

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

type VoucherCampaignDelete

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

VoucherCampaignDelete is the builder for deleting a VoucherCampaign entity.

func (*VoucherCampaignDelete) Exec

func (vcd *VoucherCampaignDelete) Exec(ctx context.Context) (int, error)

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

func (*VoucherCampaignDelete) ExecX

func (vcd *VoucherCampaignDelete) ExecX(ctx context.Context) int

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

func (*VoucherCampaignDelete) Where

Where appends a list predicates to the VoucherCampaignDelete builder.

type VoucherCampaignDeleteOne

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

VoucherCampaignDeleteOne is the builder for deleting a single VoucherCampaign entity.

func (*VoucherCampaignDeleteOne) Exec

Exec executes the deletion query.

func (*VoucherCampaignDeleteOne) ExecX

func (vcdo *VoucherCampaignDeleteOne) ExecX(ctx context.Context)

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

func (*VoucherCampaignDeleteOne) Where

Where appends a list predicates to the VoucherCampaignDelete builder.

type VoucherCampaignGroupBy

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

VoucherCampaignGroupBy is the group-by builder for VoucherCampaign entities.

func (*VoucherCampaignGroupBy) Aggregate

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

func (*VoucherCampaignGroupBy) Bool

func (s *VoucherCampaignGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*VoucherCampaignGroupBy) BoolX

func (s *VoucherCampaignGroupBy) BoolX(ctx context.Context) bool

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

func (*VoucherCampaignGroupBy) Bools

func (s *VoucherCampaignGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*VoucherCampaignGroupBy) BoolsX

func (s *VoucherCampaignGroupBy) BoolsX(ctx context.Context) []bool

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

func (*VoucherCampaignGroupBy) Float64

func (s *VoucherCampaignGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*VoucherCampaignGroupBy) Float64X

func (s *VoucherCampaignGroupBy) Float64X(ctx context.Context) float64

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

func (*VoucherCampaignGroupBy) Float64s

func (s *VoucherCampaignGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*VoucherCampaignGroupBy) Float64sX

func (s *VoucherCampaignGroupBy) Float64sX(ctx context.Context) []float64

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

func (*VoucherCampaignGroupBy) Int

func (s *VoucherCampaignGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*VoucherCampaignGroupBy) IntX

func (s *VoucherCampaignGroupBy) IntX(ctx context.Context) int

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

func (*VoucherCampaignGroupBy) Ints

func (s *VoucherCampaignGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*VoucherCampaignGroupBy) IntsX

func (s *VoucherCampaignGroupBy) IntsX(ctx context.Context) []int

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

func (*VoucherCampaignGroupBy) Scan

func (vcgb *VoucherCampaignGroupBy) Scan(ctx context.Context, v any) error

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

func (*VoucherCampaignGroupBy) ScanX

func (s *VoucherCampaignGroupBy) ScanX(ctx context.Context, v any)

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

func (*VoucherCampaignGroupBy) String

func (s *VoucherCampaignGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*VoucherCampaignGroupBy) StringX

func (s *VoucherCampaignGroupBy) StringX(ctx context.Context) string

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

func (*VoucherCampaignGroupBy) Strings

func (s *VoucherCampaignGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*VoucherCampaignGroupBy) StringsX

func (s *VoucherCampaignGroupBy) StringsX(ctx context.Context) []string

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

type VoucherCampaignMutation

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

VoucherCampaignMutation represents an operation that mutates the VoucherCampaign nodes in the graph.

func (*VoucherCampaignMutation) AddCampaignID

func (m *VoucherCampaignMutation) AddCampaignID(i int64)

AddCampaignID adds i to the "campaign_id" field.

func (*VoucherCampaignMutation) AddField

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) AddVoucherID

func (m *VoucherCampaignMutation) AddVoucherID(i int64)

AddVoucherID adds i to the "voucher_id" field.

func (*VoucherCampaignMutation) AddedCampaignID

func (m *VoucherCampaignMutation) AddedCampaignID() (r int64, exists bool)

AddedCampaignID returns the value that was added to the "campaign_id" field in this mutation.

func (*VoucherCampaignMutation) AddedEdges

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

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

func (*VoucherCampaignMutation) AddedField

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

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

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

func (*VoucherCampaignMutation) AddedIDs

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

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

func (*VoucherCampaignMutation) AddedVoucherID

func (m *VoucherCampaignMutation) AddedVoucherID() (r int64, exists bool)

AddedVoucherID returns the value that was added to the "voucher_id" field in this mutation.

func (*VoucherCampaignMutation) CampaignID

func (m *VoucherCampaignMutation) CampaignID() (r int64, exists bool)

CampaignID returns the value of the "campaign_id" field in the mutation.

func (*VoucherCampaignMutation) ClearEdge

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

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

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

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

func (*VoucherCampaignMutation) ClearedFields

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

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

func (VoucherCampaignMutation) Client

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

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

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

func (*VoucherCampaignMutation) EdgeCleared

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

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

func (*VoucherCampaignMutation) Field

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

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

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

func (*VoucherCampaignMutation) Fields

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) ID

func (m *VoucherCampaignMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*VoucherCampaignMutation) IDs

func (m *VoucherCampaignMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*VoucherCampaignMutation) OldCampaignID

func (m *VoucherCampaignMutation) OldCampaignID(ctx context.Context) (v int64, err error)

OldCampaignID returns the old "campaign_id" field's value of the VoucherCampaign entity. If the VoucherCampaign 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 (*VoucherCampaignMutation) OldCreatedAt

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

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

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) OldStartDay

func (m *VoucherCampaignMutation) OldStartDay(ctx context.Context) (v time.Time, err error)

OldStartDay returns the old "start_day" field's value of the VoucherCampaign entity. If the VoucherCampaign 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 (*VoucherCampaignMutation) OldUpdatedAt

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

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

func (m *VoucherCampaignMutation) OldValidTo(ctx context.Context) (v time.Time, err error)

OldValidTo returns the old "valid_to" field's value of the VoucherCampaign entity. If the VoucherCampaign 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 (*VoucherCampaignMutation) OldVoucherID

func (m *VoucherCampaignMutation) OldVoucherID(ctx context.Context) (v int64, err error)

OldVoucherID returns the old "voucher_id" field's value of the VoucherCampaign entity. If the VoucherCampaign 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 (*VoucherCampaignMutation) Op

func (m *VoucherCampaignMutation) Op() Op

Op returns the operation name.

func (*VoucherCampaignMutation) RemovedEdges

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

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

func (*VoucherCampaignMutation) RemovedIDs

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) ResetCampaignID

func (m *VoucherCampaignMutation) ResetCampaignID()

ResetCampaignID resets all changes to the "campaign_id" field.

func (*VoucherCampaignMutation) ResetCreatedAt

func (m *VoucherCampaignMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*VoucherCampaignMutation) ResetEdge

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

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) ResetStartDay

func (m *VoucherCampaignMutation) ResetStartDay()

ResetStartDay resets all changes to the "start_day" field.

func (*VoucherCampaignMutation) ResetUpdatedAt

func (m *VoucherCampaignMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*VoucherCampaignMutation) ResetValidTo

func (m *VoucherCampaignMutation) ResetValidTo()

ResetValidTo resets all changes to the "valid_to" field.

func (*VoucherCampaignMutation) ResetVoucherID

func (m *VoucherCampaignMutation) ResetVoucherID()

ResetVoucherID resets all changes to the "voucher_id" field.

func (*VoucherCampaignMutation) SetCampaignID

func (m *VoucherCampaignMutation) SetCampaignID(i int64)

SetCampaignID sets the "campaign_id" field.

func (*VoucherCampaignMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*VoucherCampaignMutation) SetField

func (m *VoucherCampaignMutation) 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 (*VoucherCampaignMutation) SetOp

func (m *VoucherCampaignMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VoucherCampaignMutation) SetStartDay

func (m *VoucherCampaignMutation) SetStartDay(t time.Time)

SetStartDay sets the "start_day" field.

func (*VoucherCampaignMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*VoucherCampaignMutation) SetValidTo

func (m *VoucherCampaignMutation) SetValidTo(t time.Time)

SetValidTo sets the "valid_to" field.

func (*VoucherCampaignMutation) SetVoucherID

func (m *VoucherCampaignMutation) SetVoucherID(i int64)

SetVoucherID sets the "voucher_id" field.

func (*VoucherCampaignMutation) StartDay

func (m *VoucherCampaignMutation) StartDay() (r time.Time, exists bool)

StartDay returns the value of the "start_day" field in the mutation.

func (VoucherCampaignMutation) Tx

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

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

func (*VoucherCampaignMutation) Type

func (m *VoucherCampaignMutation) Type() string

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

func (*VoucherCampaignMutation) UpdatedAt

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

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

func (*VoucherCampaignMutation) ValidTo

func (m *VoucherCampaignMutation) ValidTo() (r time.Time, exists bool)

ValidTo returns the value of the "valid_to" field in the mutation.

func (*VoucherCampaignMutation) VoucherID

func (m *VoucherCampaignMutation) VoucherID() (r int64, exists bool)

VoucherID returns the value of the "voucher_id" field in the mutation.

func (*VoucherCampaignMutation) Where

Where appends a list predicates to the VoucherCampaignMutation builder.

func (*VoucherCampaignMutation) WhereP

func (m *VoucherCampaignMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the VoucherCampaignMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type VoucherCampaignQuery

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

VoucherCampaignQuery is the builder for querying VoucherCampaign entities.

func (*VoucherCampaignQuery) Aggregate

Aggregate returns a VoucherCampaignSelect configured with the given aggregations.

func (*VoucherCampaignQuery) All

All executes the query and returns a list of VoucherCampaigns.

func (*VoucherCampaignQuery) AllX

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

func (*VoucherCampaignQuery) Clone

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

func (*VoucherCampaignQuery) Count

func (vcq *VoucherCampaignQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VoucherCampaignQuery) CountX

func (vcq *VoucherCampaignQuery) CountX(ctx context.Context) int

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

func (*VoucherCampaignQuery) Exist

func (vcq *VoucherCampaignQuery) Exist(ctx context.Context) (bool, error)

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

func (*VoucherCampaignQuery) ExistX

func (vcq *VoucherCampaignQuery) ExistX(ctx context.Context) bool

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

func (*VoucherCampaignQuery) First

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

func (*VoucherCampaignQuery) FirstID

func (vcq *VoucherCampaignQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*VoucherCampaignQuery) FirstIDX

func (vcq *VoucherCampaignQuery) FirstIDX(ctx context.Context) int

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

func (*VoucherCampaignQuery) FirstX

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

func (*VoucherCampaignQuery) GroupBy

func (vcq *VoucherCampaignQuery) GroupBy(field string, fields ...string) *VoucherCampaignGroupBy

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

client.VoucherCampaign.Query().
	GroupBy(vouchercampaign.FieldCampaignID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VoucherCampaignQuery) IDs

func (vcq *VoucherCampaignQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*VoucherCampaignQuery) IDsX

func (vcq *VoucherCampaignQuery) IDsX(ctx context.Context) []int

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

func (*VoucherCampaignQuery) Limit

func (vcq *VoucherCampaignQuery) Limit(limit int) *VoucherCampaignQuery

Limit the number of records to be returned by this query.

func (*VoucherCampaignQuery) Offset

func (vcq *VoucherCampaignQuery) Offset(offset int) *VoucherCampaignQuery

Offset to start from.

func (*VoucherCampaignQuery) Only

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

func (*VoucherCampaignQuery) OnlyID

func (vcq *VoucherCampaignQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*VoucherCampaignQuery) OnlyIDX

func (vcq *VoucherCampaignQuery) OnlyIDX(ctx context.Context) int

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

func (*VoucherCampaignQuery) OnlyX

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

func (*VoucherCampaignQuery) Order

Order specifies how the records should be ordered.

func (*VoucherCampaignQuery) Select

func (vcq *VoucherCampaignQuery) Select(fields ...string) *VoucherCampaignSelect

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

client.VoucherCampaign.Query().
	Select(vouchercampaign.FieldCampaignID).
	Scan(ctx, &v)

func (*VoucherCampaignQuery) Unique

func (vcq *VoucherCampaignQuery) Unique(unique bool) *VoucherCampaignQuery

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 (*VoucherCampaignQuery) Where

Where adds a new predicate for the VoucherCampaignQuery builder.

type VoucherCampaignSelect

type VoucherCampaignSelect struct {
	*VoucherCampaignQuery
	// contains filtered or unexported fields
}

VoucherCampaignSelect is the builder for selecting fields of VoucherCampaign entities.

func (*VoucherCampaignSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*VoucherCampaignSelect) Bool

func (s *VoucherCampaignSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*VoucherCampaignSelect) BoolX

func (s *VoucherCampaignSelect) BoolX(ctx context.Context) bool

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

func (*VoucherCampaignSelect) Bools

func (s *VoucherCampaignSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*VoucherCampaignSelect) BoolsX

func (s *VoucherCampaignSelect) BoolsX(ctx context.Context) []bool

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

func (*VoucherCampaignSelect) Float64

func (s *VoucherCampaignSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*VoucherCampaignSelect) Float64X

func (s *VoucherCampaignSelect) Float64X(ctx context.Context) float64

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

func (*VoucherCampaignSelect) Float64s

func (s *VoucherCampaignSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*VoucherCampaignSelect) Float64sX

func (s *VoucherCampaignSelect) Float64sX(ctx context.Context) []float64

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

func (*VoucherCampaignSelect) Int

func (s *VoucherCampaignSelect) Int(ctx context.Context) (_ int, err error)

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

func (*VoucherCampaignSelect) IntX

func (s *VoucherCampaignSelect) IntX(ctx context.Context) int

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

func (*VoucherCampaignSelect) Ints

func (s *VoucherCampaignSelect) Ints(ctx context.Context) ([]int, error)

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

func (*VoucherCampaignSelect) IntsX

func (s *VoucherCampaignSelect) IntsX(ctx context.Context) []int

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

func (*VoucherCampaignSelect) Scan

func (vcs *VoucherCampaignSelect) Scan(ctx context.Context, v any) error

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

func (*VoucherCampaignSelect) ScanX

func (s *VoucherCampaignSelect) ScanX(ctx context.Context, v any)

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

func (*VoucherCampaignSelect) String

func (s *VoucherCampaignSelect) String(ctx context.Context) (_ string, err error)

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

func (*VoucherCampaignSelect) StringX

func (s *VoucherCampaignSelect) StringX(ctx context.Context) string

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

func (*VoucherCampaignSelect) Strings

func (s *VoucherCampaignSelect) Strings(ctx context.Context) ([]string, error)

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

func (*VoucherCampaignSelect) StringsX

func (s *VoucherCampaignSelect) StringsX(ctx context.Context) []string

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

type VoucherCampaignUpdate

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

VoucherCampaignUpdate is the builder for updating VoucherCampaign entities.

func (*VoucherCampaignUpdate) AddCampaignID

func (vcu *VoucherCampaignUpdate) AddCampaignID(i int64) *VoucherCampaignUpdate

AddCampaignID adds i to the "campaign_id" field.

func (*VoucherCampaignUpdate) AddVoucherID

func (vcu *VoucherCampaignUpdate) AddVoucherID(i int64) *VoucherCampaignUpdate

AddVoucherID adds i to the "voucher_id" field.

func (*VoucherCampaignUpdate) Exec

func (vcu *VoucherCampaignUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoucherCampaignUpdate) ExecX

func (vcu *VoucherCampaignUpdate) ExecX(ctx context.Context)

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

func (*VoucherCampaignUpdate) Mutation

Mutation returns the VoucherCampaignMutation object of the builder.

func (*VoucherCampaignUpdate) Save

func (vcu *VoucherCampaignUpdate) Save(ctx context.Context) (int, error)

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

func (*VoucherCampaignUpdate) SaveX

func (vcu *VoucherCampaignUpdate) SaveX(ctx context.Context) int

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

func (*VoucherCampaignUpdate) SetCampaignID

func (vcu *VoucherCampaignUpdate) SetCampaignID(i int64) *VoucherCampaignUpdate

SetCampaignID sets the "campaign_id" field.

func (*VoucherCampaignUpdate) SetStartDay

SetStartDay sets the "start_day" field.

func (*VoucherCampaignUpdate) SetUpdatedAt

func (vcu *VoucherCampaignUpdate) SetUpdatedAt(t time.Time) *VoucherCampaignUpdate

SetUpdatedAt sets the "updated_at" field.

func (*VoucherCampaignUpdate) SetValidTo

SetValidTo sets the "valid_to" field.

func (*VoucherCampaignUpdate) SetVoucherID

func (vcu *VoucherCampaignUpdate) SetVoucherID(i int64) *VoucherCampaignUpdate

SetVoucherID sets the "voucher_id" field.

func (*VoucherCampaignUpdate) Where

Where appends a list predicates to the VoucherCampaignUpdate builder.

type VoucherCampaignUpdateOne

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

VoucherCampaignUpdateOne is the builder for updating a single VoucherCampaign entity.

func (*VoucherCampaignUpdateOne) AddCampaignID

AddCampaignID adds i to the "campaign_id" field.

func (*VoucherCampaignUpdateOne) AddVoucherID

AddVoucherID adds i to the "voucher_id" field.

func (*VoucherCampaignUpdateOne) Exec

Exec executes the query on the entity.

func (*VoucherCampaignUpdateOne) ExecX

func (vcuo *VoucherCampaignUpdateOne) ExecX(ctx context.Context)

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

func (*VoucherCampaignUpdateOne) Mutation

Mutation returns the VoucherCampaignMutation object of the builder.

func (*VoucherCampaignUpdateOne) Save

Save executes the query and returns the updated VoucherCampaign entity.

func (*VoucherCampaignUpdateOne) SaveX

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

func (*VoucherCampaignUpdateOne) Select

func (vcuo *VoucherCampaignUpdateOne) Select(field string, fields ...string) *VoucherCampaignUpdateOne

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

func (*VoucherCampaignUpdateOne) SetCampaignID

SetCampaignID sets the "campaign_id" field.

func (*VoucherCampaignUpdateOne) SetStartDay

SetStartDay sets the "start_day" field.

func (*VoucherCampaignUpdateOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*VoucherCampaignUpdateOne) SetValidTo

SetValidTo sets the "valid_to" field.

func (*VoucherCampaignUpdateOne) SetVoucherID

SetVoucherID sets the "voucher_id" field.

func (*VoucherCampaignUpdateOne) Where

Where appends a list predicates to the VoucherCampaignUpdate builder.

type VoucherCampaigns

type VoucherCampaigns []*VoucherCampaign

VoucherCampaigns is a parsable slice of VoucherCampaign.

type VoucherClient

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

VoucherClient is a client for the Voucher schema.

func NewVoucherClient

func NewVoucherClient(c config) *VoucherClient

NewVoucherClient returns a client for the Voucher from the given config.

func (*VoucherClient) Create

func (c *VoucherClient) Create() *VoucherCreate

Create returns a builder for creating a Voucher entity.

func (*VoucherClient) CreateBulk

func (c *VoucherClient) CreateBulk(builders ...*VoucherCreate) *VoucherCreateBulk

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

func (*VoucherClient) Delete

func (c *VoucherClient) Delete() *VoucherDelete

Delete returns a delete builder for Voucher.

func (*VoucherClient) DeleteOne

func (c *VoucherClient) DeleteOne(v *Voucher) *VoucherDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VoucherClient) DeleteOneID

func (c *VoucherClient) DeleteOneID(id int) *VoucherDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*VoucherClient) Get

func (c *VoucherClient) Get(ctx context.Context, id int) (*Voucher, error)

Get returns a Voucher entity by its id.

func (*VoucherClient) GetX

func (c *VoucherClient) GetX(ctx context.Context, id int) *Voucher

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

func (*VoucherClient) Hooks

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

Hooks returns the client hooks.

func (*VoucherClient) Intercept

func (c *VoucherClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `voucher.Intercept(f(g(h())))`.

func (*VoucherClient) Interceptors

func (c *VoucherClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*VoucherClient) MapCreateBulk

func (c *VoucherClient) MapCreateBulk(slice any, setFunc func(*VoucherCreate, int)) *VoucherCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*VoucherClient) Query

func (c *VoucherClient) Query() *VoucherQuery

Query returns a query builder for Voucher.

func (*VoucherClient) Update

func (c *VoucherClient) Update() *VoucherUpdate

Update returns an update builder for Voucher.

func (*VoucherClient) UpdateOne

func (c *VoucherClient) UpdateOne(v *Voucher) *VoucherUpdateOne

UpdateOne returns an update builder for the given entity.

func (*VoucherClient) UpdateOneID

func (c *VoucherClient) UpdateOneID(id int) *VoucherUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VoucherClient) Use

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

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

type VoucherCreate

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

VoucherCreate is the builder for creating a Voucher entity.

func (*VoucherCreate) Exec

func (vc *VoucherCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoucherCreate) ExecX

func (vc *VoucherCreate) ExecX(ctx context.Context)

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

func (*VoucherCreate) Mutation

func (vc *VoucherCreate) Mutation() *VoucherMutation

Mutation returns the VoucherMutation object of the builder.

func (*VoucherCreate) Save

func (vc *VoucherCreate) Save(ctx context.Context) (*Voucher, error)

Save creates the Voucher in the database.

func (*VoucherCreate) SaveX

func (vc *VoucherCreate) SaveX(ctx context.Context) *Voucher

SaveX calls Save and panics if Save returns an error.

func (*VoucherCreate) SetCreatedAt

func (vc *VoucherCreate) SetCreatedAt(t time.Time) *VoucherCreate

SetCreatedAt sets the "created_at" field.

func (*VoucherCreate) SetName

func (vc *VoucherCreate) SetName(s string) *VoucherCreate

SetName sets the "name" field.

func (*VoucherCreate) SetNillableCreatedAt

func (vc *VoucherCreate) SetNillableCreatedAt(t *time.Time) *VoucherCreate

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

func (*VoucherCreate) SetNillableUpdatedAt

func (vc *VoucherCreate) SetNillableUpdatedAt(t *time.Time) *VoucherCreate

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

func (*VoucherCreate) SetType

func (vc *VoucherCreate) SetType(s string) *VoucherCreate

SetType sets the "type" field.

func (*VoucherCreate) SetUpdatedAt

func (vc *VoucherCreate) SetUpdatedAt(t time.Time) *VoucherCreate

SetUpdatedAt sets the "updated_at" field.

func (*VoucherCreate) SetValue

func (vc *VoucherCreate) SetValue(f float64) *VoucherCreate

SetValue sets the "value" field.

type VoucherCreateBulk

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

VoucherCreateBulk is the builder for creating many Voucher entities in bulk.

func (*VoucherCreateBulk) Exec

func (vcb *VoucherCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VoucherCreateBulk) ExecX

func (vcb *VoucherCreateBulk) ExecX(ctx context.Context)

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

func (*VoucherCreateBulk) Save

func (vcb *VoucherCreateBulk) Save(ctx context.Context) ([]*Voucher, error)

Save creates the Voucher entities in the database.

func (*VoucherCreateBulk) SaveX

func (vcb *VoucherCreateBulk) SaveX(ctx context.Context) []*Voucher

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

type VoucherDelete

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

VoucherDelete is the builder for deleting a Voucher entity.

func (*VoucherDelete) Exec

func (vd *VoucherDelete) Exec(ctx context.Context) (int, error)

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

func (*VoucherDelete) ExecX

func (vd *VoucherDelete) ExecX(ctx context.Context) int

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

func (*VoucherDelete) Where

func (vd *VoucherDelete) Where(ps ...predicate.Voucher) *VoucherDelete

Where appends a list predicates to the VoucherDelete builder.

type VoucherDeleteOne

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

VoucherDeleteOne is the builder for deleting a single Voucher entity.

func (*VoucherDeleteOne) Exec

func (vdo *VoucherDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VoucherDeleteOne) ExecX

func (vdo *VoucherDeleteOne) ExecX(ctx context.Context)

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

func (*VoucherDeleteOne) Where

Where appends a list predicates to the VoucherDelete builder.

type VoucherGroupBy

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

VoucherGroupBy is the group-by builder for Voucher entities.

func (*VoucherGroupBy) Aggregate

func (vgb *VoucherGroupBy) Aggregate(fns ...AggregateFunc) *VoucherGroupBy

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

func (*VoucherGroupBy) Bool

func (s *VoucherGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*VoucherGroupBy) BoolX

func (s *VoucherGroupBy) BoolX(ctx context.Context) bool

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

func (*VoucherGroupBy) Bools

func (s *VoucherGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*VoucherGroupBy) BoolsX

func (s *VoucherGroupBy) BoolsX(ctx context.Context) []bool

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

func (*VoucherGroupBy) Float64

func (s *VoucherGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*VoucherGroupBy) Float64X

func (s *VoucherGroupBy) Float64X(ctx context.Context) float64

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

func (*VoucherGroupBy) Float64s

func (s *VoucherGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*VoucherGroupBy) Float64sX

func (s *VoucherGroupBy) Float64sX(ctx context.Context) []float64

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

func (*VoucherGroupBy) Int

func (s *VoucherGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*VoucherGroupBy) IntX

func (s *VoucherGroupBy) IntX(ctx context.Context) int

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

func (*VoucherGroupBy) Ints

func (s *VoucherGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*VoucherGroupBy) IntsX

func (s *VoucherGroupBy) IntsX(ctx context.Context) []int

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

func (*VoucherGroupBy) Scan

func (vgb *VoucherGroupBy) Scan(ctx context.Context, v any) error

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

func (*VoucherGroupBy) ScanX

func (s *VoucherGroupBy) ScanX(ctx context.Context, v any)

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

func (*VoucherGroupBy) String

func (s *VoucherGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*VoucherGroupBy) StringX

func (s *VoucherGroupBy) StringX(ctx context.Context) string

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

func (*VoucherGroupBy) Strings

func (s *VoucherGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*VoucherGroupBy) StringsX

func (s *VoucherGroupBy) StringsX(ctx context.Context) []string

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

type VoucherMutation

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

VoucherMutation represents an operation that mutates the Voucher nodes in the graph.

func (*VoucherMutation) AddField

func (m *VoucherMutation) 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 (*VoucherMutation) AddValue

func (m *VoucherMutation) AddValue(f float64)

AddValue adds f to the "value" field.

func (*VoucherMutation) AddedEdges

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

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

func (*VoucherMutation) AddedField

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

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

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

func (*VoucherMutation) AddedIDs

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

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

func (*VoucherMutation) AddedValue

func (m *VoucherMutation) AddedValue() (r float64, exists bool)

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

func (*VoucherMutation) ClearEdge

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

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

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

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

func (*VoucherMutation) ClearedFields

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

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

func (VoucherMutation) Client

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

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

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

func (*VoucherMutation) EdgeCleared

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

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

func (*VoucherMutation) Field

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

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

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

func (*VoucherMutation) Fields

func (m *VoucherMutation) 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 (*VoucherMutation) GetType

func (m *VoucherMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*VoucherMutation) ID

func (m *VoucherMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*VoucherMutation) IDs

func (m *VoucherMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*VoucherMutation) Name

func (m *VoucherMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*VoucherMutation) OldCreatedAt

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

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

func (m *VoucherMutation) 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 (*VoucherMutation) OldName

func (m *VoucherMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Voucher entity. If the Voucher 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 (*VoucherMutation) OldType

func (m *VoucherMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Voucher entity. If the Voucher 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 (*VoucherMutation) OldUpdatedAt

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

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

func (m *VoucherMutation) OldValue(ctx context.Context) (v float64, err error)

OldValue returns the old "value" field's value of the Voucher entity. If the Voucher 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 (*VoucherMutation) Op

func (m *VoucherMutation) Op() Op

Op returns the operation name.

func (*VoucherMutation) RemovedEdges

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

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

func (*VoucherMutation) RemovedIDs

func (m *VoucherMutation) 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 (*VoucherMutation) ResetCreatedAt

func (m *VoucherMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*VoucherMutation) ResetEdge

func (m *VoucherMutation) 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 (*VoucherMutation) ResetField

func (m *VoucherMutation) 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 (*VoucherMutation) ResetName

func (m *VoucherMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*VoucherMutation) ResetType

func (m *VoucherMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*VoucherMutation) ResetUpdatedAt

func (m *VoucherMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*VoucherMutation) ResetValue

func (m *VoucherMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*VoucherMutation) SetCreatedAt

func (m *VoucherMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*VoucherMutation) SetField

func (m *VoucherMutation) 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 (*VoucherMutation) SetName

func (m *VoucherMutation) SetName(s string)

SetName sets the "name" field.

func (*VoucherMutation) SetOp

func (m *VoucherMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VoucherMutation) SetType

func (m *VoucherMutation) SetType(s string)

SetType sets the "type" field.

func (*VoucherMutation) SetUpdatedAt

func (m *VoucherMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*VoucherMutation) SetValue

func (m *VoucherMutation) SetValue(f float64)

SetValue sets the "value" field.

func (VoucherMutation) Tx

func (m VoucherMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*VoucherMutation) Type

func (m *VoucherMutation) Type() string

Type returns the node type of this mutation (Voucher).

func (*VoucherMutation) UpdatedAt

func (m *VoucherMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*VoucherMutation) Value

func (m *VoucherMutation) Value() (r float64, exists bool)

Value returns the value of the "value" field in the mutation.

func (*VoucherMutation) Where

func (m *VoucherMutation) Where(ps ...predicate.Voucher)

Where appends a list predicates to the VoucherMutation builder.

func (*VoucherMutation) WhereP

func (m *VoucherMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the VoucherMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type VoucherQuery

type VoucherQuery struct {
	// contains filtered or unexported fields
}

VoucherQuery is the builder for querying Voucher entities.

func (*VoucherQuery) Aggregate

func (vq *VoucherQuery) Aggregate(fns ...AggregateFunc) *VoucherSelect

Aggregate returns a VoucherSelect configured with the given aggregations.

func (*VoucherQuery) All

func (vq *VoucherQuery) All(ctx context.Context) ([]*Voucher, error)

All executes the query and returns a list of Vouchers.

func (*VoucherQuery) AllX

func (vq *VoucherQuery) AllX(ctx context.Context) []*Voucher

AllX is like All, but panics if an error occurs.

func (*VoucherQuery) Clone

func (vq *VoucherQuery) Clone() *VoucherQuery

Clone returns a duplicate of the VoucherQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*VoucherQuery) Count

func (vq *VoucherQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VoucherQuery) CountX

func (vq *VoucherQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*VoucherQuery) Exist

func (vq *VoucherQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*VoucherQuery) ExistX

func (vq *VoucherQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*VoucherQuery) First

func (vq *VoucherQuery) First(ctx context.Context) (*Voucher, error)

First returns the first Voucher entity from the query. Returns a *NotFoundError when no Voucher was found.

func (*VoucherQuery) FirstID

func (vq *VoucherQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Voucher ID from the query. Returns a *NotFoundError when no Voucher ID was found.

func (*VoucherQuery) FirstIDX

func (vq *VoucherQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*VoucherQuery) FirstX

func (vq *VoucherQuery) FirstX(ctx context.Context) *Voucher

FirstX is like First, but panics if an error occurs.

func (*VoucherQuery) GroupBy

func (vq *VoucherQuery) GroupBy(field string, fields ...string) *VoucherGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Voucher.Query().
	GroupBy(voucher.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VoucherQuery) IDs

func (vq *VoucherQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Voucher IDs.

func (*VoucherQuery) IDsX

func (vq *VoucherQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*VoucherQuery) Limit

func (vq *VoucherQuery) Limit(limit int) *VoucherQuery

Limit the number of records to be returned by this query.

func (*VoucherQuery) Offset

func (vq *VoucherQuery) Offset(offset int) *VoucherQuery

Offset to start from.

func (*VoucherQuery) Only

func (vq *VoucherQuery) Only(ctx context.Context) (*Voucher, error)

Only returns a single Voucher entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Voucher entity is found. Returns a *NotFoundError when no Voucher entities are found.

func (*VoucherQuery) OnlyID

func (vq *VoucherQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Voucher ID in the query. Returns a *NotSingularError when more than one Voucher ID is found. Returns a *NotFoundError when no entities are found.

func (*VoucherQuery) OnlyIDX

func (vq *VoucherQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*VoucherQuery) OnlyX

func (vq *VoucherQuery) OnlyX(ctx context.Context) *Voucher

OnlyX is like Only, but panics if an error occurs.

func (*VoucherQuery) Order

func (vq *VoucherQuery) Order(o ...voucher.OrderOption) *VoucherQuery

Order specifies how the records should be ordered.

func (*VoucherQuery) Select

func (vq *VoucherQuery) Select(fields ...string) *VoucherSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Voucher.Query().
	Select(voucher.FieldName).
	Scan(ctx, &v)

func (*VoucherQuery) Unique

func (vq *VoucherQuery) Unique(unique bool) *VoucherQuery

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 (*VoucherQuery) Where

func (vq *VoucherQuery) Where(ps ...predicate.Voucher) *VoucherQuery

Where adds a new predicate for the VoucherQuery builder.

type VoucherSelect

type VoucherSelect struct {
	*VoucherQuery
	// contains filtered or unexported fields
}

VoucherSelect is the builder for selecting fields of Voucher entities.

func (*VoucherSelect) Aggregate

func (vs *VoucherSelect) Aggregate(fns ...AggregateFunc) *VoucherSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VoucherSelect) Bool

func (s *VoucherSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) BoolX

func (s *VoucherSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VoucherSelect) Bools

func (s *VoucherSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) BoolsX

func (s *VoucherSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VoucherSelect) Float64

func (s *VoucherSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) Float64X

func (s *VoucherSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VoucherSelect) Float64s

func (s *VoucherSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) Float64sX

func (s *VoucherSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VoucherSelect) Int

func (s *VoucherSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) IntX

func (s *VoucherSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VoucherSelect) Ints

func (s *VoucherSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) IntsX

func (s *VoucherSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VoucherSelect) Scan

func (vs *VoucherSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VoucherSelect) ScanX

func (s *VoucherSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VoucherSelect) String

func (s *VoucherSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) StringX

func (s *VoucherSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VoucherSelect) Strings

func (s *VoucherSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VoucherSelect) StringsX

func (s *VoucherSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VoucherUpdate

type VoucherUpdate struct {
	// contains filtered or unexported fields
}

VoucherUpdate is the builder for updating Voucher entities.

func (*VoucherUpdate) AddValue

func (vu *VoucherUpdate) AddValue(f float64) *VoucherUpdate

AddValue adds f to the "value" field.

func (*VoucherUpdate) Exec

func (vu *VoucherUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoucherUpdate) ExecX

func (vu *VoucherUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoucherUpdate) Mutation

func (vu *VoucherUpdate) Mutation() *VoucherMutation

Mutation returns the VoucherMutation object of the builder.

func (*VoucherUpdate) Save

func (vu *VoucherUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*VoucherUpdate) SaveX

func (vu *VoucherUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*VoucherUpdate) SetName

func (vu *VoucherUpdate) SetName(s string) *VoucherUpdate

SetName sets the "name" field.

func (*VoucherUpdate) SetType

func (vu *VoucherUpdate) SetType(s string) *VoucherUpdate

SetType sets the "type" field.

func (*VoucherUpdate) SetUpdatedAt

func (vu *VoucherUpdate) SetUpdatedAt(t time.Time) *VoucherUpdate

SetUpdatedAt sets the "updated_at" field.

func (*VoucherUpdate) SetValue

func (vu *VoucherUpdate) SetValue(f float64) *VoucherUpdate

SetValue sets the "value" field.

func (*VoucherUpdate) Where

func (vu *VoucherUpdate) Where(ps ...predicate.Voucher) *VoucherUpdate

Where appends a list predicates to the VoucherUpdate builder.

type VoucherUpdateOne

type VoucherUpdateOne struct {
	// contains filtered or unexported fields
}

VoucherUpdateOne is the builder for updating a single Voucher entity.

func (*VoucherUpdateOne) AddValue

func (vuo *VoucherUpdateOne) AddValue(f float64) *VoucherUpdateOne

AddValue adds f to the "value" field.

func (*VoucherUpdateOne) Exec

func (vuo *VoucherUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VoucherUpdateOne) ExecX

func (vuo *VoucherUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoucherUpdateOne) Mutation

func (vuo *VoucherUpdateOne) Mutation() *VoucherMutation

Mutation returns the VoucherMutation object of the builder.

func (*VoucherUpdateOne) Save

func (vuo *VoucherUpdateOne) Save(ctx context.Context) (*Voucher, error)

Save executes the query and returns the updated Voucher entity.

func (*VoucherUpdateOne) SaveX

func (vuo *VoucherUpdateOne) SaveX(ctx context.Context) *Voucher

SaveX is like Save, but panics if an error occurs.

func (*VoucherUpdateOne) Select

func (vuo *VoucherUpdateOne) Select(field string, fields ...string) *VoucherUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*VoucherUpdateOne) SetName

func (vuo *VoucherUpdateOne) SetName(s string) *VoucherUpdateOne

SetName sets the "name" field.

func (*VoucherUpdateOne) SetType

func (vuo *VoucherUpdateOne) SetType(s string) *VoucherUpdateOne

SetType sets the "type" field.

func (*VoucherUpdateOne) SetUpdatedAt

func (vuo *VoucherUpdateOne) SetUpdatedAt(t time.Time) *VoucherUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*VoucherUpdateOne) SetValue

func (vuo *VoucherUpdateOne) SetValue(f float64) *VoucherUpdateOne

SetValue sets the "value" field.

func (*VoucherUpdateOne) Where

Where appends a list predicates to the VoucherUpdate builder.

type Vouchers

type Vouchers []*Voucher

Vouchers is a parsable slice of Voucher.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL