ent

package
v0.0.0-...-a2c21a8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeCustomer = "Customer"
	TypeWechat   = "Wechat"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

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

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Customer is the client for interacting with the Customer builders.
	Customer *CustomerClient
	// Wechat is the client for interacting with the Wechat builders.
	Wechat *WechatClient
	// 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().
	Customer.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Committer method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Customer

type Customer struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Sex holds the value of the "sex" field.
	// 性别
	Sex customer.Sex `json:"sex,omitempty"`
	// UUID holds the value of the "uuid" field.
	// uuid
	UUID uuid.UUID `json:"uuid,omitempty"`
	// Account holds the value of the "account" field.
	//  账号
	Account string `json:"account,omitempty"`
	// Avatar holds the value of the "avatar" field.
	//  avatar
	Avatar string `json:"avatar,omitempty"`
	// Name holds the value of the "name" field.
	// 名称
	Name string `json:"name,omitempty"`
	// NickName holds the value of the "nick_name" field.
	// 昵称
	NickName string `json:"nick_name,omitempty"`
	// Email holds the value of the "email" field.
	// 邮箱
	Email string `json:"email,omitempty"`
	// Mobile holds the value of the "mobile" field.
	// 手机号
	Mobile string `json:"mobile,omitempty"`
	// IDCard holds the value of the "id_card" field.
	// 身份证
	IDCard string `json:"id_card,omitempty"`
	// Birthday holds the value of the "birthday" field.
	// 生日
	Birthday time.Time `json:"birthday,omitempty"`
	// Password holds the value of the "password" field.
	// 密码
	Password string `json:"password,omitempty"`
	// Salt holds the value of the "salt" field.
	// 加密盐
	Salt string `json:"salt,omitempty"`
	// LastIP holds the value of the "last_ip" field.
	// 最后登陆ip
	LastIP string `json:"last_ip,omitempty"`
	// LastTime holds the value of the "last_time" field.
	// 最后登陆时间
	LastTime time.Time `json:"last_time,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CustomerQuery when eager-loading is set.
	Edges CustomerEdges `json:"edges"`
	// contains filtered or unexported fields
}

Customer is the model entity for the Customer schema.

func (*Customer) QueryWechats

func (c *Customer) QueryWechats() *WechatQuery

QueryWechats queries the "wechats" edge of the Customer entity.

func (*Customer) String

func (c *Customer) String() string

String implements the fmt.Stringer.

func (*Customer) Unwrap

func (c *Customer) Unwrap() *Customer

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

func (c *Customer) Update() *CustomerUpdateOne

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

type CustomerClient

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

CustomerClient is a client for the Customer schema.

func NewCustomerClient

func NewCustomerClient(c config) *CustomerClient

NewCustomerClient returns a client for the Customer from the given config.

func (*CustomerClient) Create

func (c *CustomerClient) Create() *CustomerCreate

Create returns a create builder for Customer.

func (*CustomerClient) CreateBulk

func (c *CustomerClient) CreateBulk(builders ...*CustomerCreate) *CustomerCreateBulk

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

func (*CustomerClient) Delete

func (c *CustomerClient) Delete() *CustomerDelete

Delete returns a delete builder for Customer.

func (*CustomerClient) DeleteOne

func (c *CustomerClient) DeleteOne(cu *Customer) *CustomerDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CustomerClient) DeleteOneID

func (c *CustomerClient) DeleteOneID(id int64) *CustomerDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CustomerClient) Get

func (c *CustomerClient) Get(ctx context.Context, id int64) (*Customer, error)

Get returns a Customer entity by its id.

func (*CustomerClient) GetX

func (c *CustomerClient) GetX(ctx context.Context, id int64) *Customer

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

func (*CustomerClient) Hooks

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

Hooks returns the client hooks.

func (*CustomerClient) Query

func (c *CustomerClient) Query() *CustomerQuery

Query returns a query builder for Customer.

func (*CustomerClient) QueryWechats

func (c *CustomerClient) QueryWechats(cu *Customer) *WechatQuery

QueryWechats queries the wechats edge of a Customer.

func (*CustomerClient) Update

func (c *CustomerClient) Update() *CustomerUpdate

Update returns an update builder for Customer.

func (*CustomerClient) UpdateOne

func (c *CustomerClient) UpdateOne(cu *Customer) *CustomerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CustomerClient) UpdateOneID

func (c *CustomerClient) UpdateOneID(id int64) *CustomerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CustomerClient) Use

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

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

type CustomerCreate

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

CustomerCreate is the builder for creating a Customer entity.

func (*CustomerCreate) AddWechatIDs

func (cc *CustomerCreate) AddWechatIDs(ids ...int) *CustomerCreate

AddWechatIDs adds the "wechats" edge to the Wechat entity by IDs.

func (*CustomerCreate) AddWechats

func (cc *CustomerCreate) AddWechats(w ...*Wechat) *CustomerCreate

AddWechats adds the "wechats" edges to the Wechat entity.

func (*CustomerCreate) Mutation

func (cc *CustomerCreate) Mutation() *CustomerMutation

Mutation returns the CustomerMutation object of the builder.

func (*CustomerCreate) Save

func (cc *CustomerCreate) Save(ctx context.Context) (*Customer, error)

Save creates the Customer in the database.

func (*CustomerCreate) SaveX

func (cc *CustomerCreate) SaveX(ctx context.Context) *Customer

SaveX calls Save and panics if Save returns an error.

func (*CustomerCreate) SetAccount

func (cc *CustomerCreate) SetAccount(s string) *CustomerCreate

SetAccount sets the "account" field.

func (*CustomerCreate) SetAvatar

func (cc *CustomerCreate) SetAvatar(s string) *CustomerCreate

SetAvatar sets the "avatar" field.

func (*CustomerCreate) SetBirthday

func (cc *CustomerCreate) SetBirthday(t time.Time) *CustomerCreate

SetBirthday sets the "birthday" field.

func (*CustomerCreate) SetCreateTime

func (cc *CustomerCreate) SetCreateTime(t time.Time) *CustomerCreate

SetCreateTime sets the "create_time" field.

func (*CustomerCreate) SetEmail

func (cc *CustomerCreate) SetEmail(s string) *CustomerCreate

SetEmail sets the "email" field.

func (*CustomerCreate) SetID

func (cc *CustomerCreate) SetID(i int64) *CustomerCreate

SetID sets the "id" field.

func (*CustomerCreate) SetIDCard

func (cc *CustomerCreate) SetIDCard(s string) *CustomerCreate

SetIDCard sets the "id_card" field.

func (*CustomerCreate) SetLastIP

func (cc *CustomerCreate) SetLastIP(s string) *CustomerCreate

SetLastIP sets the "last_ip" field.

func (*CustomerCreate) SetLastTime

func (cc *CustomerCreate) SetLastTime(t time.Time) *CustomerCreate

SetLastTime sets the "last_time" field.

func (*CustomerCreate) SetMobile

func (cc *CustomerCreate) SetMobile(s string) *CustomerCreate

SetMobile sets the "mobile" field.

func (*CustomerCreate) SetName

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

SetName sets the "name" field.

func (*CustomerCreate) SetNickName

func (cc *CustomerCreate) SetNickName(s string) *CustomerCreate

SetNickName sets the "nick_name" field.

func (*CustomerCreate) SetNillableAvatar

func (cc *CustomerCreate) SetNillableAvatar(s *string) *CustomerCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*CustomerCreate) SetNillableBirthday

func (cc *CustomerCreate) SetNillableBirthday(t *time.Time) *CustomerCreate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*CustomerCreate) SetNillableCreateTime

func (cc *CustomerCreate) SetNillableCreateTime(t *time.Time) *CustomerCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*CustomerCreate) SetNillableIDCard

func (cc *CustomerCreate) SetNillableIDCard(s *string) *CustomerCreate

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*CustomerCreate) SetNillableLastIP

func (cc *CustomerCreate) SetNillableLastIP(s *string) *CustomerCreate

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*CustomerCreate) SetNillableLastTime

func (cc *CustomerCreate) SetNillableLastTime(t *time.Time) *CustomerCreate

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*CustomerCreate) SetNillableMobile

func (cc *CustomerCreate) SetNillableMobile(s *string) *CustomerCreate

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*CustomerCreate) SetNillableName

func (cc *CustomerCreate) SetNillableName(s *string) *CustomerCreate

SetNillableName sets the "name" field if the given value is not nil.

func (*CustomerCreate) SetNillableNickName

func (cc *CustomerCreate) SetNillableNickName(s *string) *CustomerCreate

SetNillableNickName sets the "nick_name" field if the given value is not nil.

func (*CustomerCreate) SetNillableSex

func (cc *CustomerCreate) SetNillableSex(c *customer.Sex) *CustomerCreate

SetNillableSex sets the "sex" field if the given value is not nil.

func (*CustomerCreate) SetNillableUpdateTime

func (cc *CustomerCreate) SetNillableUpdateTime(t *time.Time) *CustomerCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*CustomerCreate) SetPassword

func (cc *CustomerCreate) SetPassword(s string) *CustomerCreate

SetPassword sets the "password" field.

func (*CustomerCreate) SetSalt

func (cc *CustomerCreate) SetSalt(s string) *CustomerCreate

SetSalt sets the "salt" field.

func (*CustomerCreate) SetSex

func (cc *CustomerCreate) SetSex(c customer.Sex) *CustomerCreate

SetSex sets the "sex" field.

func (*CustomerCreate) SetUUID

func (cc *CustomerCreate) SetUUID(u uuid.UUID) *CustomerCreate

SetUUID sets the "uuid" field.

func (*CustomerCreate) SetUpdateTime

func (cc *CustomerCreate) SetUpdateTime(t time.Time) *CustomerCreate

SetUpdateTime sets the "update_time" field.

type CustomerCreateBulk

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

CustomerCreateBulk is the builder for creating many Customer entities in bulk.

func (*CustomerCreateBulk) Save

func (ccb *CustomerCreateBulk) Save(ctx context.Context) ([]*Customer, error)

Save creates the Customer entities in the database.

func (*CustomerCreateBulk) SaveX

func (ccb *CustomerCreateBulk) SaveX(ctx context.Context) []*Customer

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

type CustomerDelete

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

CustomerDelete is the builder for deleting a Customer entity.

func (*CustomerDelete) Exec

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

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

func (*CustomerDelete) ExecX

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

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

func (*CustomerDelete) Where

func (cd *CustomerDelete) Where(ps ...predicate.Customer) *CustomerDelete

Where adds a new predicate to the CustomerDelete builder.

type CustomerDeleteOne

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

CustomerDeleteOne is the builder for deleting a single Customer entity.

func (*CustomerDeleteOne) Exec

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

Exec executes the deletion query.

func (*CustomerDeleteOne) ExecX

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

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

type CustomerEdges

type CustomerEdges struct {
	// Wechats holds the value of the wechats edge.
	Wechats []*Wechat `json:"wechats,omitempty"`
	// contains filtered or unexported fields
}

CustomerEdges holds the relations/edges for other nodes in the graph.

func (CustomerEdges) WechatsOrErr

func (e CustomerEdges) WechatsOrErr() ([]*Wechat, error)

WechatsOrErr returns the Wechats value or an error if the edge was not loaded in eager-loading.

type CustomerGroupBy

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

CustomerGroupBy is the group-by builder for Customer entities.

func (*CustomerGroupBy) Aggregate

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

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

func (*CustomerGroupBy) Bool

func (cgb *CustomerGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CustomerGroupBy) BoolX

func (cgb *CustomerGroupBy) BoolX(ctx context.Context) bool

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

func (*CustomerGroupBy) Bools

func (cgb *CustomerGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*CustomerGroupBy) BoolsX

func (cgb *CustomerGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CustomerGroupBy) Float64

func (cgb *CustomerGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CustomerGroupBy) Float64X

func (cgb *CustomerGroupBy) Float64X(ctx context.Context) float64

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

func (*CustomerGroupBy) Float64s

func (cgb *CustomerGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*CustomerGroupBy) Float64sX

func (cgb *CustomerGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CustomerGroupBy) Int

func (cgb *CustomerGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CustomerGroupBy) IntX

func (cgb *CustomerGroupBy) IntX(ctx context.Context) int

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

func (*CustomerGroupBy) Ints

func (cgb *CustomerGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*CustomerGroupBy) IntsX

func (cgb *CustomerGroupBy) IntsX(ctx context.Context) []int

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

func (*CustomerGroupBy) Scan

func (cgb *CustomerGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CustomerGroupBy) ScanX

func (cgb *CustomerGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CustomerGroupBy) String

func (cgb *CustomerGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CustomerGroupBy) StringX

func (cgb *CustomerGroupBy) StringX(ctx context.Context) string

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

func (*CustomerGroupBy) Strings

func (cgb *CustomerGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CustomerGroupBy) StringsX

func (cgb *CustomerGroupBy) StringsX(ctx context.Context) []string

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

type CustomerMutation

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

CustomerMutation represents an operation that mutates the Customer nodes in the graph.

func (*CustomerMutation) Account

func (m *CustomerMutation) Account() (r string, exists bool)

Account returns the value of the "account" field in the mutation.

func (*CustomerMutation) AddField

func (m *CustomerMutation) 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 (*CustomerMutation) AddWechatIDs

func (m *CustomerMutation) AddWechatIDs(ids ...int)

AddWechatIDs adds the "wechats" edge to the Wechat entity by ids.

func (*CustomerMutation) AddedEdges

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

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

func (*CustomerMutation) AddedField

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

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

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

func (*CustomerMutation) AddedIDs

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

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

func (*CustomerMutation) Avatar

func (m *CustomerMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*CustomerMutation) AvatarCleared

func (m *CustomerMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*CustomerMutation) Birthday

func (m *CustomerMutation) Birthday() (r time.Time, exists bool)

Birthday returns the value of the "birthday" field in the mutation.

func (*CustomerMutation) BirthdayCleared

func (m *CustomerMutation) BirthdayCleared() bool

BirthdayCleared returns if the "birthday" field was cleared in this mutation.

func (*CustomerMutation) ClearAvatar

func (m *CustomerMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*CustomerMutation) ClearBirthday

func (m *CustomerMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*CustomerMutation) ClearEdge

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

func (m *CustomerMutation) 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 (*CustomerMutation) ClearIDCard

func (m *CustomerMutation) ClearIDCard()

ClearIDCard clears the value of the "id_card" field.

func (*CustomerMutation) ClearLastIP

func (m *CustomerMutation) ClearLastIP()

ClearLastIP clears the value of the "last_ip" field.

func (*CustomerMutation) ClearLastTime

func (m *CustomerMutation) ClearLastTime()

ClearLastTime clears the value of the "last_time" field.

func (*CustomerMutation) ClearMobile

func (m *CustomerMutation) ClearMobile()

ClearMobile clears the value of the "mobile" field.

func (*CustomerMutation) ClearName

func (m *CustomerMutation) ClearName()

ClearName clears the value of the "name" field.

func (*CustomerMutation) ClearNickName

func (m *CustomerMutation) ClearNickName()

ClearNickName clears the value of the "nick_name" field.

func (*CustomerMutation) ClearWechats

func (m *CustomerMutation) ClearWechats()

ClearWechats clears the "wechats" edge to the Wechat entity.

func (*CustomerMutation) ClearedEdges

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

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

func (*CustomerMutation) ClearedFields

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

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

func (CustomerMutation) Client

func (m CustomerMutation) 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 (*CustomerMutation) CreateTime

func (m *CustomerMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*CustomerMutation) EdgeCleared

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

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

func (*CustomerMutation) Email

func (m *CustomerMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*CustomerMutation) Field

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

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

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

func (*CustomerMutation) Fields

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

func (m *CustomerMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*CustomerMutation) IDCard

func (m *CustomerMutation) IDCard() (r string, exists bool)

IDCard returns the value of the "id_card" field in the mutation.

func (*CustomerMutation) IDCardCleared

func (m *CustomerMutation) IDCardCleared() bool

IDCardCleared returns if the "id_card" field was cleared in this mutation.

func (*CustomerMutation) LastIP

func (m *CustomerMutation) LastIP() (r string, exists bool)

LastIP returns the value of the "last_ip" field in the mutation.

func (*CustomerMutation) LastIPCleared

func (m *CustomerMutation) LastIPCleared() bool

LastIPCleared returns if the "last_ip" field was cleared in this mutation.

func (*CustomerMutation) LastTime

func (m *CustomerMutation) LastTime() (r time.Time, exists bool)

LastTime returns the value of the "last_time" field in the mutation.

func (*CustomerMutation) LastTimeCleared

func (m *CustomerMutation) LastTimeCleared() bool

LastTimeCleared returns if the "last_time" field was cleared in this mutation.

func (*CustomerMutation) Mobile

func (m *CustomerMutation) Mobile() (r string, exists bool)

Mobile returns the value of the "mobile" field in the mutation.

func (*CustomerMutation) MobileCleared

func (m *CustomerMutation) MobileCleared() bool

MobileCleared returns if the "mobile" field was cleared in this mutation.

func (*CustomerMutation) Name

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

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

func (*CustomerMutation) NameCleared

func (m *CustomerMutation) NameCleared() bool

NameCleared returns if the "name" field was cleared in this mutation.

func (*CustomerMutation) NickName

func (m *CustomerMutation) NickName() (r string, exists bool)

NickName returns the value of the "nick_name" field in the mutation.

func (*CustomerMutation) NickNameCleared

func (m *CustomerMutation) NickNameCleared() bool

NickNameCleared returns if the "nick_name" field was cleared in this mutation.

func (*CustomerMutation) OldAccount

func (m *CustomerMutation) OldAccount(ctx context.Context) (v string, err error)

OldAccount returns the old "account" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldAvatar

func (m *CustomerMutation) OldAvatar(ctx context.Context) (v string, err error)

OldAvatar returns the old "avatar" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldBirthday

func (m *CustomerMutation) OldBirthday(ctx context.Context) (v time.Time, err error)

OldBirthday returns the old "birthday" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldCreateTime

func (m *CustomerMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldEmail

func (m *CustomerMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldField

func (m *CustomerMutation) 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 (*CustomerMutation) OldIDCard

func (m *CustomerMutation) OldIDCard(ctx context.Context) (v string, err error)

OldIDCard returns the old "id_card" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldLastIP

func (m *CustomerMutation) OldLastIP(ctx context.Context) (v string, err error)

OldLastIP returns the old "last_ip" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldLastTime

func (m *CustomerMutation) OldLastTime(ctx context.Context) (v time.Time, err error)

OldLastTime returns the old "last_time" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldMobile

func (m *CustomerMutation) OldMobile(ctx context.Context) (v string, err error)

OldMobile returns the old "mobile" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldName

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

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

func (m *CustomerMutation) OldNickName(ctx context.Context) (v string, err error)

OldNickName returns the old "nick_name" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldPassword

func (m *CustomerMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldSalt

func (m *CustomerMutation) OldSalt(ctx context.Context) (v string, err error)

OldSalt returns the old "salt" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldSex

func (m *CustomerMutation) OldSex(ctx context.Context) (v customer.Sex, err error)

OldSex returns the old "sex" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldUUID

func (m *CustomerMutation) OldUUID(ctx context.Context) (v uuid.UUID, err error)

OldUUID returns the old "uuid" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) OldUpdateTime

func (m *CustomerMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Customer entity. If the Customer 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 (*CustomerMutation) Op

func (m *CustomerMutation) Op() Op

Op returns the operation name.

func (*CustomerMutation) Password

func (m *CustomerMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*CustomerMutation) RemoveWechatIDs

func (m *CustomerMutation) RemoveWechatIDs(ids ...int)

RemoveWechatIDs removes the "wechats" edge to the Wechat entity by IDs.

func (*CustomerMutation) RemovedEdges

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

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

func (*CustomerMutation) RemovedIDs

func (m *CustomerMutation) 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 (*CustomerMutation) RemovedWechatsIDs

func (m *CustomerMutation) RemovedWechatsIDs() (ids []int)

RemovedWechats returns the removed IDs of the "wechats" edge to the Wechat entity.

func (*CustomerMutation) ResetAccount

func (m *CustomerMutation) ResetAccount()

ResetAccount resets all changes to the "account" field.

func (*CustomerMutation) ResetAvatar

func (m *CustomerMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*CustomerMutation) ResetBirthday

func (m *CustomerMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*CustomerMutation) ResetCreateTime

func (m *CustomerMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*CustomerMutation) ResetEdge

func (m *CustomerMutation) 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 (*CustomerMutation) ResetEmail

func (m *CustomerMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*CustomerMutation) ResetField

func (m *CustomerMutation) 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 (*CustomerMutation) ResetIDCard

func (m *CustomerMutation) ResetIDCard()

ResetIDCard resets all changes to the "id_card" field.

func (*CustomerMutation) ResetLastIP

func (m *CustomerMutation) ResetLastIP()

ResetLastIP resets all changes to the "last_ip" field.

func (*CustomerMutation) ResetLastTime

func (m *CustomerMutation) ResetLastTime()

ResetLastTime resets all changes to the "last_time" field.

func (*CustomerMutation) ResetMobile

func (m *CustomerMutation) ResetMobile()

ResetMobile resets all changes to the "mobile" field.

func (*CustomerMutation) ResetName

func (m *CustomerMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CustomerMutation) ResetNickName

func (m *CustomerMutation) ResetNickName()

ResetNickName resets all changes to the "nick_name" field.

func (*CustomerMutation) ResetPassword

func (m *CustomerMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*CustomerMutation) ResetSalt

func (m *CustomerMutation) ResetSalt()

ResetSalt resets all changes to the "salt" field.

func (*CustomerMutation) ResetSex

func (m *CustomerMutation) ResetSex()

ResetSex resets all changes to the "sex" field.

func (*CustomerMutation) ResetUUID

func (m *CustomerMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*CustomerMutation) ResetUpdateTime

func (m *CustomerMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*CustomerMutation) ResetWechats

func (m *CustomerMutation) ResetWechats()

ResetWechats resets all changes to the "wechats" edge.

func (*CustomerMutation) Salt

func (m *CustomerMutation) Salt() (r string, exists bool)

Salt returns the value of the "salt" field in the mutation.

func (*CustomerMutation) SetAccount

func (m *CustomerMutation) SetAccount(s string)

SetAccount sets the "account" field.

func (*CustomerMutation) SetAvatar

func (m *CustomerMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*CustomerMutation) SetBirthday

func (m *CustomerMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*CustomerMutation) SetCreateTime

func (m *CustomerMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*CustomerMutation) SetEmail

func (m *CustomerMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*CustomerMutation) SetField

func (m *CustomerMutation) 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 (*CustomerMutation) SetID

func (m *CustomerMutation) SetID(id int64)

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

func (*CustomerMutation) SetIDCard

func (m *CustomerMutation) SetIDCard(s string)

SetIDCard sets the "id_card" field.

func (*CustomerMutation) SetLastIP

func (m *CustomerMutation) SetLastIP(s string)

SetLastIP sets the "last_ip" field.

func (*CustomerMutation) SetLastTime

func (m *CustomerMutation) SetLastTime(t time.Time)

SetLastTime sets the "last_time" field.

func (*CustomerMutation) SetMobile

func (m *CustomerMutation) SetMobile(s string)

SetMobile sets the "mobile" field.

func (*CustomerMutation) SetName

func (m *CustomerMutation) SetName(s string)

SetName sets the "name" field.

func (*CustomerMutation) SetNickName

func (m *CustomerMutation) SetNickName(s string)

SetNickName sets the "nick_name" field.

func (*CustomerMutation) SetPassword

func (m *CustomerMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*CustomerMutation) SetSalt

func (m *CustomerMutation) SetSalt(s string)

SetSalt sets the "salt" field.

func (*CustomerMutation) SetSex

func (m *CustomerMutation) SetSex(c customer.Sex)

SetSex sets the "sex" field.

func (*CustomerMutation) SetUUID

func (m *CustomerMutation) SetUUID(u uuid.UUID)

SetUUID sets the "uuid" field.

func (*CustomerMutation) SetUpdateTime

func (m *CustomerMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*CustomerMutation) Sex

func (m *CustomerMutation) Sex() (r customer.Sex, exists bool)

Sex returns the value of the "sex" field in the mutation.

func (CustomerMutation) Tx

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

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

func (*CustomerMutation) Type

func (m *CustomerMutation) Type() string

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

func (*CustomerMutation) UUID

func (m *CustomerMutation) UUID() (r uuid.UUID, exists bool)

UUID returns the value of the "uuid" field in the mutation.

func (*CustomerMutation) UpdateTime

func (m *CustomerMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*CustomerMutation) WechatsCleared

func (m *CustomerMutation) WechatsCleared() bool

WechatsCleared returns if the "wechats" edge to the Wechat entity was cleared.

func (*CustomerMutation) WechatsIDs

func (m *CustomerMutation) WechatsIDs() (ids []int)

WechatsIDs returns the "wechats" edge IDs in the mutation.

type CustomerQuery

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

CustomerQuery is the builder for querying Customer entities.

func (*CustomerQuery) All

func (cq *CustomerQuery) All(ctx context.Context) ([]*Customer, error)

All executes the query and returns a list of Customers.

func (*CustomerQuery) AllX

func (cq *CustomerQuery) AllX(ctx context.Context) []*Customer

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

func (*CustomerQuery) Clone

func (cq *CustomerQuery) Clone() *CustomerQuery

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

func (*CustomerQuery) Count

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

Count returns the count of the given query.

func (*CustomerQuery) CountX

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

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

func (*CustomerQuery) Exist

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

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

func (*CustomerQuery) ExistX

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

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

func (*CustomerQuery) First

func (cq *CustomerQuery) First(ctx context.Context) (*Customer, error)

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

func (*CustomerQuery) FirstID

func (cq *CustomerQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*CustomerQuery) FirstIDX

func (cq *CustomerQuery) FirstIDX(ctx context.Context) int64

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

func (*CustomerQuery) FirstX

func (cq *CustomerQuery) FirstX(ctx context.Context) *Customer

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

func (*CustomerQuery) GroupBy

func (cq *CustomerQuery) GroupBy(field string, fields ...string) *CustomerGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Customer.Query().
	GroupBy(customer.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CustomerQuery) IDs

func (cq *CustomerQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*CustomerQuery) IDsX

func (cq *CustomerQuery) IDsX(ctx context.Context) []int64

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

func (*CustomerQuery) Limit

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

Limit adds a limit step to the query.

func (*CustomerQuery) Offset

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

Offset adds an offset step to the query.

func (*CustomerQuery) Only

func (cq *CustomerQuery) Only(ctx context.Context) (*Customer, error)

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

func (*CustomerQuery) OnlyID

func (cq *CustomerQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*CustomerQuery) OnlyIDX

func (cq *CustomerQuery) OnlyIDX(ctx context.Context) int64

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

func (*CustomerQuery) OnlyX

func (cq *CustomerQuery) OnlyX(ctx context.Context) *Customer

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

func (*CustomerQuery) Order

func (cq *CustomerQuery) Order(o ...OrderFunc) *CustomerQuery

Order adds an order step to the query.

func (*CustomerQuery) QueryWechats

func (cq *CustomerQuery) QueryWechats() *WechatQuery

QueryWechats chains the current query on the "wechats" edge.

func (*CustomerQuery) Select

func (cq *CustomerQuery) Select(field string, fields ...string) *CustomerSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Customer.Query().
	Select(customer.FieldCreateTime).
	Scan(ctx, &v)

func (*CustomerQuery) Where

func (cq *CustomerQuery) Where(ps ...predicate.Customer) *CustomerQuery

Where adds a new predicate for the CustomerQuery builder.

func (*CustomerQuery) WithWechats

func (cq *CustomerQuery) WithWechats(opts ...func(*WechatQuery)) *CustomerQuery

WithWechats tells the query-builder to eager-load the nodes that are connected to the "wechats" edge. The optional arguments are used to configure the query builder of the edge.

type CustomerSelect

type CustomerSelect struct {
	*CustomerQuery
	// contains filtered or unexported fields
}

CustomerSelect is the builder for selecting fields of Customer entities.

func (*CustomerSelect) Bool

func (cs *CustomerSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CustomerSelect) BoolX

func (cs *CustomerSelect) BoolX(ctx context.Context) bool

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

func (*CustomerSelect) Bools

func (cs *CustomerSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CustomerSelect) BoolsX

func (cs *CustomerSelect) BoolsX(ctx context.Context) []bool

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

func (*CustomerSelect) Float64

func (cs *CustomerSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CustomerSelect) Float64X

func (cs *CustomerSelect) Float64X(ctx context.Context) float64

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

func (*CustomerSelect) Float64s

func (cs *CustomerSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CustomerSelect) Float64sX

func (cs *CustomerSelect) Float64sX(ctx context.Context) []float64

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

func (*CustomerSelect) Int

func (cs *CustomerSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CustomerSelect) IntX

func (cs *CustomerSelect) IntX(ctx context.Context) int

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

func (*CustomerSelect) Ints

func (cs *CustomerSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CustomerSelect) IntsX

func (cs *CustomerSelect) IntsX(ctx context.Context) []int

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

func (*CustomerSelect) Scan

func (cs *CustomerSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CustomerSelect) ScanX

func (cs *CustomerSelect) ScanX(ctx context.Context, v interface{})

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

func (*CustomerSelect) String

func (cs *CustomerSelect) String(ctx context.Context) (_ string, err error)

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

func (*CustomerSelect) StringX

func (cs *CustomerSelect) StringX(ctx context.Context) string

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

func (*CustomerSelect) Strings

func (cs *CustomerSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CustomerSelect) StringsX

func (cs *CustomerSelect) StringsX(ctx context.Context) []string

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

type CustomerUpdate

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

CustomerUpdate is the builder for updating Customer entities.

func (*CustomerUpdate) AddWechatIDs

func (cu *CustomerUpdate) AddWechatIDs(ids ...int) *CustomerUpdate

AddWechatIDs adds the "wechats" edge to the Wechat entity by IDs.

func (*CustomerUpdate) AddWechats

func (cu *CustomerUpdate) AddWechats(w ...*Wechat) *CustomerUpdate

AddWechats adds the "wechats" edges to the Wechat entity.

func (*CustomerUpdate) ClearAvatar

func (cu *CustomerUpdate) ClearAvatar() *CustomerUpdate

ClearAvatar clears the value of the "avatar" field.

func (*CustomerUpdate) ClearBirthday

func (cu *CustomerUpdate) ClearBirthday() *CustomerUpdate

ClearBirthday clears the value of the "birthday" field.

func (*CustomerUpdate) ClearIDCard

func (cu *CustomerUpdate) ClearIDCard() *CustomerUpdate

ClearIDCard clears the value of the "id_card" field.

func (*CustomerUpdate) ClearLastIP

func (cu *CustomerUpdate) ClearLastIP() *CustomerUpdate

ClearLastIP clears the value of the "last_ip" field.

func (*CustomerUpdate) ClearLastTime

func (cu *CustomerUpdate) ClearLastTime() *CustomerUpdate

ClearLastTime clears the value of the "last_time" field.

func (*CustomerUpdate) ClearMobile

func (cu *CustomerUpdate) ClearMobile() *CustomerUpdate

ClearMobile clears the value of the "mobile" field.

func (*CustomerUpdate) ClearName

func (cu *CustomerUpdate) ClearName() *CustomerUpdate

ClearName clears the value of the "name" field.

func (*CustomerUpdate) ClearNickName

func (cu *CustomerUpdate) ClearNickName() *CustomerUpdate

ClearNickName clears the value of the "nick_name" field.

func (*CustomerUpdate) ClearWechats

func (cu *CustomerUpdate) ClearWechats() *CustomerUpdate

ClearWechats clears all "wechats" edges to the Wechat entity.

func (*CustomerUpdate) Exec

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

Exec executes the query.

func (*CustomerUpdate) ExecX

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

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

func (*CustomerUpdate) Mutation

func (cu *CustomerUpdate) Mutation() *CustomerMutation

Mutation returns the CustomerMutation object of the builder.

func (*CustomerUpdate) RemoveWechatIDs

func (cu *CustomerUpdate) RemoveWechatIDs(ids ...int) *CustomerUpdate

RemoveWechatIDs removes the "wechats" edge to Wechat entities by IDs.

func (*CustomerUpdate) RemoveWechats

func (cu *CustomerUpdate) RemoveWechats(w ...*Wechat) *CustomerUpdate

RemoveWechats removes "wechats" edges to Wechat entities.

func (*CustomerUpdate) Save

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

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

func (*CustomerUpdate) SaveX

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

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

func (*CustomerUpdate) SetAccount

func (cu *CustomerUpdate) SetAccount(s string) *CustomerUpdate

SetAccount sets the "account" field.

func (*CustomerUpdate) SetAvatar

func (cu *CustomerUpdate) SetAvatar(s string) *CustomerUpdate

SetAvatar sets the "avatar" field.

func (*CustomerUpdate) SetBirthday

func (cu *CustomerUpdate) SetBirthday(t time.Time) *CustomerUpdate

SetBirthday sets the "birthday" field.

func (*CustomerUpdate) SetEmail

func (cu *CustomerUpdate) SetEmail(s string) *CustomerUpdate

SetEmail sets the "email" field.

func (*CustomerUpdate) SetIDCard

func (cu *CustomerUpdate) SetIDCard(s string) *CustomerUpdate

SetIDCard sets the "id_card" field.

func (*CustomerUpdate) SetLastIP

func (cu *CustomerUpdate) SetLastIP(s string) *CustomerUpdate

SetLastIP sets the "last_ip" field.

func (*CustomerUpdate) SetLastTime

func (cu *CustomerUpdate) SetLastTime(t time.Time) *CustomerUpdate

SetLastTime sets the "last_time" field.

func (*CustomerUpdate) SetMobile

func (cu *CustomerUpdate) SetMobile(s string) *CustomerUpdate

SetMobile sets the "mobile" field.

func (*CustomerUpdate) SetName

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

SetName sets the "name" field.

func (*CustomerUpdate) SetNickName

func (cu *CustomerUpdate) SetNickName(s string) *CustomerUpdate

SetNickName sets the "nick_name" field.

func (*CustomerUpdate) SetNillableAvatar

func (cu *CustomerUpdate) SetNillableAvatar(s *string) *CustomerUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*CustomerUpdate) SetNillableBirthday

func (cu *CustomerUpdate) SetNillableBirthday(t *time.Time) *CustomerUpdate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*CustomerUpdate) SetNillableIDCard

func (cu *CustomerUpdate) SetNillableIDCard(s *string) *CustomerUpdate

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*CustomerUpdate) SetNillableLastIP

func (cu *CustomerUpdate) SetNillableLastIP(s *string) *CustomerUpdate

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*CustomerUpdate) SetNillableLastTime

func (cu *CustomerUpdate) SetNillableLastTime(t *time.Time) *CustomerUpdate

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*CustomerUpdate) SetNillableMobile

func (cu *CustomerUpdate) SetNillableMobile(s *string) *CustomerUpdate

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*CustomerUpdate) SetNillableName

func (cu *CustomerUpdate) SetNillableName(s *string) *CustomerUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*CustomerUpdate) SetNillableNickName

func (cu *CustomerUpdate) SetNillableNickName(s *string) *CustomerUpdate

SetNillableNickName sets the "nick_name" field if the given value is not nil.

func (*CustomerUpdate) SetNillableSex

func (cu *CustomerUpdate) SetNillableSex(c *customer.Sex) *CustomerUpdate

SetNillableSex sets the "sex" field if the given value is not nil.

func (*CustomerUpdate) SetPassword

func (cu *CustomerUpdate) SetPassword(s string) *CustomerUpdate

SetPassword sets the "password" field.

func (*CustomerUpdate) SetSalt

func (cu *CustomerUpdate) SetSalt(s string) *CustomerUpdate

SetSalt sets the "salt" field.

func (*CustomerUpdate) SetSex

func (cu *CustomerUpdate) SetSex(c customer.Sex) *CustomerUpdate

SetSex sets the "sex" field.

func (*CustomerUpdate) SetUUID

func (cu *CustomerUpdate) SetUUID(u uuid.UUID) *CustomerUpdate

SetUUID sets the "uuid" field.

func (*CustomerUpdate) Where

func (cu *CustomerUpdate) Where(ps ...predicate.Customer) *CustomerUpdate

Where adds a new predicate for the CustomerUpdate builder.

type CustomerUpdateOne

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

CustomerUpdateOne is the builder for updating a single Customer entity.

func (*CustomerUpdateOne) AddWechatIDs

func (cuo *CustomerUpdateOne) AddWechatIDs(ids ...int) *CustomerUpdateOne

AddWechatIDs adds the "wechats" edge to the Wechat entity by IDs.

func (*CustomerUpdateOne) AddWechats

func (cuo *CustomerUpdateOne) AddWechats(w ...*Wechat) *CustomerUpdateOne

AddWechats adds the "wechats" edges to the Wechat entity.

func (*CustomerUpdateOne) ClearAvatar

func (cuo *CustomerUpdateOne) ClearAvatar() *CustomerUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*CustomerUpdateOne) ClearBirthday

func (cuo *CustomerUpdateOne) ClearBirthday() *CustomerUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*CustomerUpdateOne) ClearIDCard

func (cuo *CustomerUpdateOne) ClearIDCard() *CustomerUpdateOne

ClearIDCard clears the value of the "id_card" field.

func (*CustomerUpdateOne) ClearLastIP

func (cuo *CustomerUpdateOne) ClearLastIP() *CustomerUpdateOne

ClearLastIP clears the value of the "last_ip" field.

func (*CustomerUpdateOne) ClearLastTime

func (cuo *CustomerUpdateOne) ClearLastTime() *CustomerUpdateOne

ClearLastTime clears the value of the "last_time" field.

func (*CustomerUpdateOne) ClearMobile

func (cuo *CustomerUpdateOne) ClearMobile() *CustomerUpdateOne

ClearMobile clears the value of the "mobile" field.

func (*CustomerUpdateOne) ClearName

func (cuo *CustomerUpdateOne) ClearName() *CustomerUpdateOne

ClearName clears the value of the "name" field.

func (*CustomerUpdateOne) ClearNickName

func (cuo *CustomerUpdateOne) ClearNickName() *CustomerUpdateOne

ClearNickName clears the value of the "nick_name" field.

func (*CustomerUpdateOne) ClearWechats

func (cuo *CustomerUpdateOne) ClearWechats() *CustomerUpdateOne

ClearWechats clears all "wechats" edges to the Wechat entity.

func (*CustomerUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CustomerUpdateOne) ExecX

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

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

func (*CustomerUpdateOne) Mutation

func (cuo *CustomerUpdateOne) Mutation() *CustomerMutation

Mutation returns the CustomerMutation object of the builder.

func (*CustomerUpdateOne) RemoveWechatIDs

func (cuo *CustomerUpdateOne) RemoveWechatIDs(ids ...int) *CustomerUpdateOne

RemoveWechatIDs removes the "wechats" edge to Wechat entities by IDs.

func (*CustomerUpdateOne) RemoveWechats

func (cuo *CustomerUpdateOne) RemoveWechats(w ...*Wechat) *CustomerUpdateOne

RemoveWechats removes "wechats" edges to Wechat entities.

func (*CustomerUpdateOne) Save

func (cuo *CustomerUpdateOne) Save(ctx context.Context) (*Customer, error)

Save executes the query and returns the updated Customer entity.

func (*CustomerUpdateOne) SaveX

func (cuo *CustomerUpdateOne) SaveX(ctx context.Context) *Customer

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

func (*CustomerUpdateOne) SetAccount

func (cuo *CustomerUpdateOne) SetAccount(s string) *CustomerUpdateOne

SetAccount sets the "account" field.

func (*CustomerUpdateOne) SetAvatar

func (cuo *CustomerUpdateOne) SetAvatar(s string) *CustomerUpdateOne

SetAvatar sets the "avatar" field.

func (*CustomerUpdateOne) SetBirthday

func (cuo *CustomerUpdateOne) SetBirthday(t time.Time) *CustomerUpdateOne

SetBirthday sets the "birthday" field.

func (*CustomerUpdateOne) SetEmail

func (cuo *CustomerUpdateOne) SetEmail(s string) *CustomerUpdateOne

SetEmail sets the "email" field.

func (*CustomerUpdateOne) SetIDCard

func (cuo *CustomerUpdateOne) SetIDCard(s string) *CustomerUpdateOne

SetIDCard sets the "id_card" field.

func (*CustomerUpdateOne) SetLastIP

func (cuo *CustomerUpdateOne) SetLastIP(s string) *CustomerUpdateOne

SetLastIP sets the "last_ip" field.

func (*CustomerUpdateOne) SetLastTime

func (cuo *CustomerUpdateOne) SetLastTime(t time.Time) *CustomerUpdateOne

SetLastTime sets the "last_time" field.

func (*CustomerUpdateOne) SetMobile

func (cuo *CustomerUpdateOne) SetMobile(s string) *CustomerUpdateOne

SetMobile sets the "mobile" field.

func (*CustomerUpdateOne) SetName

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

SetName sets the "name" field.

func (*CustomerUpdateOne) SetNickName

func (cuo *CustomerUpdateOne) SetNickName(s string) *CustomerUpdateOne

SetNickName sets the "nick_name" field.

func (*CustomerUpdateOne) SetNillableAvatar

func (cuo *CustomerUpdateOne) SetNillableAvatar(s *string) *CustomerUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableBirthday

func (cuo *CustomerUpdateOne) SetNillableBirthday(t *time.Time) *CustomerUpdateOne

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableIDCard

func (cuo *CustomerUpdateOne) SetNillableIDCard(s *string) *CustomerUpdateOne

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableLastIP

func (cuo *CustomerUpdateOne) SetNillableLastIP(s *string) *CustomerUpdateOne

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableLastTime

func (cuo *CustomerUpdateOne) SetNillableLastTime(t *time.Time) *CustomerUpdateOne

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableMobile

func (cuo *CustomerUpdateOne) SetNillableMobile(s *string) *CustomerUpdateOne

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableName

func (cuo *CustomerUpdateOne) SetNillableName(s *string) *CustomerUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableNickName

func (cuo *CustomerUpdateOne) SetNillableNickName(s *string) *CustomerUpdateOne

SetNillableNickName sets the "nick_name" field if the given value is not nil.

func (*CustomerUpdateOne) SetNillableSex

func (cuo *CustomerUpdateOne) SetNillableSex(c *customer.Sex) *CustomerUpdateOne

SetNillableSex sets the "sex" field if the given value is not nil.

func (*CustomerUpdateOne) SetPassword

func (cuo *CustomerUpdateOne) SetPassword(s string) *CustomerUpdateOne

SetPassword sets the "password" field.

func (*CustomerUpdateOne) SetSalt

func (cuo *CustomerUpdateOne) SetSalt(s string) *CustomerUpdateOne

SetSalt sets the "salt" field.

func (*CustomerUpdateOne) SetSex

SetSex sets the "sex" field.

func (*CustomerUpdateOne) SetUUID

func (cuo *CustomerUpdateOne) SetUUID(u uuid.UUID) *CustomerUpdateOne

SetUUID sets the "uuid" field.

type Customers

type Customers []*Customer

Customers is a parsable slice of Customer.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

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

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

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

Rollbacker is the interface that wraps the Rollbacker method.

type Tx

type Tx struct {

	// Customer is the client for interacting with the Customer builders.
	Customer *CustomerClient
	// Wechat is the client for interacting with the Wechat builders.
	Wechat *WechatClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

type Wechat

type Wechat struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Openid holds the value of the "openid" field.
	// openid
	Openid string `json:"openid,omitempty"`
	// UnionId holds the value of the "unionId" field.
	// unionId
	UnionId string `json:"unionId,omitempty"`
	// AppType holds the value of the "app_type" field.
	// 类型 小程序 公众号
	AppType wechat.AppType `json:"app_type,omitempty"`
	// MetaData holds the value of the "meta_data" field.
	// 微信原始数据
	MetaData []byte `json:"meta_data,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the WechatQuery when eager-loading is set.
	Edges WechatEdges `json:"edges"`
	// contains filtered or unexported fields
}

Wechat is the model entity for the Wechat schema.

func (*Wechat) QueryCustomers

func (w *Wechat) QueryCustomers() *CustomerQuery

QueryCustomers queries the "customers" edge of the Wechat entity.

func (*Wechat) String

func (w *Wechat) String() string

String implements the fmt.Stringer.

func (*Wechat) Unwrap

func (w *Wechat) Unwrap() *Wechat

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

func (w *Wechat) Update() *WechatUpdateOne

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

type WechatClient

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

WechatClient is a client for the Wechat schema.

func NewWechatClient

func NewWechatClient(c config) *WechatClient

NewWechatClient returns a client for the Wechat from the given config.

func (*WechatClient) Create

func (c *WechatClient) Create() *WechatCreate

Create returns a create builder for Wechat.

func (*WechatClient) CreateBulk

func (c *WechatClient) CreateBulk(builders ...*WechatCreate) *WechatCreateBulk

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

func (*WechatClient) Delete

func (c *WechatClient) Delete() *WechatDelete

Delete returns a delete builder for Wechat.

func (*WechatClient) DeleteOne

func (c *WechatClient) DeleteOne(w *Wechat) *WechatDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*WechatClient) DeleteOneID

func (c *WechatClient) DeleteOneID(id int) *WechatDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*WechatClient) Get

func (c *WechatClient) Get(ctx context.Context, id int) (*Wechat, error)

Get returns a Wechat entity by its id.

func (*WechatClient) GetX

func (c *WechatClient) GetX(ctx context.Context, id int) *Wechat

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

func (*WechatClient) Hooks

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

Hooks returns the client hooks.

func (*WechatClient) Query

func (c *WechatClient) Query() *WechatQuery

Query returns a query builder for Wechat.

func (*WechatClient) QueryCustomers

func (c *WechatClient) QueryCustomers(w *Wechat) *CustomerQuery

QueryCustomers queries the customers edge of a Wechat.

func (*WechatClient) Update

func (c *WechatClient) Update() *WechatUpdate

Update returns an update builder for Wechat.

func (*WechatClient) UpdateOne

func (c *WechatClient) UpdateOne(w *Wechat) *WechatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WechatClient) UpdateOneID

func (c *WechatClient) UpdateOneID(id int) *WechatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WechatClient) Use

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

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

type WechatCreate

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

WechatCreate is the builder for creating a Wechat entity.

func (*WechatCreate) Mutation

func (wc *WechatCreate) Mutation() *WechatMutation

Mutation returns the WechatMutation object of the builder.

func (*WechatCreate) Save

func (wc *WechatCreate) Save(ctx context.Context) (*Wechat, error)

Save creates the Wechat in the database.

func (*WechatCreate) SaveX

func (wc *WechatCreate) SaveX(ctx context.Context) *Wechat

SaveX calls Save and panics if Save returns an error.

func (*WechatCreate) SetAppType

func (wc *WechatCreate) SetAppType(wt wechat.AppType) *WechatCreate

SetAppType sets the "app_type" field.

func (*WechatCreate) SetCreateTime

func (wc *WechatCreate) SetCreateTime(t time.Time) *WechatCreate

SetCreateTime sets the "create_time" field.

func (*WechatCreate) SetCustomers

func (wc *WechatCreate) SetCustomers(c *Customer) *WechatCreate

SetCustomers sets the "customers" edge to the Customer entity.

func (*WechatCreate) SetCustomersID

func (wc *WechatCreate) SetCustomersID(id int64) *WechatCreate

SetCustomersID sets the "customers" edge to the Customer entity by ID.

func (*WechatCreate) SetMetaData

func (wc *WechatCreate) SetMetaData(b []byte) *WechatCreate

SetMetaData sets the "meta_data" field.

func (*WechatCreate) SetNillableCreateTime

func (wc *WechatCreate) SetNillableCreateTime(t *time.Time) *WechatCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*WechatCreate) SetNillableCustomersID

func (wc *WechatCreate) SetNillableCustomersID(id *int64) *WechatCreate

SetNillableCustomersID sets the "customers" edge to the Customer entity by ID if the given value is not nil.

func (*WechatCreate) SetNillableUpdateTime

func (wc *WechatCreate) SetNillableUpdateTime(t *time.Time) *WechatCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*WechatCreate) SetOpenid

func (wc *WechatCreate) SetOpenid(s string) *WechatCreate

SetOpenid sets the "openid" field.

func (*WechatCreate) SetUnionId

func (wc *WechatCreate) SetUnionId(s string) *WechatCreate

SetUnionId sets the "unionId" field.

func (*WechatCreate) SetUpdateTime

func (wc *WechatCreate) SetUpdateTime(t time.Time) *WechatCreate

SetUpdateTime sets the "update_time" field.

type WechatCreateBulk

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

WechatCreateBulk is the builder for creating many Wechat entities in bulk.

func (*WechatCreateBulk) Save

func (wcb *WechatCreateBulk) Save(ctx context.Context) ([]*Wechat, error)

Save creates the Wechat entities in the database.

func (*WechatCreateBulk) SaveX

func (wcb *WechatCreateBulk) SaveX(ctx context.Context) []*Wechat

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

type WechatDelete

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

WechatDelete is the builder for deleting a Wechat entity.

func (*WechatDelete) Exec

func (wd *WechatDelete) Exec(ctx context.Context) (int, error)

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

func (*WechatDelete) ExecX

func (wd *WechatDelete) ExecX(ctx context.Context) int

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

func (*WechatDelete) Where

func (wd *WechatDelete) Where(ps ...predicate.Wechat) *WechatDelete

Where adds a new predicate to the WechatDelete builder.

type WechatDeleteOne

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

WechatDeleteOne is the builder for deleting a single Wechat entity.

func (*WechatDeleteOne) Exec

func (wdo *WechatDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WechatDeleteOne) ExecX

func (wdo *WechatDeleteOne) ExecX(ctx context.Context)

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

type WechatEdges

type WechatEdges struct {
	// Customers holds the value of the customers edge.
	Customers *Customer `json:"customers,omitempty"`
	// contains filtered or unexported fields
}

WechatEdges holds the relations/edges for other nodes in the graph.

func (WechatEdges) CustomersOrErr

func (e WechatEdges) CustomersOrErr() (*Customer, error)

CustomersOrErr returns the Customers value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type WechatGroupBy

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

WechatGroupBy is the group-by builder for Wechat entities.

func (*WechatGroupBy) Aggregate

func (wgb *WechatGroupBy) Aggregate(fns ...AggregateFunc) *WechatGroupBy

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

func (*WechatGroupBy) Bool

func (wgb *WechatGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*WechatGroupBy) BoolX

func (wgb *WechatGroupBy) BoolX(ctx context.Context) bool

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

func (*WechatGroupBy) Bools

func (wgb *WechatGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*WechatGroupBy) BoolsX

func (wgb *WechatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*WechatGroupBy) Float64

func (wgb *WechatGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*WechatGroupBy) Float64X

func (wgb *WechatGroupBy) Float64X(ctx context.Context) float64

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

func (*WechatGroupBy) Float64s

func (wgb *WechatGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*WechatGroupBy) Float64sX

func (wgb *WechatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*WechatGroupBy) Int

func (wgb *WechatGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*WechatGroupBy) IntX

func (wgb *WechatGroupBy) IntX(ctx context.Context) int

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

func (*WechatGroupBy) Ints

func (wgb *WechatGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*WechatGroupBy) IntsX

func (wgb *WechatGroupBy) IntsX(ctx context.Context) []int

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

func (*WechatGroupBy) Scan

func (wgb *WechatGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*WechatGroupBy) ScanX

func (wgb *WechatGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*WechatGroupBy) String

func (wgb *WechatGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*WechatGroupBy) StringX

func (wgb *WechatGroupBy) StringX(ctx context.Context) string

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

func (*WechatGroupBy) Strings

func (wgb *WechatGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*WechatGroupBy) StringsX

func (wgb *WechatGroupBy) StringsX(ctx context.Context) []string

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

type WechatMutation

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

WechatMutation represents an operation that mutates the Wechat nodes in the graph.

func (*WechatMutation) AddField

func (m *WechatMutation) 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 (*WechatMutation) AddedEdges

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

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

func (*WechatMutation) AddedField

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

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

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

func (*WechatMutation) AddedIDs

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

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

func (*WechatMutation) AppType

func (m *WechatMutation) AppType() (r wechat.AppType, exists bool)

AppType returns the value of the "app_type" field in the mutation.

func (*WechatMutation) ClearCustomers

func (m *WechatMutation) ClearCustomers()

ClearCustomers clears the "customers" edge to the Customer entity.

func (*WechatMutation) ClearEdge

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

func (m *WechatMutation) 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 (*WechatMutation) ClearMetaData

func (m *WechatMutation) ClearMetaData()

ClearMetaData clears the value of the "meta_data" field.

func (*WechatMutation) ClearedEdges

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

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

func (*WechatMutation) ClearedFields

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

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

func (WechatMutation) Client

func (m WechatMutation) 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 (*WechatMutation) CreateTime

func (m *WechatMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*WechatMutation) CustomersCleared

func (m *WechatMutation) CustomersCleared() bool

CustomersCleared returns if the "customers" edge to the Customer entity was cleared.

func (*WechatMutation) CustomersID

func (m *WechatMutation) CustomersID() (id int64, exists bool)

CustomersID returns the "customers" edge ID in the mutation.

func (*WechatMutation) CustomersIDs

func (m *WechatMutation) CustomersIDs() (ids []int64)

CustomersIDs returns the "customers" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CustomersID instead. It exists only for internal usage by the builders.

func (*WechatMutation) EdgeCleared

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

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

func (*WechatMutation) Field

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

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

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

func (*WechatMutation) Fields

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

func (m *WechatMutation) 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.

func (*WechatMutation) MetaData

func (m *WechatMutation) MetaData() (r []byte, exists bool)

MetaData returns the value of the "meta_data" field in the mutation.

func (*WechatMutation) MetaDataCleared

func (m *WechatMutation) MetaDataCleared() bool

MetaDataCleared returns if the "meta_data" field was cleared in this mutation.

func (*WechatMutation) OldAppType

func (m *WechatMutation) OldAppType(ctx context.Context) (v wechat.AppType, err error)

OldAppType returns the old "app_type" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) OldCreateTime

func (m *WechatMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) OldField

func (m *WechatMutation) 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 (*WechatMutation) OldMetaData

func (m *WechatMutation) OldMetaData(ctx context.Context) (v []byte, err error)

OldMetaData returns the old "meta_data" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) OldOpenid

func (m *WechatMutation) OldOpenid(ctx context.Context) (v string, err error)

OldOpenid returns the old "openid" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) OldUnionId

func (m *WechatMutation) OldUnionId(ctx context.Context) (v string, err error)

OldUnionId returns the old "unionId" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) OldUpdateTime

func (m *WechatMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Wechat entity. If the Wechat 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 (*WechatMutation) Op

func (m *WechatMutation) Op() Op

Op returns the operation name.

func (*WechatMutation) Openid

func (m *WechatMutation) Openid() (r string, exists bool)

Openid returns the value of the "openid" field in the mutation.

func (*WechatMutation) RemovedEdges

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

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

func (*WechatMutation) RemovedIDs

func (m *WechatMutation) 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 (*WechatMutation) ResetAppType

func (m *WechatMutation) ResetAppType()

ResetAppType resets all changes to the "app_type" field.

func (*WechatMutation) ResetCreateTime

func (m *WechatMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*WechatMutation) ResetCustomers

func (m *WechatMutation) ResetCustomers()

ResetCustomers resets all changes to the "customers" edge.

func (*WechatMutation) ResetEdge

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

func (m *WechatMutation) 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 (*WechatMutation) ResetMetaData

func (m *WechatMutation) ResetMetaData()

ResetMetaData resets all changes to the "meta_data" field.

func (*WechatMutation) ResetOpenid

func (m *WechatMutation) ResetOpenid()

ResetOpenid resets all changes to the "openid" field.

func (*WechatMutation) ResetUnionId

func (m *WechatMutation) ResetUnionId()

ResetUnionId resets all changes to the "unionId" field.

func (*WechatMutation) ResetUpdateTime

func (m *WechatMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*WechatMutation) SetAppType

func (m *WechatMutation) SetAppType(wt wechat.AppType)

SetAppType sets the "app_type" field.

func (*WechatMutation) SetCreateTime

func (m *WechatMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*WechatMutation) SetCustomersID

func (m *WechatMutation) SetCustomersID(id int64)

SetCustomersID sets the "customers" edge to the Customer entity by id.

func (*WechatMutation) SetField

func (m *WechatMutation) 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 (*WechatMutation) SetMetaData

func (m *WechatMutation) SetMetaData(b []byte)

SetMetaData sets the "meta_data" field.

func (*WechatMutation) SetOpenid

func (m *WechatMutation) SetOpenid(s string)

SetOpenid sets the "openid" field.

func (*WechatMutation) SetUnionId

func (m *WechatMutation) SetUnionId(s string)

SetUnionId sets the "unionId" field.

func (*WechatMutation) SetUpdateTime

func (m *WechatMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (WechatMutation) Tx

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

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

func (*WechatMutation) Type

func (m *WechatMutation) Type() string

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

func (*WechatMutation) UnionId

func (m *WechatMutation) UnionId() (r string, exists bool)

UnionId returns the value of the "unionId" field in the mutation.

func (*WechatMutation) UpdateTime

func (m *WechatMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

type WechatQuery

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

WechatQuery is the builder for querying Wechat entities.

func (*WechatQuery) All

func (wq *WechatQuery) All(ctx context.Context) ([]*Wechat, error)

All executes the query and returns a list of Wechats.

func (*WechatQuery) AllX

func (wq *WechatQuery) AllX(ctx context.Context) []*Wechat

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

func (*WechatQuery) Clone

func (wq *WechatQuery) Clone() *WechatQuery

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

func (*WechatQuery) Count

func (wq *WechatQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WechatQuery) CountX

func (wq *WechatQuery) CountX(ctx context.Context) int

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

func (*WechatQuery) Exist

func (wq *WechatQuery) Exist(ctx context.Context) (bool, error)

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

func (*WechatQuery) ExistX

func (wq *WechatQuery) ExistX(ctx context.Context) bool

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

func (*WechatQuery) First

func (wq *WechatQuery) First(ctx context.Context) (*Wechat, error)

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

func (*WechatQuery) FirstID

func (wq *WechatQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*WechatQuery) FirstIDX

func (wq *WechatQuery) FirstIDX(ctx context.Context) int

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

func (*WechatQuery) FirstX

func (wq *WechatQuery) FirstX(ctx context.Context) *Wechat

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

func (*WechatQuery) GroupBy

func (wq *WechatQuery) GroupBy(field string, fields ...string) *WechatGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Wechat.Query().
	GroupBy(wechat.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WechatQuery) IDs

func (wq *WechatQuery) IDs(ctx context.Context) ([]int, error)

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

func (*WechatQuery) IDsX

func (wq *WechatQuery) IDsX(ctx context.Context) []int

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

func (*WechatQuery) Limit

func (wq *WechatQuery) Limit(limit int) *WechatQuery

Limit adds a limit step to the query.

func (*WechatQuery) Offset

func (wq *WechatQuery) Offset(offset int) *WechatQuery

Offset adds an offset step to the query.

func (*WechatQuery) Only

func (wq *WechatQuery) Only(ctx context.Context) (*Wechat, error)

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

func (*WechatQuery) OnlyID

func (wq *WechatQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*WechatQuery) OnlyIDX

func (wq *WechatQuery) OnlyIDX(ctx context.Context) int

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

func (*WechatQuery) OnlyX

func (wq *WechatQuery) OnlyX(ctx context.Context) *Wechat

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

func (*WechatQuery) Order

func (wq *WechatQuery) Order(o ...OrderFunc) *WechatQuery

Order adds an order step to the query.

func (*WechatQuery) QueryCustomers

func (wq *WechatQuery) QueryCustomers() *CustomerQuery

QueryCustomers chains the current query on the "customers" edge.

func (*WechatQuery) Select

func (wq *WechatQuery) Select(field string, fields ...string) *WechatSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Wechat.Query().
	Select(wechat.FieldCreateTime).
	Scan(ctx, &v)

func (*WechatQuery) Where

func (wq *WechatQuery) Where(ps ...predicate.Wechat) *WechatQuery

Where adds a new predicate for the WechatQuery builder.

func (*WechatQuery) WithCustomers

func (wq *WechatQuery) WithCustomers(opts ...func(*CustomerQuery)) *WechatQuery

WithCustomers tells the query-builder to eager-load the nodes that are connected to the "customers" edge. The optional arguments are used to configure the query builder of the edge.

type WechatSelect

type WechatSelect struct {
	*WechatQuery
	// contains filtered or unexported fields
}

WechatSelect is the builder for selecting fields of Wechat entities.

func (*WechatSelect) Bool

func (ws *WechatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*WechatSelect) BoolX

func (ws *WechatSelect) BoolX(ctx context.Context) bool

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

func (*WechatSelect) Bools

func (ws *WechatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*WechatSelect) BoolsX

func (ws *WechatSelect) BoolsX(ctx context.Context) []bool

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

func (*WechatSelect) Float64

func (ws *WechatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*WechatSelect) Float64X

func (ws *WechatSelect) Float64X(ctx context.Context) float64

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

func (*WechatSelect) Float64s

func (ws *WechatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*WechatSelect) Float64sX

func (ws *WechatSelect) Float64sX(ctx context.Context) []float64

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

func (*WechatSelect) Int

func (ws *WechatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*WechatSelect) IntX

func (ws *WechatSelect) IntX(ctx context.Context) int

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

func (*WechatSelect) Ints

func (ws *WechatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*WechatSelect) IntsX

func (ws *WechatSelect) IntsX(ctx context.Context) []int

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

func (*WechatSelect) Scan

func (ws *WechatSelect) Scan(ctx context.Context, v interface{}) error

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

func (*WechatSelect) ScanX

func (ws *WechatSelect) ScanX(ctx context.Context, v interface{})

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

func (*WechatSelect) String

func (ws *WechatSelect) String(ctx context.Context) (_ string, err error)

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

func (*WechatSelect) StringX

func (ws *WechatSelect) StringX(ctx context.Context) string

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

func (*WechatSelect) Strings

func (ws *WechatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*WechatSelect) StringsX

func (ws *WechatSelect) StringsX(ctx context.Context) []string

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

type WechatUpdate

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

WechatUpdate is the builder for updating Wechat entities.

func (*WechatUpdate) ClearCustomers

func (wu *WechatUpdate) ClearCustomers() *WechatUpdate

ClearCustomers clears the "customers" edge to the Customer entity.

func (*WechatUpdate) ClearMetaData

func (wu *WechatUpdate) ClearMetaData() *WechatUpdate

ClearMetaData clears the value of the "meta_data" field.

func (*WechatUpdate) Exec

func (wu *WechatUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WechatUpdate) ExecX

func (wu *WechatUpdate) ExecX(ctx context.Context)

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

func (*WechatUpdate) Mutation

func (wu *WechatUpdate) Mutation() *WechatMutation

Mutation returns the WechatMutation object of the builder.

func (*WechatUpdate) Save

func (wu *WechatUpdate) Save(ctx context.Context) (int, error)

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

func (*WechatUpdate) SaveX

func (wu *WechatUpdate) SaveX(ctx context.Context) int

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

func (*WechatUpdate) SetAppType

func (wu *WechatUpdate) SetAppType(wt wechat.AppType) *WechatUpdate

SetAppType sets the "app_type" field.

func (*WechatUpdate) SetCustomers

func (wu *WechatUpdate) SetCustomers(c *Customer) *WechatUpdate

SetCustomers sets the "customers" edge to the Customer entity.

func (*WechatUpdate) SetCustomersID

func (wu *WechatUpdate) SetCustomersID(id int64) *WechatUpdate

SetCustomersID sets the "customers" edge to the Customer entity by ID.

func (*WechatUpdate) SetMetaData

func (wu *WechatUpdate) SetMetaData(b []byte) *WechatUpdate

SetMetaData sets the "meta_data" field.

func (*WechatUpdate) SetNillableCustomersID

func (wu *WechatUpdate) SetNillableCustomersID(id *int64) *WechatUpdate

SetNillableCustomersID sets the "customers" edge to the Customer entity by ID if the given value is not nil.

func (*WechatUpdate) SetOpenid

func (wu *WechatUpdate) SetOpenid(s string) *WechatUpdate

SetOpenid sets the "openid" field.

func (*WechatUpdate) SetUnionId

func (wu *WechatUpdate) SetUnionId(s string) *WechatUpdate

SetUnionId sets the "unionId" field.

func (*WechatUpdate) Where

func (wu *WechatUpdate) Where(ps ...predicate.Wechat) *WechatUpdate

Where adds a new predicate for the WechatUpdate builder.

type WechatUpdateOne

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

WechatUpdateOne is the builder for updating a single Wechat entity.

func (*WechatUpdateOne) ClearCustomers

func (wuo *WechatUpdateOne) ClearCustomers() *WechatUpdateOne

ClearCustomers clears the "customers" edge to the Customer entity.

func (*WechatUpdateOne) ClearMetaData

func (wuo *WechatUpdateOne) ClearMetaData() *WechatUpdateOne

ClearMetaData clears the value of the "meta_data" field.

func (*WechatUpdateOne) Exec

func (wuo *WechatUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WechatUpdateOne) ExecX

func (wuo *WechatUpdateOne) ExecX(ctx context.Context)

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

func (*WechatUpdateOne) Mutation

func (wuo *WechatUpdateOne) Mutation() *WechatMutation

Mutation returns the WechatMutation object of the builder.

func (*WechatUpdateOne) Save

func (wuo *WechatUpdateOne) Save(ctx context.Context) (*Wechat, error)

Save executes the query and returns the updated Wechat entity.

func (*WechatUpdateOne) SaveX

func (wuo *WechatUpdateOne) SaveX(ctx context.Context) *Wechat

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

func (*WechatUpdateOne) SetAppType

func (wuo *WechatUpdateOne) SetAppType(wt wechat.AppType) *WechatUpdateOne

SetAppType sets the "app_type" field.

func (*WechatUpdateOne) SetCustomers

func (wuo *WechatUpdateOne) SetCustomers(c *Customer) *WechatUpdateOne

SetCustomers sets the "customers" edge to the Customer entity.

func (*WechatUpdateOne) SetCustomersID

func (wuo *WechatUpdateOne) SetCustomersID(id int64) *WechatUpdateOne

SetCustomersID sets the "customers" edge to the Customer entity by ID.

func (*WechatUpdateOne) SetMetaData

func (wuo *WechatUpdateOne) SetMetaData(b []byte) *WechatUpdateOne

SetMetaData sets the "meta_data" field.

func (*WechatUpdateOne) SetNillableCustomersID

func (wuo *WechatUpdateOne) SetNillableCustomersID(id *int64) *WechatUpdateOne

SetNillableCustomersID sets the "customers" edge to the Customer entity by ID if the given value is not nil.

func (*WechatUpdateOne) SetOpenid

func (wuo *WechatUpdateOne) SetOpenid(s string) *WechatUpdateOne

SetOpenid sets the "openid" field.

func (*WechatUpdateOne) SetUnionId

func (wuo *WechatUpdateOne) SetUnionId(s string) *WechatUpdateOne

SetUnionId sets the "unionId" field.

type Wechats

type Wechats []*Wechat

Wechats is a parsable slice of Wechat.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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