Documentation ¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type Merchant
- type MerchantClient
- func (c *MerchantClient) Create() *MerchantCreate
- func (c *MerchantClient) CreateBulk(builders ...*MerchantCreate) *MerchantCreateBulk
- func (c *MerchantClient) Delete() *MerchantDelete
- func (c *MerchantClient) DeleteOne(m *Merchant) *MerchantDeleteOne
- func (c *MerchantClient) DeleteOneID(id uint64) *MerchantDeleteOne
- func (c *MerchantClient) Get(ctx context.Context, id uint64) (*Merchant, error)
- func (c *MerchantClient) GetX(ctx context.Context, id uint64) *Merchant
- func (c *MerchantClient) Hooks() []Hook
- func (c *MerchantClient) Intercept(interceptors ...Interceptor)
- func (c *MerchantClient) Interceptors() []Interceptor
- func (c *MerchantClient) MapCreateBulk(slice any, setFunc func(*MerchantCreate, int)) *MerchantCreateBulk
- func (c *MerchantClient) Query() *MerchantQuery
- func (c *MerchantClient) Update() *MerchantUpdate
- func (c *MerchantClient) UpdateOne(m *Merchant) *MerchantUpdateOne
- func (c *MerchantClient) UpdateOneID(id uint64) *MerchantUpdateOne
- func (c *MerchantClient) Use(hooks ...Hook)
- type MerchantCreate
- func (mc *MerchantCreate) Exec(ctx context.Context) error
- func (mc *MerchantCreate) ExecX(ctx context.Context)
- func (mc *MerchantCreate) Mutation() *MerchantMutation
- func (mc *MerchantCreate) Save(ctx context.Context) (*Merchant, error)
- func (mc *MerchantCreate) SaveX(ctx context.Context) *Merchant
- func (mc *MerchantCreate) SetCreateAt(t time.Time) *MerchantCreate
- func (mc *MerchantCreate) SetEmail(s string) *MerchantCreate
- func (mc *MerchantCreate) SetID(u uint64) *MerchantCreate
- func (mc *MerchantCreate) SetMerchantID(u uint64) *MerchantCreate
- func (mc *MerchantCreate) SetMobile(s string) *MerchantCreate
- func (mc *MerchantCreate) SetName(s string) *MerchantCreate
- func (mc *MerchantCreate) SetPassword(s string) *MerchantCreate
- func (mc *MerchantCreate) SetSalt(s string) *MerchantCreate
- type MerchantCreateBulk
- type MerchantDelete
- type MerchantDeleteOne
- type MerchantGroupBy
- func (mgb *MerchantGroupBy) Aggregate(fns ...AggregateFunc) *MerchantGroupBy
- func (s *MerchantGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *MerchantGroupBy) BoolX(ctx context.Context) bool
- func (s *MerchantGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *MerchantGroupBy) BoolsX(ctx context.Context) []bool
- func (s *MerchantGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *MerchantGroupBy) Float64X(ctx context.Context) float64
- func (s *MerchantGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *MerchantGroupBy) Float64sX(ctx context.Context) []float64
- func (s *MerchantGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *MerchantGroupBy) IntX(ctx context.Context) int
- func (s *MerchantGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *MerchantGroupBy) IntsX(ctx context.Context) []int
- func (mgb *MerchantGroupBy) Scan(ctx context.Context, v any) error
- func (s *MerchantGroupBy) ScanX(ctx context.Context, v any)
- func (s *MerchantGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *MerchantGroupBy) StringX(ctx context.Context) string
- func (s *MerchantGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *MerchantGroupBy) StringsX(ctx context.Context) []string
- type MerchantMutation
- func (m *MerchantMutation) AddField(name string, value ent.Value) error
- func (m *MerchantMutation) AddMerchantID(u int64)
- func (m *MerchantMutation) AddedEdges() []string
- func (m *MerchantMutation) AddedField(name string) (ent.Value, bool)
- func (m *MerchantMutation) AddedFields() []string
- func (m *MerchantMutation) AddedIDs(name string) []ent.Value
- func (m *MerchantMutation) AddedMerchantID() (r int64, exists bool)
- func (m *MerchantMutation) ClearEdge(name string) error
- func (m *MerchantMutation) ClearField(name string) error
- func (m *MerchantMutation) ClearedEdges() []string
- func (m *MerchantMutation) ClearedFields() []string
- func (m MerchantMutation) Client() *Client
- func (m *MerchantMutation) CreateAt() (r time.Time, exists bool)
- func (m *MerchantMutation) EdgeCleared(name string) bool
- func (m *MerchantMutation) Email() (r string, exists bool)
- func (m *MerchantMutation) Field(name string) (ent.Value, bool)
- func (m *MerchantMutation) FieldCleared(name string) bool
- func (m *MerchantMutation) Fields() []string
- func (m *MerchantMutation) ID() (id uint64, exists bool)
- func (m *MerchantMutation) IDs(ctx context.Context) ([]uint64, error)
- func (m *MerchantMutation) MerchantID() (r uint64, exists bool)
- func (m *MerchantMutation) Mobile() (r string, exists bool)
- func (m *MerchantMutation) Name() (r string, exists bool)
- func (m *MerchantMutation) OldCreateAt(ctx context.Context) (v time.Time, err error)
- func (m *MerchantMutation) OldEmail(ctx context.Context) (v string, err error)
- func (m *MerchantMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *MerchantMutation) OldMerchantID(ctx context.Context) (v uint64, err error)
- func (m *MerchantMutation) OldMobile(ctx context.Context) (v string, err error)
- func (m *MerchantMutation) OldName(ctx context.Context) (v string, err error)
- func (m *MerchantMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *MerchantMutation) OldSalt(ctx context.Context) (v string, err error)
- func (m *MerchantMutation) Op() Op
- func (m *MerchantMutation) Password() (r string, exists bool)
- func (m *MerchantMutation) RemovedEdges() []string
- func (m *MerchantMutation) RemovedIDs(name string) []ent.Value
- func (m *MerchantMutation) ResetCreateAt()
- func (m *MerchantMutation) ResetEdge(name string) error
- func (m *MerchantMutation) ResetEmail()
- func (m *MerchantMutation) ResetField(name string) error
- func (m *MerchantMutation) ResetMerchantID()
- func (m *MerchantMutation) ResetMobile()
- func (m *MerchantMutation) ResetName()
- func (m *MerchantMutation) ResetPassword()
- func (m *MerchantMutation) ResetSalt()
- func (m *MerchantMutation) Salt() (r string, exists bool)
- func (m *MerchantMutation) SetCreateAt(t time.Time)
- func (m *MerchantMutation) SetEmail(s string)
- func (m *MerchantMutation) SetField(name string, value ent.Value) error
- func (m *MerchantMutation) SetID(id uint64)
- func (m *MerchantMutation) SetMerchantID(u uint64)
- func (m *MerchantMutation) SetMobile(s string)
- func (m *MerchantMutation) SetName(s string)
- func (m *MerchantMutation) SetOp(op Op)
- func (m *MerchantMutation) SetPassword(s string)
- func (m *MerchantMutation) SetSalt(s string)
- func (m MerchantMutation) Tx() (*Tx, error)
- func (m *MerchantMutation) Type() string
- func (m *MerchantMutation) Where(ps ...predicate.Merchant)
- func (m *MerchantMutation) WhereP(ps ...func(*sql.Selector))
- type MerchantQuery
- func (mq *MerchantQuery) Aggregate(fns ...AggregateFunc) *MerchantSelect
- func (mq *MerchantQuery) All(ctx context.Context) ([]*Merchant, error)
- func (mq *MerchantQuery) AllX(ctx context.Context) []*Merchant
- func (mq *MerchantQuery) Clone() *MerchantQuery
- func (mq *MerchantQuery) Count(ctx context.Context) (int, error)
- func (mq *MerchantQuery) CountX(ctx context.Context) int
- func (mq *MerchantQuery) Exist(ctx context.Context) (bool, error)
- func (mq *MerchantQuery) ExistX(ctx context.Context) bool
- func (mq *MerchantQuery) First(ctx context.Context) (*Merchant, error)
- func (mq *MerchantQuery) FirstID(ctx context.Context) (id uint64, err error)
- func (mq *MerchantQuery) FirstIDX(ctx context.Context) uint64
- func (mq *MerchantQuery) FirstX(ctx context.Context) *Merchant
- func (mq *MerchantQuery) GroupBy(field string, fields ...string) *MerchantGroupBy
- func (mq *MerchantQuery) IDs(ctx context.Context) (ids []uint64, err error)
- func (mq *MerchantQuery) IDsX(ctx context.Context) []uint64
- func (mq *MerchantQuery) Limit(limit int) *MerchantQuery
- func (mq *MerchantQuery) Offset(offset int) *MerchantQuery
- func (mq *MerchantQuery) Only(ctx context.Context) (*Merchant, error)
- func (mq *MerchantQuery) OnlyID(ctx context.Context) (id uint64, err error)
- func (mq *MerchantQuery) OnlyIDX(ctx context.Context) uint64
- func (mq *MerchantQuery) OnlyX(ctx context.Context) *Merchant
- func (mq *MerchantQuery) Order(o ...merchant.OrderOption) *MerchantQuery
- func (mq *MerchantQuery) Select(fields ...string) *MerchantSelect
- func (mq *MerchantQuery) Unique(unique bool) *MerchantQuery
- func (mq *MerchantQuery) Where(ps ...predicate.Merchant) *MerchantQuery
- type MerchantSelect
- func (ms *MerchantSelect) Aggregate(fns ...AggregateFunc) *MerchantSelect
- func (s *MerchantSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *MerchantSelect) BoolX(ctx context.Context) bool
- func (s *MerchantSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *MerchantSelect) BoolsX(ctx context.Context) []bool
- func (s *MerchantSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *MerchantSelect) Float64X(ctx context.Context) float64
- func (s *MerchantSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *MerchantSelect) Float64sX(ctx context.Context) []float64
- func (s *MerchantSelect) Int(ctx context.Context) (_ int, err error)
- func (s *MerchantSelect) IntX(ctx context.Context) int
- func (s *MerchantSelect) Ints(ctx context.Context) ([]int, error)
- func (s *MerchantSelect) IntsX(ctx context.Context) []int
- func (ms *MerchantSelect) Scan(ctx context.Context, v any) error
- func (s *MerchantSelect) ScanX(ctx context.Context, v any)
- func (s *MerchantSelect) String(ctx context.Context) (_ string, err error)
- func (s *MerchantSelect) StringX(ctx context.Context) string
- func (s *MerchantSelect) Strings(ctx context.Context) ([]string, error)
- func (s *MerchantSelect) StringsX(ctx context.Context) []string
- type MerchantUpdate
- func (mu *MerchantUpdate) AddMerchantID(u int64) *MerchantUpdate
- func (mu *MerchantUpdate) Exec(ctx context.Context) error
- func (mu *MerchantUpdate) ExecX(ctx context.Context)
- func (mu *MerchantUpdate) Mutation() *MerchantMutation
- func (mu *MerchantUpdate) Save(ctx context.Context) (int, error)
- func (mu *MerchantUpdate) SaveX(ctx context.Context) int
- func (mu *MerchantUpdate) SetCreateAt(t time.Time) *MerchantUpdate
- func (mu *MerchantUpdate) SetEmail(s string) *MerchantUpdate
- func (mu *MerchantUpdate) SetMerchantID(u uint64) *MerchantUpdate
- func (mu *MerchantUpdate) SetMobile(s string) *MerchantUpdate
- func (mu *MerchantUpdate) SetName(s string) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableCreateAt(t *time.Time) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableEmail(s *string) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableMerchantID(u *uint64) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableMobile(s *string) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableName(s *string) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillablePassword(s *string) *MerchantUpdate
- func (mu *MerchantUpdate) SetNillableSalt(s *string) *MerchantUpdate
- func (mu *MerchantUpdate) SetPassword(s string) *MerchantUpdate
- func (mu *MerchantUpdate) SetSalt(s string) *MerchantUpdate
- func (mu *MerchantUpdate) Where(ps ...predicate.Merchant) *MerchantUpdate
- type MerchantUpdateOne
- func (muo *MerchantUpdateOne) AddMerchantID(u int64) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) Exec(ctx context.Context) error
- func (muo *MerchantUpdateOne) ExecX(ctx context.Context)
- func (muo *MerchantUpdateOne) Mutation() *MerchantMutation
- func (muo *MerchantUpdateOne) Save(ctx context.Context) (*Merchant, error)
- func (muo *MerchantUpdateOne) SaveX(ctx context.Context) *Merchant
- func (muo *MerchantUpdateOne) Select(field string, fields ...string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetCreateAt(t time.Time) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetEmail(s string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetMerchantID(u uint64) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetMobile(s string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetName(s string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableCreateAt(t *time.Time) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableEmail(s *string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableMerchantID(u *uint64) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableMobile(s *string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableName(s *string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillablePassword(s *string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetNillableSalt(s *string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetPassword(s string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) SetSalt(s string) *MerchantUpdateOne
- func (muo *MerchantUpdateOne) Where(ps ...predicate.Merchant) *MerchantUpdateOne
- type Merchants
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeMerchant = "Merchant" )
Variables ¶
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 IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Merchant is the client for interacting with the Merchant builders. Merchant *MerchantClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Merchant. 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(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(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 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 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 Merchant ¶
type Merchant struct { // ID of the ent. ID uint64 `json:"id,omitempty"` // 商户名称 Name string `json:"name,omitempty"` // 商户号 MerchantID uint64 `json:"merchant_id,omitempty"` // 商户邮箱号 Email string `json:"email,omitempty"` // 商户手机号 Mobile string `json:"mobile,omitempty"` // 密码盐 Salt string `json:"salt,omitempty"` // 密码 Password string `json:"password,omitempty"` // 创建时间 CreateAt time.Time `json:"create_at,omitempty"` // contains filtered or unexported fields }
Merchant is the model entity for the Merchant schema.
func (*Merchant) Unwrap ¶
Unwrap unwraps the Merchant 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 (*Merchant) Update ¶
func (m *Merchant) Update() *MerchantUpdateOne
Update returns a builder for updating this Merchant. Note that you need to call Merchant.Unwrap() before calling this method if this Merchant was returned from a transaction, and the transaction was committed or rolled back.
type MerchantClient ¶
type MerchantClient struct {
// contains filtered or unexported fields
}
MerchantClient is a client for the Merchant schema.
func NewMerchantClient ¶
func NewMerchantClient(c config) *MerchantClient
NewMerchantClient returns a client for the Merchant from the given config.
func (*MerchantClient) Create ¶
func (c *MerchantClient) Create() *MerchantCreate
Create returns a builder for creating a Merchant entity.
func (*MerchantClient) CreateBulk ¶
func (c *MerchantClient) CreateBulk(builders ...*MerchantCreate) *MerchantCreateBulk
CreateBulk returns a builder for creating a bulk of Merchant entities.
func (*MerchantClient) Delete ¶
func (c *MerchantClient) Delete() *MerchantDelete
Delete returns a delete builder for Merchant.
func (*MerchantClient) DeleteOne ¶
func (c *MerchantClient) DeleteOne(m *Merchant) *MerchantDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*MerchantClient) DeleteOneID ¶
func (c *MerchantClient) DeleteOneID(id uint64) *MerchantDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*MerchantClient) GetX ¶
func (c *MerchantClient) GetX(ctx context.Context, id uint64) *Merchant
GetX is like Get, but panics if an error occurs.
func (*MerchantClient) Hooks ¶
func (c *MerchantClient) Hooks() []Hook
Hooks returns the client hooks.
func (*MerchantClient) Intercept ¶
func (c *MerchantClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `merchant.Intercept(f(g(h())))`.
func (*MerchantClient) Interceptors ¶
func (c *MerchantClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*MerchantClient) MapCreateBulk ¶
func (c *MerchantClient) MapCreateBulk(slice any, setFunc func(*MerchantCreate, int)) *MerchantCreateBulk
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 (*MerchantClient) Query ¶
func (c *MerchantClient) Query() *MerchantQuery
Query returns a query builder for Merchant.
func (*MerchantClient) Update ¶
func (c *MerchantClient) Update() *MerchantUpdate
Update returns an update builder for Merchant.
func (*MerchantClient) UpdateOne ¶
func (c *MerchantClient) UpdateOne(m *Merchant) *MerchantUpdateOne
UpdateOne returns an update builder for the given entity.
func (*MerchantClient) UpdateOneID ¶
func (c *MerchantClient) UpdateOneID(id uint64) *MerchantUpdateOne
UpdateOneID returns an update builder for the given id.
func (*MerchantClient) Use ¶
func (c *MerchantClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `merchant.Hooks(f(g(h())))`.
type MerchantCreate ¶
type MerchantCreate struct {
// contains filtered or unexported fields
}
MerchantCreate is the builder for creating a Merchant entity.
func (*MerchantCreate) Exec ¶
func (mc *MerchantCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*MerchantCreate) ExecX ¶
func (mc *MerchantCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MerchantCreate) Mutation ¶
func (mc *MerchantCreate) Mutation() *MerchantMutation
Mutation returns the MerchantMutation object of the builder.
func (*MerchantCreate) Save ¶
func (mc *MerchantCreate) Save(ctx context.Context) (*Merchant, error)
Save creates the Merchant in the database.
func (*MerchantCreate) SaveX ¶
func (mc *MerchantCreate) SaveX(ctx context.Context) *Merchant
SaveX calls Save and panics if Save returns an error.
func (*MerchantCreate) SetCreateAt ¶
func (mc *MerchantCreate) SetCreateAt(t time.Time) *MerchantCreate
SetCreateAt sets the "create_at" field.
func (*MerchantCreate) SetEmail ¶
func (mc *MerchantCreate) SetEmail(s string) *MerchantCreate
SetEmail sets the "email" field.
func (*MerchantCreate) SetID ¶
func (mc *MerchantCreate) SetID(u uint64) *MerchantCreate
SetID sets the "id" field.
func (*MerchantCreate) SetMerchantID ¶
func (mc *MerchantCreate) SetMerchantID(u uint64) *MerchantCreate
SetMerchantID sets the "merchant_id" field.
func (*MerchantCreate) SetMobile ¶
func (mc *MerchantCreate) SetMobile(s string) *MerchantCreate
SetMobile sets the "mobile" field.
func (*MerchantCreate) SetName ¶
func (mc *MerchantCreate) SetName(s string) *MerchantCreate
SetName sets the "name" field.
func (*MerchantCreate) SetPassword ¶
func (mc *MerchantCreate) SetPassword(s string) *MerchantCreate
SetPassword sets the "password" field.
func (*MerchantCreate) SetSalt ¶
func (mc *MerchantCreate) SetSalt(s string) *MerchantCreate
SetSalt sets the "salt" field.
type MerchantCreateBulk ¶
type MerchantCreateBulk struct {
// contains filtered or unexported fields
}
MerchantCreateBulk is the builder for creating many Merchant entities in bulk.
func (*MerchantCreateBulk) Exec ¶
func (mcb *MerchantCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*MerchantCreateBulk) ExecX ¶
func (mcb *MerchantCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type MerchantDelete ¶
type MerchantDelete struct {
// contains filtered or unexported fields
}
MerchantDelete is the builder for deleting a Merchant entity.
func (*MerchantDelete) Exec ¶
func (md *MerchantDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*MerchantDelete) ExecX ¶
func (md *MerchantDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*MerchantDelete) Where ¶
func (md *MerchantDelete) Where(ps ...predicate.Merchant) *MerchantDelete
Where appends a list predicates to the MerchantDelete builder.
type MerchantDeleteOne ¶
type MerchantDeleteOne struct {
// contains filtered or unexported fields
}
MerchantDeleteOne is the builder for deleting a single Merchant entity.
func (*MerchantDeleteOne) Exec ¶
func (mdo *MerchantDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*MerchantDeleteOne) ExecX ¶
func (mdo *MerchantDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MerchantDeleteOne) Where ¶
func (mdo *MerchantDeleteOne) Where(ps ...predicate.Merchant) *MerchantDeleteOne
Where appends a list predicates to the MerchantDelete builder.
type MerchantGroupBy ¶
type MerchantGroupBy struct {
// contains filtered or unexported fields
}
MerchantGroupBy is the group-by builder for Merchant entities.
func (*MerchantGroupBy) Aggregate ¶
func (mgb *MerchantGroupBy) Aggregate(fns ...AggregateFunc) *MerchantGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*MerchantGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*MerchantGroupBy) Scan ¶
func (mgb *MerchantGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*MerchantGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type MerchantMutation ¶
type MerchantMutation struct {
// contains filtered or unexported fields
}
MerchantMutation represents an operation that mutates the Merchant nodes in the graph.
func (*MerchantMutation) AddField ¶
func (m *MerchantMutation) 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 (*MerchantMutation) AddMerchantID ¶
func (m *MerchantMutation) AddMerchantID(u int64)
AddMerchantID adds u to the "merchant_id" field.
func (*MerchantMutation) AddedEdges ¶
func (m *MerchantMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*MerchantMutation) AddedField ¶
func (m *MerchantMutation) 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 (*MerchantMutation) AddedFields ¶
func (m *MerchantMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*MerchantMutation) AddedIDs ¶
func (m *MerchantMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*MerchantMutation) AddedMerchantID ¶
func (m *MerchantMutation) AddedMerchantID() (r int64, exists bool)
AddedMerchantID returns the value that was added to the "merchant_id" field in this mutation.
func (*MerchantMutation) ClearEdge ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ClearField ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ClearedEdges ¶
func (m *MerchantMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*MerchantMutation) ClearedFields ¶
func (m *MerchantMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (MerchantMutation) Client ¶
func (m MerchantMutation) 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 (*MerchantMutation) CreateAt ¶
func (m *MerchantMutation) CreateAt() (r time.Time, exists bool)
CreateAt returns the value of the "create_at" field in the mutation.
func (*MerchantMutation) EdgeCleared ¶
func (m *MerchantMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*MerchantMutation) Email ¶
func (m *MerchantMutation) Email() (r string, exists bool)
Email returns the value of the "email" field in the mutation.
func (*MerchantMutation) Field ¶
func (m *MerchantMutation) 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 (*MerchantMutation) FieldCleared ¶
func (m *MerchantMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*MerchantMutation) Fields ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ID ¶
func (m *MerchantMutation) ID() (id uint64, 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 (*MerchantMutation) IDs ¶
func (m *MerchantMutation) IDs(ctx context.Context) ([]uint64, 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 (*MerchantMutation) MerchantID ¶
func (m *MerchantMutation) MerchantID() (r uint64, exists bool)
MerchantID returns the value of the "merchant_id" field in the mutation.
func (*MerchantMutation) Mobile ¶
func (m *MerchantMutation) Mobile() (r string, exists bool)
Mobile returns the value of the "mobile" field in the mutation.
func (*MerchantMutation) Name ¶
func (m *MerchantMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*MerchantMutation) OldCreateAt ¶
OldCreateAt returns the old "create_at" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldEmail ¶
func (m *MerchantMutation) OldEmail(ctx context.Context) (v string, err error)
OldEmail returns the old "email" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*MerchantMutation) OldMerchantID ¶
func (m *MerchantMutation) OldMerchantID(ctx context.Context) (v uint64, err error)
OldMerchantID returns the old "merchant_id" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldMobile ¶
func (m *MerchantMutation) OldMobile(ctx context.Context) (v string, err error)
OldMobile returns the old "mobile" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldName ¶
func (m *MerchantMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldPassword ¶
func (m *MerchantMutation) OldPassword(ctx context.Context) (v string, err error)
OldPassword returns the old "password" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) OldSalt ¶
func (m *MerchantMutation) OldSalt(ctx context.Context) (v string, err error)
OldSalt returns the old "salt" field's value of the Merchant entity. If the Merchant 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 (*MerchantMutation) Password ¶
func (m *MerchantMutation) Password() (r string, exists bool)
Password returns the value of the "password" field in the mutation.
func (*MerchantMutation) RemovedEdges ¶
func (m *MerchantMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*MerchantMutation) RemovedIDs ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ResetCreateAt ¶
func (m *MerchantMutation) ResetCreateAt()
ResetCreateAt resets all changes to the "create_at" field.
func (*MerchantMutation) ResetEdge ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ResetEmail ¶
func (m *MerchantMutation) ResetEmail()
ResetEmail resets all changes to the "email" field.
func (*MerchantMutation) ResetField ¶
func (m *MerchantMutation) 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 (*MerchantMutation) ResetMerchantID ¶
func (m *MerchantMutation) ResetMerchantID()
ResetMerchantID resets all changes to the "merchant_id" field.
func (*MerchantMutation) ResetMobile ¶
func (m *MerchantMutation) ResetMobile()
ResetMobile resets all changes to the "mobile" field.
func (*MerchantMutation) ResetName ¶
func (m *MerchantMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*MerchantMutation) ResetPassword ¶
func (m *MerchantMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*MerchantMutation) ResetSalt ¶
func (m *MerchantMutation) ResetSalt()
ResetSalt resets all changes to the "salt" field.
func (*MerchantMutation) Salt ¶
func (m *MerchantMutation) Salt() (r string, exists bool)
Salt returns the value of the "salt" field in the mutation.
func (*MerchantMutation) SetCreateAt ¶
func (m *MerchantMutation) SetCreateAt(t time.Time)
SetCreateAt sets the "create_at" field.
func (*MerchantMutation) SetEmail ¶
func (m *MerchantMutation) SetEmail(s string)
SetEmail sets the "email" field.
func (*MerchantMutation) SetField ¶
func (m *MerchantMutation) 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 (*MerchantMutation) SetID ¶
func (m *MerchantMutation) SetID(id uint64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Merchant entities.
func (*MerchantMutation) SetMerchantID ¶
func (m *MerchantMutation) SetMerchantID(u uint64)
SetMerchantID sets the "merchant_id" field.
func (*MerchantMutation) SetMobile ¶
func (m *MerchantMutation) SetMobile(s string)
SetMobile sets the "mobile" field.
func (*MerchantMutation) SetName ¶
func (m *MerchantMutation) SetName(s string)
SetName sets the "name" field.
func (*MerchantMutation) SetOp ¶
func (m *MerchantMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*MerchantMutation) SetPassword ¶
func (m *MerchantMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*MerchantMutation) SetSalt ¶
func (m *MerchantMutation) SetSalt(s string)
SetSalt sets the "salt" field.
func (MerchantMutation) Tx ¶
func (m MerchantMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*MerchantMutation) Type ¶
func (m *MerchantMutation) Type() string
Type returns the node type of this mutation (Merchant).
func (*MerchantMutation) Where ¶
func (m *MerchantMutation) Where(ps ...predicate.Merchant)
Where appends a list predicates to the MerchantMutation builder.
func (*MerchantMutation) WhereP ¶
func (m *MerchantMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the MerchantMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type MerchantQuery ¶
type MerchantQuery struct {
// contains filtered or unexported fields
}
MerchantQuery is the builder for querying Merchant entities.
func (*MerchantQuery) Aggregate ¶
func (mq *MerchantQuery) Aggregate(fns ...AggregateFunc) *MerchantSelect
Aggregate returns a MerchantSelect configured with the given aggregations.
func (*MerchantQuery) All ¶
func (mq *MerchantQuery) All(ctx context.Context) ([]*Merchant, error)
All executes the query and returns a list of Merchants.
func (*MerchantQuery) AllX ¶
func (mq *MerchantQuery) AllX(ctx context.Context) []*Merchant
AllX is like All, but panics if an error occurs.
func (*MerchantQuery) Clone ¶
func (mq *MerchantQuery) Clone() *MerchantQuery
Clone returns a duplicate of the MerchantQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*MerchantQuery) Count ¶
func (mq *MerchantQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*MerchantQuery) CountX ¶
func (mq *MerchantQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*MerchantQuery) Exist ¶
func (mq *MerchantQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*MerchantQuery) ExistX ¶
func (mq *MerchantQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*MerchantQuery) First ¶
func (mq *MerchantQuery) First(ctx context.Context) (*Merchant, error)
First returns the first Merchant entity from the query. Returns a *NotFoundError when no Merchant was found.
func (*MerchantQuery) FirstID ¶
func (mq *MerchantQuery) FirstID(ctx context.Context) (id uint64, err error)
FirstID returns the first Merchant ID from the query. Returns a *NotFoundError when no Merchant ID was found.
func (*MerchantQuery) FirstIDX ¶
func (mq *MerchantQuery) FirstIDX(ctx context.Context) uint64
FirstIDX is like FirstID, but panics if an error occurs.
func (*MerchantQuery) FirstX ¶
func (mq *MerchantQuery) FirstX(ctx context.Context) *Merchant
FirstX is like First, but panics if an error occurs.
func (*MerchantQuery) GroupBy ¶
func (mq *MerchantQuery) GroupBy(field string, fields ...string) *MerchantGroupBy
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.Merchant.Query(). GroupBy(merchant.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*MerchantQuery) IDs ¶
func (mq *MerchantQuery) IDs(ctx context.Context) (ids []uint64, err error)
IDs executes the query and returns a list of Merchant IDs.
func (*MerchantQuery) IDsX ¶
func (mq *MerchantQuery) IDsX(ctx context.Context) []uint64
IDsX is like IDs, but panics if an error occurs.
func (*MerchantQuery) Limit ¶
func (mq *MerchantQuery) Limit(limit int) *MerchantQuery
Limit the number of records to be returned by this query.
func (*MerchantQuery) Offset ¶
func (mq *MerchantQuery) Offset(offset int) *MerchantQuery
Offset to start from.
func (*MerchantQuery) Only ¶
func (mq *MerchantQuery) Only(ctx context.Context) (*Merchant, error)
Only returns a single Merchant entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Merchant entity is found. Returns a *NotFoundError when no Merchant entities are found.
func (*MerchantQuery) OnlyID ¶
func (mq *MerchantQuery) OnlyID(ctx context.Context) (id uint64, err error)
OnlyID is like Only, but returns the only Merchant ID in the query. Returns a *NotSingularError when more than one Merchant ID is found. Returns a *NotFoundError when no entities are found.
func (*MerchantQuery) OnlyIDX ¶
func (mq *MerchantQuery) OnlyIDX(ctx context.Context) uint64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*MerchantQuery) OnlyX ¶
func (mq *MerchantQuery) OnlyX(ctx context.Context) *Merchant
OnlyX is like Only, but panics if an error occurs.
func (*MerchantQuery) Order ¶
func (mq *MerchantQuery) Order(o ...merchant.OrderOption) *MerchantQuery
Order specifies how the records should be ordered.
func (*MerchantQuery) Select ¶
func (mq *MerchantQuery) Select(fields ...string) *MerchantSelect
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.Merchant.Query(). Select(merchant.FieldName). Scan(ctx, &v)
func (*MerchantQuery) Unique ¶
func (mq *MerchantQuery) Unique(unique bool) *MerchantQuery
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 (*MerchantQuery) Where ¶
func (mq *MerchantQuery) Where(ps ...predicate.Merchant) *MerchantQuery
Where adds a new predicate for the MerchantQuery builder.
type MerchantSelect ¶
type MerchantSelect struct { *MerchantQuery // contains filtered or unexported fields }
MerchantSelect is the builder for selecting fields of Merchant entities.
func (*MerchantSelect) Aggregate ¶
func (ms *MerchantSelect) Aggregate(fns ...AggregateFunc) *MerchantSelect
Aggregate adds the given aggregation functions to the selector query.
func (*MerchantSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*MerchantSelect) Scan ¶
func (ms *MerchantSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*MerchantSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type MerchantUpdate ¶
type MerchantUpdate struct {
// contains filtered or unexported fields
}
MerchantUpdate is the builder for updating Merchant entities.
func (*MerchantUpdate) AddMerchantID ¶
func (mu *MerchantUpdate) AddMerchantID(u int64) *MerchantUpdate
AddMerchantID adds u to the "merchant_id" field.
func (*MerchantUpdate) Exec ¶
func (mu *MerchantUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*MerchantUpdate) ExecX ¶
func (mu *MerchantUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MerchantUpdate) Mutation ¶
func (mu *MerchantUpdate) Mutation() *MerchantMutation
Mutation returns the MerchantMutation object of the builder.
func (*MerchantUpdate) Save ¶
func (mu *MerchantUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*MerchantUpdate) SaveX ¶
func (mu *MerchantUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*MerchantUpdate) SetCreateAt ¶
func (mu *MerchantUpdate) SetCreateAt(t time.Time) *MerchantUpdate
SetCreateAt sets the "create_at" field.
func (*MerchantUpdate) SetEmail ¶
func (mu *MerchantUpdate) SetEmail(s string) *MerchantUpdate
SetEmail sets the "email" field.
func (*MerchantUpdate) SetMerchantID ¶
func (mu *MerchantUpdate) SetMerchantID(u uint64) *MerchantUpdate
SetMerchantID sets the "merchant_id" field.
func (*MerchantUpdate) SetMobile ¶
func (mu *MerchantUpdate) SetMobile(s string) *MerchantUpdate
SetMobile sets the "mobile" field.
func (*MerchantUpdate) SetName ¶
func (mu *MerchantUpdate) SetName(s string) *MerchantUpdate
SetName sets the "name" field.
func (*MerchantUpdate) SetNillableCreateAt ¶
func (mu *MerchantUpdate) SetNillableCreateAt(t *time.Time) *MerchantUpdate
SetNillableCreateAt sets the "create_at" field if the given value is not nil.
func (*MerchantUpdate) SetNillableEmail ¶
func (mu *MerchantUpdate) SetNillableEmail(s *string) *MerchantUpdate
SetNillableEmail sets the "email" field if the given value is not nil.
func (*MerchantUpdate) SetNillableMerchantID ¶
func (mu *MerchantUpdate) SetNillableMerchantID(u *uint64) *MerchantUpdate
SetNillableMerchantID sets the "merchant_id" field if the given value is not nil.
func (*MerchantUpdate) SetNillableMobile ¶
func (mu *MerchantUpdate) SetNillableMobile(s *string) *MerchantUpdate
SetNillableMobile sets the "mobile" field if the given value is not nil.
func (*MerchantUpdate) SetNillableName ¶
func (mu *MerchantUpdate) SetNillableName(s *string) *MerchantUpdate
SetNillableName sets the "name" field if the given value is not nil.
func (*MerchantUpdate) SetNillablePassword ¶
func (mu *MerchantUpdate) SetNillablePassword(s *string) *MerchantUpdate
SetNillablePassword sets the "password" field if the given value is not nil.
func (*MerchantUpdate) SetNillableSalt ¶
func (mu *MerchantUpdate) SetNillableSalt(s *string) *MerchantUpdate
SetNillableSalt sets the "salt" field if the given value is not nil.
func (*MerchantUpdate) SetPassword ¶
func (mu *MerchantUpdate) SetPassword(s string) *MerchantUpdate
SetPassword sets the "password" field.
func (*MerchantUpdate) SetSalt ¶
func (mu *MerchantUpdate) SetSalt(s string) *MerchantUpdate
SetSalt sets the "salt" field.
func (*MerchantUpdate) Where ¶
func (mu *MerchantUpdate) Where(ps ...predicate.Merchant) *MerchantUpdate
Where appends a list predicates to the MerchantUpdate builder.
type MerchantUpdateOne ¶
type MerchantUpdateOne struct {
// contains filtered or unexported fields
}
MerchantUpdateOne is the builder for updating a single Merchant entity.
func (*MerchantUpdateOne) AddMerchantID ¶
func (muo *MerchantUpdateOne) AddMerchantID(u int64) *MerchantUpdateOne
AddMerchantID adds u to the "merchant_id" field.
func (*MerchantUpdateOne) Exec ¶
func (muo *MerchantUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*MerchantUpdateOne) ExecX ¶
func (muo *MerchantUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MerchantUpdateOne) Mutation ¶
func (muo *MerchantUpdateOne) Mutation() *MerchantMutation
Mutation returns the MerchantMutation object of the builder.
func (*MerchantUpdateOne) Save ¶
func (muo *MerchantUpdateOne) Save(ctx context.Context) (*Merchant, error)
Save executes the query and returns the updated Merchant entity.
func (*MerchantUpdateOne) SaveX ¶
func (muo *MerchantUpdateOne) SaveX(ctx context.Context) *Merchant
SaveX is like Save, but panics if an error occurs.
func (*MerchantUpdateOne) Select ¶
func (muo *MerchantUpdateOne) Select(field string, fields ...string) *MerchantUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*MerchantUpdateOne) SetCreateAt ¶
func (muo *MerchantUpdateOne) SetCreateAt(t time.Time) *MerchantUpdateOne
SetCreateAt sets the "create_at" field.
func (*MerchantUpdateOne) SetEmail ¶
func (muo *MerchantUpdateOne) SetEmail(s string) *MerchantUpdateOne
SetEmail sets the "email" field.
func (*MerchantUpdateOne) SetMerchantID ¶
func (muo *MerchantUpdateOne) SetMerchantID(u uint64) *MerchantUpdateOne
SetMerchantID sets the "merchant_id" field.
func (*MerchantUpdateOne) SetMobile ¶
func (muo *MerchantUpdateOne) SetMobile(s string) *MerchantUpdateOne
SetMobile sets the "mobile" field.
func (*MerchantUpdateOne) SetName ¶
func (muo *MerchantUpdateOne) SetName(s string) *MerchantUpdateOne
SetName sets the "name" field.
func (*MerchantUpdateOne) SetNillableCreateAt ¶
func (muo *MerchantUpdateOne) SetNillableCreateAt(t *time.Time) *MerchantUpdateOne
SetNillableCreateAt sets the "create_at" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillableEmail ¶
func (muo *MerchantUpdateOne) SetNillableEmail(s *string) *MerchantUpdateOne
SetNillableEmail sets the "email" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillableMerchantID ¶
func (muo *MerchantUpdateOne) SetNillableMerchantID(u *uint64) *MerchantUpdateOne
SetNillableMerchantID sets the "merchant_id" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillableMobile ¶
func (muo *MerchantUpdateOne) SetNillableMobile(s *string) *MerchantUpdateOne
SetNillableMobile sets the "mobile" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillableName ¶
func (muo *MerchantUpdateOne) SetNillableName(s *string) *MerchantUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillablePassword ¶
func (muo *MerchantUpdateOne) SetNillablePassword(s *string) *MerchantUpdateOne
SetNillablePassword sets the "password" field if the given value is not nil.
func (*MerchantUpdateOne) SetNillableSalt ¶
func (muo *MerchantUpdateOne) SetNillableSalt(s *string) *MerchantUpdateOne
SetNillableSalt sets the "salt" field if the given value is not nil.
func (*MerchantUpdateOne) SetPassword ¶
func (muo *MerchantUpdateOne) SetPassword(s string) *MerchantUpdateOne
SetPassword sets the "password" field.
func (*MerchantUpdateOne) SetSalt ¶
func (muo *MerchantUpdateOne) SetSalt(s string) *MerchantUpdateOne
SetSalt sets the "salt" field.
func (*MerchantUpdateOne) Where ¶
func (muo *MerchantUpdateOne) Where(ps ...predicate.Merchant) *MerchantUpdateOne
Where appends a list predicates to the MerchantUpdate builder.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
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 ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(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 ¶
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 Tx ¶
type Tx struct { // Merchant is the client for interacting with the Merchant builders. Merchant *MerchantClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field 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.