u
This commit is contained in:
1 parent
ac0843c041
commit
a917be08d1
65 files changed
+8043
No files matched your search
@@ -0,0 +1,883 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"cn/oneao/base-go/ent/predicate"
|
||||
"cn/oneao/base-go/ent/userinfo"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Operation types.
|
||||
OpCreate = ent.OpCreate
|
||||
OpDelete = ent.OpDelete
|
||||
OpDeleteOne = ent.OpDeleteOne
|
||||
OpUpdate = ent.OpUpdate
|
||||
OpUpdateOne = ent.OpUpdateOne
|
||||
|
||||
// Node types.
|
||||
TypeUserInfo = "UserInfo"
|
||||
)
|
||||
|
||||
// UserInfoMutation represents an operation that mutates the UserInfo nodes in the graph.
|
||||
type UserInfoMutation struct {
|
||||
config
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
seq_no *int64
|
||||
addseq_no *int64
|
||||
email *string
|
||||
username *string
|
||||
password *string
|
||||
gender *int64
|
||||
addgender *int64
|
||||
account *string
|
||||
create_time *time.Time
|
||||
update_time *time.Time
|
||||
last_login_time *time.Time
|
||||
clearedFields map[string]struct{}
|
||||
done bool
|
||||
oldValue func(context.Context) (*UserInfo, error)
|
||||
predicates []predicate.UserInfo
|
||||
}
|
||||
|
||||
var _ ent.Mutation = (*UserInfoMutation)(nil)
|
||||
|
||||
// userinfoOption allows management of the mutation configuration using functional options.
|
||||
type userinfoOption func(*UserInfoMutation)
|
||||
|
||||
// newUserInfoMutation creates new mutation for the UserInfo entity.
|
||||
func newUserInfoMutation(c config, op Op, opts ...userinfoOption) *UserInfoMutation {
|
||||
m := &UserInfoMutation{
|
||||
config: c,
|
||||
op: op,
|
||||
typ: TypeUserInfo,
|
||||
clearedFields: make(map[string]struct{}),
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(m)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// withUserInfoID sets the ID field of the mutation.
|
||||
func withUserInfoID(id int64) userinfoOption {
|
||||
return func(m *UserInfoMutation) {
|
||||
var (
|
||||
err error
|
||||
once sync.Once
|
||||
value *UserInfo
|
||||
)
|
||||
m.oldValue = func(ctx context.Context) (*UserInfo, error) {
|
||||
once.Do(func() {
|
||||
if m.done {
|
||||
err = errors.New("querying old values post mutation is not allowed")
|
||||
} else {
|
||||
value, err = m.Client().UserInfo.Get(ctx, id)
|
||||
}
|
||||
})
|
||||
return value, err
|
||||
}
|
||||
m.id = &id
|
||||
}
|
||||
}
|
||||
|
||||
// withUserInfo sets the old UserInfo of the mutation.
|
||||
func withUserInfo(node *UserInfo) userinfoOption {
|
||||
return func(m *UserInfoMutation) {
|
||||
m.oldValue = func(context.Context) (*UserInfo, error) {
|
||||
return node, nil
|
||||
}
|
||||
m.id = &node.ID
|
||||
}
|
||||
}
|
||||
|
||||
// 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 (m UserInfoMutation) Client() *Client {
|
||||
client := &Client{config: m.config}
|
||||
client.init()
|
||||
return client
|
||||
}
|
||||
|
||||
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
|
||||
// it returns an error otherwise.
|
||||
func (m UserInfoMutation) Tx() (*Tx, error) {
|
||||
if _, ok := m.driver.(*txDriver); !ok {
|
||||
return nil, errors.New("ent: mutation is not running in a transaction")
|
||||
}
|
||||
tx := &Tx{config: m.config}
|
||||
tx.init()
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
// SetID sets the value of the id field. Note that this
|
||||
// operation is only accepted on creation of UserInfo entities.
|
||||
func (m *UserInfoMutation) SetID(id int64) {
|
||||
m.id = &id
|
||||
}
|
||||
|
||||
// ID returns the ID value in the mutation. Note that the ID is only available
|
||||
// if it was provided to the builder or after it was returned from the database.
|
||||
func (m *UserInfoMutation) ID() (id int64, exists bool) {
|
||||
if m.id == nil {
|
||||
return
|
||||
}
|
||||
return *m.id, true
|
||||
}
|
||||
|
||||
// IDs queries the database and returns the entity ids that match the mutation's predicate.
|
||||
// That means, if the mutation is applied within a transaction with an isolation level such
|
||||
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
|
||||
// or updated by the mutation.
|
||||
func (m *UserInfoMutation) IDs(ctx context.Context) ([]int64, error) {
|
||||
switch {
|
||||
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
||||
id, exists := m.ID()
|
||||
if exists {
|
||||
return []int64{id}, nil
|
||||
}
|
||||
fallthrough
|
||||
case m.op.Is(OpUpdate | OpDelete):
|
||||
return m.Client().UserInfo.Query().Where(m.predicates...).IDs(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
||||
}
|
||||
}
|
||||
|
||||
// SetSeqNo sets the "seq_no" field.
|
||||
func (m *UserInfoMutation) SetSeqNo(i int64) {
|
||||
m.seq_no = &i
|
||||
m.addseq_no = nil
|
||||
}
|
||||
|
||||
// SeqNo returns the value of the "seq_no" field in the mutation.
|
||||
func (m *UserInfoMutation) SeqNo() (r int64, exists bool) {
|
||||
v := m.seq_no
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldSeqNo returns the old "seq_no" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldSeqNo(ctx context.Context) (v int64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldSeqNo is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldSeqNo requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldSeqNo: %w", err)
|
||||
}
|
||||
return oldValue.SeqNo, nil
|
||||
}
|
||||
|
||||
// AddSeqNo adds i to the "seq_no" field.
|
||||
func (m *UserInfoMutation) AddSeqNo(i int64) {
|
||||
if m.addseq_no != nil {
|
||||
*m.addseq_no += i
|
||||
} else {
|
||||
m.addseq_no = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedSeqNo returns the value that was added to the "seq_no" field in this mutation.
|
||||
func (m *UserInfoMutation) AddedSeqNo() (r int64, exists bool) {
|
||||
v := m.addseq_no
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetSeqNo resets all changes to the "seq_no" field.
|
||||
func (m *UserInfoMutation) ResetSeqNo() {
|
||||
m.seq_no = nil
|
||||
m.addseq_no = nil
|
||||
}
|
||||
|
||||
// SetEmail sets the "email" field.
|
||||
func (m *UserInfoMutation) SetEmail(s string) {
|
||||
m.email = &s
|
||||
}
|
||||
|
||||
// Email returns the value of the "email" field in the mutation.
|
||||
func (m *UserInfoMutation) Email() (r string, exists bool) {
|
||||
v := m.email
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldEmail returns the old "email" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldEmail(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldEmail is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldEmail requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldEmail: %w", err)
|
||||
}
|
||||
return oldValue.Email, nil
|
||||
}
|
||||
|
||||
// ResetEmail resets all changes to the "email" field.
|
||||
func (m *UserInfoMutation) ResetEmail() {
|
||||
m.email = nil
|
||||
}
|
||||
|
||||
// SetUsername sets the "username" field.
|
||||
func (m *UserInfoMutation) SetUsername(s string) {
|
||||
m.username = &s
|
||||
}
|
||||
|
||||
// Username returns the value of the "username" field in the mutation.
|
||||
func (m *UserInfoMutation) Username() (r string, exists bool) {
|
||||
v := m.username
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUsername returns the old "username" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldUsername(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUsername is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUsername requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUsername: %w", err)
|
||||
}
|
||||
return oldValue.Username, nil
|
||||
}
|
||||
|
||||
// ResetUsername resets all changes to the "username" field.
|
||||
func (m *UserInfoMutation) ResetUsername() {
|
||||
m.username = nil
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (m *UserInfoMutation) SetPassword(s string) {
|
||||
m.password = &s
|
||||
}
|
||||
|
||||
// Password returns the value of the "password" field in the mutation.
|
||||
func (m *UserInfoMutation) Password() (r string, exists bool) {
|
||||
v := m.password
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldPassword returns the old "password" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldPassword(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldPassword requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldPassword: %w", err)
|
||||
}
|
||||
return oldValue.Password, nil
|
||||
}
|
||||
|
||||
// ResetPassword resets all changes to the "password" field.
|
||||
func (m *UserInfoMutation) ResetPassword() {
|
||||
m.password = nil
|
||||
}
|
||||
|
||||
// SetGender sets the "gender" field.
|
||||
func (m *UserInfoMutation) SetGender(i int64) {
|
||||
m.gender = &i
|
||||
m.addgender = nil
|
||||
}
|
||||
|
||||
// Gender returns the value of the "gender" field in the mutation.
|
||||
func (m *UserInfoMutation) Gender() (r int64, exists bool) {
|
||||
v := m.gender
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGender returns the old "gender" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldGender(ctx context.Context) (v int64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldGender is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldGender requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGender: %w", err)
|
||||
}
|
||||
return oldValue.Gender, nil
|
||||
}
|
||||
|
||||
// AddGender adds i to the "gender" field.
|
||||
func (m *UserInfoMutation) AddGender(i int64) {
|
||||
if m.addgender != nil {
|
||||
*m.addgender += i
|
||||
} else {
|
||||
m.addgender = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedGender returns the value that was added to the "gender" field in this mutation.
|
||||
func (m *UserInfoMutation) AddedGender() (r int64, exists bool) {
|
||||
v := m.addgender
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetGender resets all changes to the "gender" field.
|
||||
func (m *UserInfoMutation) ResetGender() {
|
||||
m.gender = nil
|
||||
m.addgender = nil
|
||||
}
|
||||
|
||||
// SetAccount sets the "account" field.
|
||||
func (m *UserInfoMutation) SetAccount(s string) {
|
||||
m.account = &s
|
||||
}
|
||||
|
||||
// Account returns the value of the "account" field in the mutation.
|
||||
func (m *UserInfoMutation) Account() (r string, exists bool) {
|
||||
v := m.account
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAccount returns the old "account" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldAccount(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldAccount is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldAccount requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldAccount: %w", err)
|
||||
}
|
||||
return oldValue.Account, nil
|
||||
}
|
||||
|
||||
// ResetAccount resets all changes to the "account" field.
|
||||
func (m *UserInfoMutation) ResetAccount() {
|
||||
m.account = nil
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (m *UserInfoMutation) SetCreateTime(t time.Time) {
|
||||
m.create_time = &t
|
||||
}
|
||||
|
||||
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||
func (m *UserInfoMutation) CreateTime() (r time.Time, exists bool) {
|
||||
v := m.create_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldCreateTime returns the old "create_time" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||
}
|
||||
return oldValue.CreateTime, nil
|
||||
}
|
||||
|
||||
// ResetCreateTime resets all changes to the "create_time" field.
|
||||
func (m *UserInfoMutation) ResetCreateTime() {
|
||||
m.create_time = nil
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (m *UserInfoMutation) SetUpdateTime(t time.Time) {
|
||||
m.update_time = &t
|
||||
}
|
||||
|
||||
// UpdateTime returns the value of the "update_time" field in the mutation.
|
||||
func (m *UserInfoMutation) UpdateTime() (r time.Time, exists bool) {
|
||||
v := m.update_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUpdateTime returns the old "update_time" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
|
||||
}
|
||||
return oldValue.UpdateTime, nil
|
||||
}
|
||||
|
||||
// ResetUpdateTime resets all changes to the "update_time" field.
|
||||
func (m *UserInfoMutation) ResetUpdateTime() {
|
||||
m.update_time = nil
|
||||
}
|
||||
|
||||
// SetLastLoginTime sets the "last_login_time" field.
|
||||
func (m *UserInfoMutation) SetLastLoginTime(t time.Time) {
|
||||
m.last_login_time = &t
|
||||
}
|
||||
|
||||
// LastLoginTime returns the value of the "last_login_time" field in the mutation.
|
||||
func (m *UserInfoMutation) LastLoginTime() (r time.Time, exists bool) {
|
||||
v := m.last_login_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldLastLoginTime returns the old "last_login_time" field's value of the UserInfo entity.
|
||||
// If the UserInfo 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 (m *UserInfoMutation) OldLastLoginTime(ctx context.Context) (v *time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldLastLoginTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldLastLoginTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldLastLoginTime: %w", err)
|
||||
}
|
||||
return oldValue.LastLoginTime, nil
|
||||
}
|
||||
|
||||
// ClearLastLoginTime clears the value of the "last_login_time" field.
|
||||
func (m *UserInfoMutation) ClearLastLoginTime() {
|
||||
m.last_login_time = nil
|
||||
m.clearedFields[userinfo.FieldLastLoginTime] = struct{}{}
|
||||
}
|
||||
|
||||
// LastLoginTimeCleared returns if the "last_login_time" field was cleared in this mutation.
|
||||
func (m *UserInfoMutation) LastLoginTimeCleared() bool {
|
||||
_, ok := m.clearedFields[userinfo.FieldLastLoginTime]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetLastLoginTime resets all changes to the "last_login_time" field.
|
||||
func (m *UserInfoMutation) ResetLastLoginTime() {
|
||||
m.last_login_time = nil
|
||||
delete(m.clearedFields, userinfo.FieldLastLoginTime)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the UserInfoMutation builder.
|
||||
func (m *UserInfoMutation) Where(ps ...predicate.UserInfo) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the UserInfoMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *UserInfoMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.UserInfo, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *UserInfoMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *UserInfoMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (UserInfo).
|
||||
func (m *UserInfoMutation) Type() string {
|
||||
return m.typ
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) Fields() []string {
|
||||
fields := make([]string, 0, 9)
|
||||
if m.seq_no != nil {
|
||||
fields = append(fields, userinfo.FieldSeqNo)
|
||||
}
|
||||
if m.email != nil {
|
||||
fields = append(fields, userinfo.FieldEmail)
|
||||
}
|
||||
if m.username != nil {
|
||||
fields = append(fields, userinfo.FieldUsername)
|
||||
}
|
||||
if m.password != nil {
|
||||
fields = append(fields, userinfo.FieldPassword)
|
||||
}
|
||||
if m.gender != nil {
|
||||
fields = append(fields, userinfo.FieldGender)
|
||||
}
|
||||
if m.account != nil {
|
||||
fields = append(fields, userinfo.FieldAccount)
|
||||
}
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, userinfo.FieldCreateTime)
|
||||
}
|
||||
if m.update_time != nil {
|
||||
fields = append(fields, userinfo.FieldUpdateTime)
|
||||
}
|
||||
if m.last_login_time != nil {
|
||||
fields = append(fields, userinfo.FieldLastLoginTime)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
return m.SeqNo()
|
||||
case userinfo.FieldEmail:
|
||||
return m.Email()
|
||||
case userinfo.FieldUsername:
|
||||
return m.Username()
|
||||
case userinfo.FieldPassword:
|
||||
return m.Password()
|
||||
case userinfo.FieldGender:
|
||||
return m.Gender()
|
||||
case userinfo.FieldAccount:
|
||||
return m.Account()
|
||||
case userinfo.FieldCreateTime:
|
||||
return m.CreateTime()
|
||||
case userinfo.FieldUpdateTime:
|
||||
return m.UpdateTime()
|
||||
case userinfo.FieldLastLoginTime:
|
||||
return m.LastLoginTime()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
return m.OldSeqNo(ctx)
|
||||
case userinfo.FieldEmail:
|
||||
return m.OldEmail(ctx)
|
||||
case userinfo.FieldUsername:
|
||||
return m.OldUsername(ctx)
|
||||
case userinfo.FieldPassword:
|
||||
return m.OldPassword(ctx)
|
||||
case userinfo.FieldGender:
|
||||
return m.OldGender(ctx)
|
||||
case userinfo.FieldAccount:
|
||||
return m.OldAccount(ctx)
|
||||
case userinfo.FieldCreateTime:
|
||||
return m.OldCreateTime(ctx)
|
||||
case userinfo.FieldUpdateTime:
|
||||
return m.OldUpdateTime(ctx)
|
||||
case userinfo.FieldLastLoginTime:
|
||||
return m.OldLastLoginTime(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown UserInfo field %s", name)
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetSeqNo(v)
|
||||
return nil
|
||||
case userinfo.FieldEmail:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetEmail(v)
|
||||
return nil
|
||||
case userinfo.FieldUsername:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUsername(v)
|
||||
return nil
|
||||
case userinfo.FieldPassword:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetPassword(v)
|
||||
return nil
|
||||
case userinfo.FieldGender:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGender(v)
|
||||
return nil
|
||||
case userinfo.FieldAccount:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetAccount(v)
|
||||
return nil
|
||||
case userinfo.FieldCreateTime:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCreateTime(v)
|
||||
return nil
|
||||
case userinfo.FieldUpdateTime:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUpdateTime(v)
|
||||
return nil
|
||||
case userinfo.FieldLastLoginTime:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetLastLoginTime(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserInfo field %s", name)
|
||||
}
|
||||
|
||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||
// this mutation.
|
||||
func (m *UserInfoMutation) AddedFields() []string {
|
||||
var fields []string
|
||||
if m.addseq_no != nil {
|
||||
fields = append(fields, userinfo.FieldSeqNo)
|
||||
}
|
||||
if m.addgender != nil {
|
||||
fields = append(fields, userinfo.FieldGender)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) AddedField(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
return m.AddedSeqNo()
|
||||
case userinfo.FieldGender:
|
||||
return m.AddedGender()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) AddField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddSeqNo(v)
|
||||
return nil
|
||||
case userinfo.FieldGender:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddGender(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserInfo numeric field %s", name)
|
||||
}
|
||||
|
||||
// ClearedFields returns all nullable fields that were cleared during this
|
||||
// mutation.
|
||||
func (m *UserInfoMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(userinfo.FieldLastLoginTime) {
|
||||
fields = append(fields, userinfo.FieldLastLoginTime)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
// FieldCleared returns a boolean indicating if a field with the given name was
|
||||
// cleared in this mutation.
|
||||
func (m *UserInfoMutation) FieldCleared(name string) bool {
|
||||
_, ok := m.clearedFields[name]
|
||||
return ok
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case userinfo.FieldLastLoginTime:
|
||||
m.ClearLastLoginTime()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserInfo nullable field %s", name)
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case userinfo.FieldSeqNo:
|
||||
m.ResetSeqNo()
|
||||
return nil
|
||||
case userinfo.FieldEmail:
|
||||
m.ResetEmail()
|
||||
return nil
|
||||
case userinfo.FieldUsername:
|
||||
m.ResetUsername()
|
||||
return nil
|
||||
case userinfo.FieldPassword:
|
||||
m.ResetPassword()
|
||||
return nil
|
||||
case userinfo.FieldGender:
|
||||
m.ResetGender()
|
||||
return nil
|
||||
case userinfo.FieldAccount:
|
||||
m.ResetAccount()
|
||||
return nil
|
||||
case userinfo.FieldCreateTime:
|
||||
m.ResetCreateTime()
|
||||
return nil
|
||||
case userinfo.FieldUpdateTime:
|
||||
m.ResetUpdateTime()
|
||||
return nil
|
||||
case userinfo.FieldLastLoginTime:
|
||||
m.ResetLastLoginTime()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserInfo field %s", name)
|
||||
}
|
||||
|
||||
// AddedEdges returns all edge names that were set/added in this mutation.
|
||||
func (m *UserInfoMutation) AddedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
||||
// name in this mutation.
|
||||
func (m *UserInfoMutation) AddedIDs(name string) []ent.Value {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||
func (m *UserInfoMutation) RemovedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *UserInfoMutation) RemovedIDs(name string) []ent.Value {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClearedEdges returns all edge names that were cleared in this mutation.
|
||||
func (m *UserInfoMutation) ClearedEdges() []string {
|
||||
edges := make([]string, 0, 0)
|
||||
return edges
|
||||
}
|
||||
|
||||
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
||||
// was cleared in this mutation.
|
||||
func (m *UserInfoMutation) EdgeCleared(name string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) ClearEdge(name string) error {
|
||||
return fmt.Errorf("unknown UserInfo unique edge %s", name)
|
||||
}
|
||||
|
||||
// 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 (m *UserInfoMutation) ResetEdge(name string) error {
|
||||
return fmt.Errorf("unknown UserInfo edge %s", name)
|
||||
}
|
||||
Reference in new issue
Block a user