5301 lines
163 KiB
Go
5301 lines
163 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"schisandra-album-cloud-microservices/common/ent/predicate"
|
|
"schisandra-album-cloud-microservices/common/ent/scaauthpermissionrule"
|
|
"schisandra-album-cloud-microservices/common/ent/scaauthrole"
|
|
"schisandra-album-cloud-microservices/common/ent/scaauthuser"
|
|
"schisandra-album-cloud-microservices/common/ent/scaauthuserdevice"
|
|
"schisandra-album-cloud-microservices/common/ent/scaauthusersocial"
|
|
"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.
|
|
TypeScaAuthPermissionRule = "ScaAuthPermissionRule"
|
|
TypeScaAuthRole = "ScaAuthRole"
|
|
TypeScaAuthUser = "ScaAuthUser"
|
|
TypeScaAuthUserDevice = "ScaAuthUserDevice"
|
|
TypeScaAuthUserSocial = "ScaAuthUserSocial"
|
|
)
|
|
|
|
// ScaAuthPermissionRuleMutation represents an operation that mutates the ScaAuthPermissionRule nodes in the graph.
|
|
type ScaAuthPermissionRuleMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int64
|
|
ptype *string
|
|
v0 *string
|
|
v1 *string
|
|
v2 *string
|
|
v3 *string
|
|
v4 *string
|
|
v5 *string
|
|
clearedFields map[string]struct{}
|
|
sca_auth_role *int64
|
|
clearedsca_auth_role bool
|
|
done bool
|
|
oldValue func(context.Context) (*ScaAuthPermissionRule, error)
|
|
predicates []predicate.ScaAuthPermissionRule
|
|
}
|
|
|
|
var _ ent.Mutation = (*ScaAuthPermissionRuleMutation)(nil)
|
|
|
|
// scaauthpermissionruleOption allows management of the mutation configuration using functional options.
|
|
type scaauthpermissionruleOption func(*ScaAuthPermissionRuleMutation)
|
|
|
|
// newScaAuthPermissionRuleMutation creates new mutation for the ScaAuthPermissionRule entity.
|
|
func newScaAuthPermissionRuleMutation(c config, op Op, opts ...scaauthpermissionruleOption) *ScaAuthPermissionRuleMutation {
|
|
m := &ScaAuthPermissionRuleMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeScaAuthPermissionRule,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withScaAuthPermissionRuleID sets the ID field of the mutation.
|
|
func withScaAuthPermissionRuleID(id int64) scaauthpermissionruleOption {
|
|
return func(m *ScaAuthPermissionRuleMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *ScaAuthPermissionRule
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*ScaAuthPermissionRule, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().ScaAuthPermissionRule.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withScaAuthPermissionRule sets the old ScaAuthPermissionRule of the mutation.
|
|
func withScaAuthPermissionRule(node *ScaAuthPermissionRule) scaauthpermissionruleOption {
|
|
return func(m *ScaAuthPermissionRuleMutation) {
|
|
m.oldValue = func(context.Context) (*ScaAuthPermissionRule, 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 ScaAuthPermissionRuleMutation) 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 ScaAuthPermissionRuleMutation) 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 ScaAuthPermissionRule entities.
|
|
func (m *ScaAuthPermissionRuleMutation) 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 *ScaAuthPermissionRuleMutation) 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 *ScaAuthPermissionRuleMutation) 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().ScaAuthPermissionRule.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetPtype sets the "ptype" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetPtype(s string) {
|
|
m.ptype = &s
|
|
}
|
|
|
|
// Ptype returns the value of the "ptype" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) Ptype() (r string, exists bool) {
|
|
v := m.ptype
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPtype returns the old "ptype" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldPtype(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPtype is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPtype requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPtype: %w", err)
|
|
}
|
|
return oldValue.Ptype, nil
|
|
}
|
|
|
|
// ResetPtype resets all changes to the "ptype" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetPtype() {
|
|
m.ptype = nil
|
|
}
|
|
|
|
// SetV0 sets the "v0" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV0(s string) {
|
|
m.v0 = &s
|
|
}
|
|
|
|
// V0 returns the value of the "v0" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V0() (r string, exists bool) {
|
|
v := m.v0
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV0 returns the old "v0" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV0(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV0 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV0 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV0: %w", err)
|
|
}
|
|
return oldValue.V0, nil
|
|
}
|
|
|
|
// ResetV0 resets all changes to the "v0" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV0() {
|
|
m.v0 = nil
|
|
}
|
|
|
|
// SetV1 sets the "v1" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV1(s string) {
|
|
m.v1 = &s
|
|
}
|
|
|
|
// V1 returns the value of the "v1" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V1() (r string, exists bool) {
|
|
v := m.v1
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV1 returns the old "v1" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV1(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV1 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV1 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV1: %w", err)
|
|
}
|
|
return oldValue.V1, nil
|
|
}
|
|
|
|
// ResetV1 resets all changes to the "v1" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV1() {
|
|
m.v1 = nil
|
|
}
|
|
|
|
// SetV2 sets the "v2" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV2(s string) {
|
|
m.v2 = &s
|
|
}
|
|
|
|
// V2 returns the value of the "v2" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V2() (r string, exists bool) {
|
|
v := m.v2
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV2 returns the old "v2" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV2(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV2 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV2 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV2: %w", err)
|
|
}
|
|
return oldValue.V2, nil
|
|
}
|
|
|
|
// ClearV2 clears the value of the "v2" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearV2() {
|
|
m.v2 = nil
|
|
m.clearedFields[scaauthpermissionrule.FieldV2] = struct{}{}
|
|
}
|
|
|
|
// V2Cleared returns if the "v2" field was cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V2Cleared() bool {
|
|
_, ok := m.clearedFields[scaauthpermissionrule.FieldV2]
|
|
return ok
|
|
}
|
|
|
|
// ResetV2 resets all changes to the "v2" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV2() {
|
|
m.v2 = nil
|
|
delete(m.clearedFields, scaauthpermissionrule.FieldV2)
|
|
}
|
|
|
|
// SetV3 sets the "v3" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV3(s string) {
|
|
m.v3 = &s
|
|
}
|
|
|
|
// V3 returns the value of the "v3" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V3() (r string, exists bool) {
|
|
v := m.v3
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV3 returns the old "v3" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV3(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV3 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV3 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV3: %w", err)
|
|
}
|
|
return oldValue.V3, nil
|
|
}
|
|
|
|
// ClearV3 clears the value of the "v3" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearV3() {
|
|
m.v3 = nil
|
|
m.clearedFields[scaauthpermissionrule.FieldV3] = struct{}{}
|
|
}
|
|
|
|
// V3Cleared returns if the "v3" field was cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V3Cleared() bool {
|
|
_, ok := m.clearedFields[scaauthpermissionrule.FieldV3]
|
|
return ok
|
|
}
|
|
|
|
// ResetV3 resets all changes to the "v3" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV3() {
|
|
m.v3 = nil
|
|
delete(m.clearedFields, scaauthpermissionrule.FieldV3)
|
|
}
|
|
|
|
// SetV4 sets the "v4" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV4(s string) {
|
|
m.v4 = &s
|
|
}
|
|
|
|
// V4 returns the value of the "v4" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V4() (r string, exists bool) {
|
|
v := m.v4
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV4 returns the old "v4" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV4(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV4 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV4 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV4: %w", err)
|
|
}
|
|
return oldValue.V4, nil
|
|
}
|
|
|
|
// ClearV4 clears the value of the "v4" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearV4() {
|
|
m.v4 = nil
|
|
m.clearedFields[scaauthpermissionrule.FieldV4] = struct{}{}
|
|
}
|
|
|
|
// V4Cleared returns if the "v4" field was cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V4Cleared() bool {
|
|
_, ok := m.clearedFields[scaauthpermissionrule.FieldV4]
|
|
return ok
|
|
}
|
|
|
|
// ResetV4 resets all changes to the "v4" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV4() {
|
|
m.v4 = nil
|
|
delete(m.clearedFields, scaauthpermissionrule.FieldV4)
|
|
}
|
|
|
|
// SetV5 sets the "v5" field.
|
|
func (m *ScaAuthPermissionRuleMutation) SetV5(s string) {
|
|
m.v5 = &s
|
|
}
|
|
|
|
// V5 returns the value of the "v5" field in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V5() (r string, exists bool) {
|
|
v := m.v5
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldV5 returns the old "v5" field's value of the ScaAuthPermissionRule entity.
|
|
// If the ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) OldV5(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldV5 is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldV5 requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldV5: %w", err)
|
|
}
|
|
return oldValue.V5, nil
|
|
}
|
|
|
|
// ClearV5 clears the value of the "v5" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearV5() {
|
|
m.v5 = nil
|
|
m.clearedFields[scaauthpermissionrule.FieldV5] = struct{}{}
|
|
}
|
|
|
|
// V5Cleared returns if the "v5" field was cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) V5Cleared() bool {
|
|
_, ok := m.clearedFields[scaauthpermissionrule.FieldV5]
|
|
return ok
|
|
}
|
|
|
|
// ResetV5 resets all changes to the "v5" field.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetV5() {
|
|
m.v5 = nil
|
|
delete(m.clearedFields, scaauthpermissionrule.FieldV5)
|
|
}
|
|
|
|
// SetScaAuthRoleID sets the "sca_auth_role" edge to the ScaAuthRole entity by id.
|
|
func (m *ScaAuthPermissionRuleMutation) SetScaAuthRoleID(id int64) {
|
|
m.sca_auth_role = &id
|
|
}
|
|
|
|
// ClearScaAuthRole clears the "sca_auth_role" edge to the ScaAuthRole entity.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearScaAuthRole() {
|
|
m.clearedsca_auth_role = true
|
|
}
|
|
|
|
// ScaAuthRoleCleared reports if the "sca_auth_role" edge to the ScaAuthRole entity was cleared.
|
|
func (m *ScaAuthPermissionRuleMutation) ScaAuthRoleCleared() bool {
|
|
return m.clearedsca_auth_role
|
|
}
|
|
|
|
// ScaAuthRoleID returns the "sca_auth_role" edge ID in the mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) ScaAuthRoleID() (id int64, exists bool) {
|
|
if m.sca_auth_role != nil {
|
|
return *m.sca_auth_role, true
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthRoleIDs returns the "sca_auth_role" edge IDs in the mutation.
|
|
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
// ScaAuthRoleID instead. It exists only for internal usage by the builders.
|
|
func (m *ScaAuthPermissionRuleMutation) ScaAuthRoleIDs() (ids []int64) {
|
|
if id := m.sca_auth_role; id != nil {
|
|
ids = append(ids, *id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthRole resets all changes to the "sca_auth_role" edge.
|
|
func (m *ScaAuthPermissionRuleMutation) ResetScaAuthRole() {
|
|
m.sca_auth_role = nil
|
|
m.clearedsca_auth_role = false
|
|
}
|
|
|
|
// Where appends a list predicates to the ScaAuthPermissionRuleMutation builder.
|
|
func (m *ScaAuthPermissionRuleMutation) Where(ps ...predicate.ScaAuthPermissionRule) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the ScaAuthPermissionRuleMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *ScaAuthPermissionRuleMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.ScaAuthPermissionRule, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *ScaAuthPermissionRuleMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *ScaAuthPermissionRuleMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (ScaAuthPermissionRule).
|
|
func (m *ScaAuthPermissionRuleMutation) 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 *ScaAuthPermissionRuleMutation) Fields() []string {
|
|
fields := make([]string, 0, 7)
|
|
if m.ptype != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldPtype)
|
|
}
|
|
if m.v0 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV0)
|
|
}
|
|
if m.v1 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV1)
|
|
}
|
|
if m.v2 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV2)
|
|
}
|
|
if m.v3 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV3)
|
|
}
|
|
if m.v4 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV4)
|
|
}
|
|
if m.v5 != nil {
|
|
fields = append(fields, scaauthpermissionrule.FieldV5)
|
|
}
|
|
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 *ScaAuthPermissionRuleMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthpermissionrule.FieldPtype:
|
|
return m.Ptype()
|
|
case scaauthpermissionrule.FieldV0:
|
|
return m.V0()
|
|
case scaauthpermissionrule.FieldV1:
|
|
return m.V1()
|
|
case scaauthpermissionrule.FieldV2:
|
|
return m.V2()
|
|
case scaauthpermissionrule.FieldV3:
|
|
return m.V3()
|
|
case scaauthpermissionrule.FieldV4:
|
|
return m.V4()
|
|
case scaauthpermissionrule.FieldV5:
|
|
return m.V5()
|
|
}
|
|
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 *ScaAuthPermissionRuleMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case scaauthpermissionrule.FieldPtype:
|
|
return m.OldPtype(ctx)
|
|
case scaauthpermissionrule.FieldV0:
|
|
return m.OldV0(ctx)
|
|
case scaauthpermissionrule.FieldV1:
|
|
return m.OldV1(ctx)
|
|
case scaauthpermissionrule.FieldV2:
|
|
return m.OldV2(ctx)
|
|
case scaauthpermissionrule.FieldV3:
|
|
return m.OldV3(ctx)
|
|
case scaauthpermissionrule.FieldV4:
|
|
return m.OldV4(ctx)
|
|
case scaauthpermissionrule.FieldV5:
|
|
return m.OldV5(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthpermissionrule.FieldPtype:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPtype(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV0:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV0(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV1:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV1(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV2:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV2(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV3:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV3(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV4:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV4(v)
|
|
return nil
|
|
case scaauthpermissionrule.FieldV5:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetV5(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) AddedFields() []string {
|
|
return nil
|
|
}
|
|
|
|
// 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 *ScaAuthPermissionRuleMutation) AddedField(name string) (ent.Value, bool) {
|
|
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 *ScaAuthPermissionRuleMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(scaauthpermissionrule.FieldV2) {
|
|
fields = append(fields, scaauthpermissionrule.FieldV2)
|
|
}
|
|
if m.FieldCleared(scaauthpermissionrule.FieldV3) {
|
|
fields = append(fields, scaauthpermissionrule.FieldV3)
|
|
}
|
|
if m.FieldCleared(scaauthpermissionrule.FieldV4) {
|
|
fields = append(fields, scaauthpermissionrule.FieldV4)
|
|
}
|
|
if m.FieldCleared(scaauthpermissionrule.FieldV5) {
|
|
fields = append(fields, scaauthpermissionrule.FieldV5)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) 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 *ScaAuthPermissionRuleMutation) ClearField(name string) error {
|
|
switch name {
|
|
case scaauthpermissionrule.FieldV2:
|
|
m.ClearV2()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV3:
|
|
m.ClearV3()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV4:
|
|
m.ClearV4()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV5:
|
|
m.ClearV5()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) ResetField(name string) error {
|
|
switch name {
|
|
case scaauthpermissionrule.FieldPtype:
|
|
m.ResetPtype()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV0:
|
|
m.ResetV0()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV1:
|
|
m.ResetV1()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV2:
|
|
m.ResetV2()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV3:
|
|
m.ResetV3()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV4:
|
|
m.ResetV4()
|
|
return nil
|
|
case scaauthpermissionrule.FieldV5:
|
|
m.ResetV5()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.sca_auth_role != nil {
|
|
edges = append(edges, scaauthpermissionrule.EdgeScaAuthRole)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthpermissionrule.EdgeScaAuthRole:
|
|
if id := m.sca_auth_role; id != nil {
|
|
return []ent.Value{*id}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedsca_auth_role {
|
|
edges = append(edges, scaauthpermissionrule.EdgeScaAuthRole)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *ScaAuthPermissionRuleMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case scaauthpermissionrule.EdgeScaAuthRole:
|
|
return m.clearedsca_auth_role
|
|
}
|
|
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 *ScaAuthPermissionRuleMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
case scaauthpermissionrule.EdgeScaAuthRole:
|
|
m.ClearScaAuthRole()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule 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 *ScaAuthPermissionRuleMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case scaauthpermissionrule.EdgeScaAuthRole:
|
|
m.ResetScaAuthRole()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthPermissionRule edge %s", name)
|
|
}
|
|
|
|
// ScaAuthRoleMutation represents an operation that mutates the ScaAuthRole nodes in the graph.
|
|
type ScaAuthRoleMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int64
|
|
role_name *string
|
|
role_key *string
|
|
created_at *time.Time
|
|
update_at *time.Time
|
|
deleted *int
|
|
adddeleted *int
|
|
clearedFields map[string]struct{}
|
|
sca_auth_permission_rule map[int64]struct{}
|
|
removedsca_auth_permission_rule map[int64]struct{}
|
|
clearedsca_auth_permission_rule bool
|
|
done bool
|
|
oldValue func(context.Context) (*ScaAuthRole, error)
|
|
predicates []predicate.ScaAuthRole
|
|
}
|
|
|
|
var _ ent.Mutation = (*ScaAuthRoleMutation)(nil)
|
|
|
|
// scaauthroleOption allows management of the mutation configuration using functional options.
|
|
type scaauthroleOption func(*ScaAuthRoleMutation)
|
|
|
|
// newScaAuthRoleMutation creates new mutation for the ScaAuthRole entity.
|
|
func newScaAuthRoleMutation(c config, op Op, opts ...scaauthroleOption) *ScaAuthRoleMutation {
|
|
m := &ScaAuthRoleMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeScaAuthRole,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withScaAuthRoleID sets the ID field of the mutation.
|
|
func withScaAuthRoleID(id int64) scaauthroleOption {
|
|
return func(m *ScaAuthRoleMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *ScaAuthRole
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*ScaAuthRole, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().ScaAuthRole.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withScaAuthRole sets the old ScaAuthRole of the mutation.
|
|
func withScaAuthRole(node *ScaAuthRole) scaauthroleOption {
|
|
return func(m *ScaAuthRoleMutation) {
|
|
m.oldValue = func(context.Context) (*ScaAuthRole, 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 ScaAuthRoleMutation) 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 ScaAuthRoleMutation) 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 ScaAuthRole entities.
|
|
func (m *ScaAuthRoleMutation) 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 *ScaAuthRoleMutation) 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 *ScaAuthRoleMutation) 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().ScaAuthRole.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetRoleName sets the "role_name" field.
|
|
func (m *ScaAuthRoleMutation) SetRoleName(s string) {
|
|
m.role_name = &s
|
|
}
|
|
|
|
// RoleName returns the value of the "role_name" field in the mutation.
|
|
func (m *ScaAuthRoleMutation) RoleName() (r string, exists bool) {
|
|
v := m.role_name
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRoleName returns the old "role_name" field's value of the ScaAuthRole entity.
|
|
// If the ScaAuthRole 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 *ScaAuthRoleMutation) OldRoleName(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldRoleName is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldRoleName requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRoleName: %w", err)
|
|
}
|
|
return oldValue.RoleName, nil
|
|
}
|
|
|
|
// ResetRoleName resets all changes to the "role_name" field.
|
|
func (m *ScaAuthRoleMutation) ResetRoleName() {
|
|
m.role_name = nil
|
|
}
|
|
|
|
// SetRoleKey sets the "role_key" field.
|
|
func (m *ScaAuthRoleMutation) SetRoleKey(s string) {
|
|
m.role_key = &s
|
|
}
|
|
|
|
// RoleKey returns the value of the "role_key" field in the mutation.
|
|
func (m *ScaAuthRoleMutation) RoleKey() (r string, exists bool) {
|
|
v := m.role_key
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRoleKey returns the old "role_key" field's value of the ScaAuthRole entity.
|
|
// If the ScaAuthRole 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 *ScaAuthRoleMutation) OldRoleKey(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldRoleKey is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldRoleKey requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRoleKey: %w", err)
|
|
}
|
|
return oldValue.RoleKey, nil
|
|
}
|
|
|
|
// ResetRoleKey resets all changes to the "role_key" field.
|
|
func (m *ScaAuthRoleMutation) ResetRoleKey() {
|
|
m.role_key = nil
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *ScaAuthRoleMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *ScaAuthRoleMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the ScaAuthRole entity.
|
|
// If the ScaAuthRole 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 *ScaAuthRoleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *ScaAuthRoleMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
}
|
|
|
|
// SetUpdateAt sets the "update_at" field.
|
|
func (m *ScaAuthRoleMutation) SetUpdateAt(t time.Time) {
|
|
m.update_at = &t
|
|
}
|
|
|
|
// UpdateAt returns the value of the "update_at" field in the mutation.
|
|
func (m *ScaAuthRoleMutation) UpdateAt() (r time.Time, exists bool) {
|
|
v := m.update_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdateAt returns the old "update_at" field's value of the ScaAuthRole entity.
|
|
// If the ScaAuthRole 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 *ScaAuthRoleMutation) OldUpdateAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUpdateAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUpdateAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdateAt: %w", err)
|
|
}
|
|
return oldValue.UpdateAt, nil
|
|
}
|
|
|
|
// ResetUpdateAt resets all changes to the "update_at" field.
|
|
func (m *ScaAuthRoleMutation) ResetUpdateAt() {
|
|
m.update_at = nil
|
|
}
|
|
|
|
// SetDeleted sets the "deleted" field.
|
|
func (m *ScaAuthRoleMutation) SetDeleted(i int) {
|
|
m.deleted = &i
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// Deleted returns the value of the "deleted" field in the mutation.
|
|
func (m *ScaAuthRoleMutation) Deleted() (r int, exists bool) {
|
|
v := m.deleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDeleted returns the old "deleted" field's value of the ScaAuthRole entity.
|
|
// If the ScaAuthRole 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 *ScaAuthRoleMutation) OldDeleted(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDeleted requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
|
|
}
|
|
return oldValue.Deleted, nil
|
|
}
|
|
|
|
// AddDeleted adds i to the "deleted" field.
|
|
func (m *ScaAuthRoleMutation) AddDeleted(i int) {
|
|
if m.adddeleted != nil {
|
|
*m.adddeleted += i
|
|
} else {
|
|
m.adddeleted = &i
|
|
}
|
|
}
|
|
|
|
// AddedDeleted returns the value that was added to the "deleted" field in this mutation.
|
|
func (m *ScaAuthRoleMutation) AddedDeleted() (r int, exists bool) {
|
|
v := m.adddeleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetDeleted resets all changes to the "deleted" field.
|
|
func (m *ScaAuthRoleMutation) ResetDeleted() {
|
|
m.deleted = nil
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// AddScaAuthPermissionRuleIDs adds the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by ids.
|
|
func (m *ScaAuthRoleMutation) AddScaAuthPermissionRuleIDs(ids ...int64) {
|
|
if m.sca_auth_permission_rule == nil {
|
|
m.sca_auth_permission_rule = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.sca_auth_permission_rule[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearScaAuthPermissionRule clears the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity.
|
|
func (m *ScaAuthRoleMutation) ClearScaAuthPermissionRule() {
|
|
m.clearedsca_auth_permission_rule = true
|
|
}
|
|
|
|
// ScaAuthPermissionRuleCleared reports if the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity was cleared.
|
|
func (m *ScaAuthRoleMutation) ScaAuthPermissionRuleCleared() bool {
|
|
return m.clearedsca_auth_permission_rule
|
|
}
|
|
|
|
// RemoveScaAuthPermissionRuleIDs removes the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by IDs.
|
|
func (m *ScaAuthRoleMutation) RemoveScaAuthPermissionRuleIDs(ids ...int64) {
|
|
if m.removedsca_auth_permission_rule == nil {
|
|
m.removedsca_auth_permission_rule = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.sca_auth_permission_rule, ids[i])
|
|
m.removedsca_auth_permission_rule[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedScaAuthPermissionRule returns the removed IDs of the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity.
|
|
func (m *ScaAuthRoleMutation) RemovedScaAuthPermissionRuleIDs() (ids []int64) {
|
|
for id := range m.removedsca_auth_permission_rule {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthPermissionRuleIDs returns the "sca_auth_permission_rule" edge IDs in the mutation.
|
|
func (m *ScaAuthRoleMutation) ScaAuthPermissionRuleIDs() (ids []int64) {
|
|
for id := range m.sca_auth_permission_rule {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthPermissionRule resets all changes to the "sca_auth_permission_rule" edge.
|
|
func (m *ScaAuthRoleMutation) ResetScaAuthPermissionRule() {
|
|
m.sca_auth_permission_rule = nil
|
|
m.clearedsca_auth_permission_rule = false
|
|
m.removedsca_auth_permission_rule = nil
|
|
}
|
|
|
|
// Where appends a list predicates to the ScaAuthRoleMutation builder.
|
|
func (m *ScaAuthRoleMutation) Where(ps ...predicate.ScaAuthRole) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the ScaAuthRoleMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *ScaAuthRoleMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.ScaAuthRole, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *ScaAuthRoleMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *ScaAuthRoleMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (ScaAuthRole).
|
|
func (m *ScaAuthRoleMutation) 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 *ScaAuthRoleMutation) Fields() []string {
|
|
fields := make([]string, 0, 5)
|
|
if m.role_name != nil {
|
|
fields = append(fields, scaauthrole.FieldRoleName)
|
|
}
|
|
if m.role_key != nil {
|
|
fields = append(fields, scaauthrole.FieldRoleKey)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, scaauthrole.FieldCreatedAt)
|
|
}
|
|
if m.update_at != nil {
|
|
fields = append(fields, scaauthrole.FieldUpdateAt)
|
|
}
|
|
if m.deleted != nil {
|
|
fields = append(fields, scaauthrole.FieldDeleted)
|
|
}
|
|
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 *ScaAuthRoleMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthrole.FieldRoleName:
|
|
return m.RoleName()
|
|
case scaauthrole.FieldRoleKey:
|
|
return m.RoleKey()
|
|
case scaauthrole.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
case scaauthrole.FieldUpdateAt:
|
|
return m.UpdateAt()
|
|
case scaauthrole.FieldDeleted:
|
|
return m.Deleted()
|
|
}
|
|
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 *ScaAuthRoleMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case scaauthrole.FieldRoleName:
|
|
return m.OldRoleName(ctx)
|
|
case scaauthrole.FieldRoleKey:
|
|
return m.OldRoleKey(ctx)
|
|
case scaauthrole.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
case scaauthrole.FieldUpdateAt:
|
|
return m.OldUpdateAt(ctx)
|
|
case scaauthrole.FieldDeleted:
|
|
return m.OldDeleted(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown ScaAuthRole 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 *ScaAuthRoleMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthrole.FieldRoleName:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRoleName(v)
|
|
return nil
|
|
case scaauthrole.FieldRoleKey:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRoleKey(v)
|
|
return nil
|
|
case scaauthrole.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
case scaauthrole.FieldUpdateAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdateAt(v)
|
|
return nil
|
|
case scaauthrole.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDeleted(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthRole field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *ScaAuthRoleMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.adddeleted != nil {
|
|
fields = append(fields, scaauthrole.FieldDeleted)
|
|
}
|
|
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 *ScaAuthRoleMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthrole.FieldDeleted:
|
|
return m.AddedDeleted()
|
|
}
|
|
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 *ScaAuthRoleMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthrole.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddDeleted(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthRole numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *ScaAuthRoleMutation) ClearedFields() []string {
|
|
return nil
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *ScaAuthRoleMutation) 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 *ScaAuthRoleMutation) ClearField(name string) error {
|
|
return fmt.Errorf("unknown ScaAuthRole 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 *ScaAuthRoleMutation) ResetField(name string) error {
|
|
switch name {
|
|
case scaauthrole.FieldRoleName:
|
|
m.ResetRoleName()
|
|
return nil
|
|
case scaauthrole.FieldRoleKey:
|
|
m.ResetRoleKey()
|
|
return nil
|
|
case scaauthrole.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
case scaauthrole.FieldUpdateAt:
|
|
m.ResetUpdateAt()
|
|
return nil
|
|
case scaauthrole.FieldDeleted:
|
|
m.ResetDeleted()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthRole field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *ScaAuthRoleMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.sca_auth_permission_rule != nil {
|
|
edges = append(edges, scaauthrole.EdgeScaAuthPermissionRule)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *ScaAuthRoleMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthrole.EdgeScaAuthPermissionRule:
|
|
ids := make([]ent.Value, 0, len(m.sca_auth_permission_rule))
|
|
for id := range m.sca_auth_permission_rule {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *ScaAuthRoleMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.removedsca_auth_permission_rule != nil {
|
|
edges = append(edges, scaauthrole.EdgeScaAuthPermissionRule)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *ScaAuthRoleMutation) RemovedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthrole.EdgeScaAuthPermissionRule:
|
|
ids := make([]ent.Value, 0, len(m.removedsca_auth_permission_rule))
|
|
for id := range m.removedsca_auth_permission_rule {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *ScaAuthRoleMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedsca_auth_permission_rule {
|
|
edges = append(edges, scaauthrole.EdgeScaAuthPermissionRule)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *ScaAuthRoleMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case scaauthrole.EdgeScaAuthPermissionRule:
|
|
return m.clearedsca_auth_permission_rule
|
|
}
|
|
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 *ScaAuthRoleMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthRole 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 *ScaAuthRoleMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case scaauthrole.EdgeScaAuthPermissionRule:
|
|
m.ResetScaAuthPermissionRule()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthRole edge %s", name)
|
|
}
|
|
|
|
// ScaAuthUserMutation represents an operation that mutates the ScaAuthUser nodes in the graph.
|
|
type ScaAuthUserMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int64
|
|
uid *string
|
|
username *string
|
|
nickname *string
|
|
email *string
|
|
phone *string
|
|
password *string
|
|
gender *string
|
|
avatar *string
|
|
status *int8
|
|
addstatus *int8
|
|
introduce *string
|
|
created_at *time.Time
|
|
update_at *time.Time
|
|
deleted *int8
|
|
adddeleted *int8
|
|
blog *string
|
|
location *string
|
|
company *string
|
|
clearedFields map[string]struct{}
|
|
sca_auth_user_social map[int64]struct{}
|
|
removedsca_auth_user_social map[int64]struct{}
|
|
clearedsca_auth_user_social bool
|
|
sca_auth_user_device map[int64]struct{}
|
|
removedsca_auth_user_device map[int64]struct{}
|
|
clearedsca_auth_user_device bool
|
|
done bool
|
|
oldValue func(context.Context) (*ScaAuthUser, error)
|
|
predicates []predicate.ScaAuthUser
|
|
}
|
|
|
|
var _ ent.Mutation = (*ScaAuthUserMutation)(nil)
|
|
|
|
// scaauthuserOption allows management of the mutation configuration using functional options.
|
|
type scaauthuserOption func(*ScaAuthUserMutation)
|
|
|
|
// newScaAuthUserMutation creates new mutation for the ScaAuthUser entity.
|
|
func newScaAuthUserMutation(c config, op Op, opts ...scaauthuserOption) *ScaAuthUserMutation {
|
|
m := &ScaAuthUserMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeScaAuthUser,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withScaAuthUserID sets the ID field of the mutation.
|
|
func withScaAuthUserID(id int64) scaauthuserOption {
|
|
return func(m *ScaAuthUserMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *ScaAuthUser
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*ScaAuthUser, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().ScaAuthUser.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withScaAuthUser sets the old ScaAuthUser of the mutation.
|
|
func withScaAuthUser(node *ScaAuthUser) scaauthuserOption {
|
|
return func(m *ScaAuthUserMutation) {
|
|
m.oldValue = func(context.Context) (*ScaAuthUser, 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 ScaAuthUserMutation) 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 ScaAuthUserMutation) 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 ScaAuthUser entities.
|
|
func (m *ScaAuthUserMutation) 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 *ScaAuthUserMutation) 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 *ScaAuthUserMutation) 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().ScaAuthUser.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetUID sets the "uid" field.
|
|
func (m *ScaAuthUserMutation) SetUID(s string) {
|
|
m.uid = &s
|
|
}
|
|
|
|
// UID returns the value of the "uid" field in the mutation.
|
|
func (m *ScaAuthUserMutation) UID() (r string, exists bool) {
|
|
v := m.uid
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUID returns the old "uid" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldUID(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUID is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUID requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUID: %w", err)
|
|
}
|
|
return oldValue.UID, nil
|
|
}
|
|
|
|
// ResetUID resets all changes to the "uid" field.
|
|
func (m *ScaAuthUserMutation) ResetUID() {
|
|
m.uid = nil
|
|
}
|
|
|
|
// SetUsername sets the "username" field.
|
|
func (m *ScaAuthUserMutation) SetUsername(s string) {
|
|
m.username = &s
|
|
}
|
|
|
|
// Username returns the value of the "username" field in the mutation.
|
|
func (m *ScaAuthUserMutation) 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 ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) 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
|
|
}
|
|
|
|
// ClearUsername clears the value of the "username" field.
|
|
func (m *ScaAuthUserMutation) ClearUsername() {
|
|
m.username = nil
|
|
m.clearedFields[scaauthuser.FieldUsername] = struct{}{}
|
|
}
|
|
|
|
// UsernameCleared returns if the "username" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) UsernameCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldUsername]
|
|
return ok
|
|
}
|
|
|
|
// ResetUsername resets all changes to the "username" field.
|
|
func (m *ScaAuthUserMutation) ResetUsername() {
|
|
m.username = nil
|
|
delete(m.clearedFields, scaauthuser.FieldUsername)
|
|
}
|
|
|
|
// SetNickname sets the "nickname" field.
|
|
func (m *ScaAuthUserMutation) SetNickname(s string) {
|
|
m.nickname = &s
|
|
}
|
|
|
|
// Nickname returns the value of the "nickname" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Nickname() (r string, exists bool) {
|
|
v := m.nickname
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldNickname returns the old "nickname" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldNickname(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldNickname is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldNickname requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldNickname: %w", err)
|
|
}
|
|
return oldValue.Nickname, nil
|
|
}
|
|
|
|
// ClearNickname clears the value of the "nickname" field.
|
|
func (m *ScaAuthUserMutation) ClearNickname() {
|
|
m.nickname = nil
|
|
m.clearedFields[scaauthuser.FieldNickname] = struct{}{}
|
|
}
|
|
|
|
// NicknameCleared returns if the "nickname" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) NicknameCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldNickname]
|
|
return ok
|
|
}
|
|
|
|
// ResetNickname resets all changes to the "nickname" field.
|
|
func (m *ScaAuthUserMutation) ResetNickname() {
|
|
m.nickname = nil
|
|
delete(m.clearedFields, scaauthuser.FieldNickname)
|
|
}
|
|
|
|
// SetEmail sets the "email" field.
|
|
func (m *ScaAuthUserMutation) SetEmail(s string) {
|
|
m.email = &s
|
|
}
|
|
|
|
// Email returns the value of the "email" field in the mutation.
|
|
func (m *ScaAuthUserMutation) 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 ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) 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
|
|
}
|
|
|
|
// ClearEmail clears the value of the "email" field.
|
|
func (m *ScaAuthUserMutation) ClearEmail() {
|
|
m.email = nil
|
|
m.clearedFields[scaauthuser.FieldEmail] = struct{}{}
|
|
}
|
|
|
|
// EmailCleared returns if the "email" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) EmailCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldEmail]
|
|
return ok
|
|
}
|
|
|
|
// ResetEmail resets all changes to the "email" field.
|
|
func (m *ScaAuthUserMutation) ResetEmail() {
|
|
m.email = nil
|
|
delete(m.clearedFields, scaauthuser.FieldEmail)
|
|
}
|
|
|
|
// SetPhone sets the "phone" field.
|
|
func (m *ScaAuthUserMutation) SetPhone(s string) {
|
|
m.phone = &s
|
|
}
|
|
|
|
// Phone returns the value of the "phone" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Phone() (r string, exists bool) {
|
|
v := m.phone
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPhone returns the old "phone" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldPhone(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPhone is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPhone requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPhone: %w", err)
|
|
}
|
|
return oldValue.Phone, nil
|
|
}
|
|
|
|
// ClearPhone clears the value of the "phone" field.
|
|
func (m *ScaAuthUserMutation) ClearPhone() {
|
|
m.phone = nil
|
|
m.clearedFields[scaauthuser.FieldPhone] = struct{}{}
|
|
}
|
|
|
|
// PhoneCleared returns if the "phone" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) PhoneCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldPhone]
|
|
return ok
|
|
}
|
|
|
|
// ResetPhone resets all changes to the "phone" field.
|
|
func (m *ScaAuthUserMutation) ResetPhone() {
|
|
m.phone = nil
|
|
delete(m.clearedFields, scaauthuser.FieldPhone)
|
|
}
|
|
|
|
// SetPassword sets the "password" field.
|
|
func (m *ScaAuthUserMutation) SetPassword(s string) {
|
|
m.password = &s
|
|
}
|
|
|
|
// Password returns the value of the "password" field in the mutation.
|
|
func (m *ScaAuthUserMutation) 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 ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) 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
|
|
}
|
|
|
|
// ClearPassword clears the value of the "password" field.
|
|
func (m *ScaAuthUserMutation) ClearPassword() {
|
|
m.password = nil
|
|
m.clearedFields[scaauthuser.FieldPassword] = struct{}{}
|
|
}
|
|
|
|
// PasswordCleared returns if the "password" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) PasswordCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldPassword]
|
|
return ok
|
|
}
|
|
|
|
// ResetPassword resets all changes to the "password" field.
|
|
func (m *ScaAuthUserMutation) ResetPassword() {
|
|
m.password = nil
|
|
delete(m.clearedFields, scaauthuser.FieldPassword)
|
|
}
|
|
|
|
// SetGender sets the "gender" field.
|
|
func (m *ScaAuthUserMutation) SetGender(s string) {
|
|
m.gender = &s
|
|
}
|
|
|
|
// Gender returns the value of the "gender" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Gender() (r string, exists bool) {
|
|
v := m.gender
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGender returns the old "gender" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldGender(ctx context.Context) (v string, 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
|
|
}
|
|
|
|
// ClearGender clears the value of the "gender" field.
|
|
func (m *ScaAuthUserMutation) ClearGender() {
|
|
m.gender = nil
|
|
m.clearedFields[scaauthuser.FieldGender] = struct{}{}
|
|
}
|
|
|
|
// GenderCleared returns if the "gender" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) GenderCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldGender]
|
|
return ok
|
|
}
|
|
|
|
// ResetGender resets all changes to the "gender" field.
|
|
func (m *ScaAuthUserMutation) ResetGender() {
|
|
m.gender = nil
|
|
delete(m.clearedFields, scaauthuser.FieldGender)
|
|
}
|
|
|
|
// SetAvatar sets the "avatar" field.
|
|
func (m *ScaAuthUserMutation) SetAvatar(s string) {
|
|
m.avatar = &s
|
|
}
|
|
|
|
// Avatar returns the value of the "avatar" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Avatar() (r string, exists bool) {
|
|
v := m.avatar
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldAvatar returns the old "avatar" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldAvatar(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldAvatar is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldAvatar requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldAvatar: %w", err)
|
|
}
|
|
return oldValue.Avatar, nil
|
|
}
|
|
|
|
// ClearAvatar clears the value of the "avatar" field.
|
|
func (m *ScaAuthUserMutation) ClearAvatar() {
|
|
m.avatar = nil
|
|
m.clearedFields[scaauthuser.FieldAvatar] = struct{}{}
|
|
}
|
|
|
|
// AvatarCleared returns if the "avatar" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) AvatarCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldAvatar]
|
|
return ok
|
|
}
|
|
|
|
// ResetAvatar resets all changes to the "avatar" field.
|
|
func (m *ScaAuthUserMutation) ResetAvatar() {
|
|
m.avatar = nil
|
|
delete(m.clearedFields, scaauthuser.FieldAvatar)
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (m *ScaAuthUserMutation) SetStatus(i int8) {
|
|
m.status = &i
|
|
m.addstatus = nil
|
|
}
|
|
|
|
// Status returns the value of the "status" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Status() (r int8, exists bool) {
|
|
v := m.status
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldStatus returns the old "status" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldStatus(ctx context.Context) (v int8, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldStatus is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldStatus requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldStatus: %w", err)
|
|
}
|
|
return oldValue.Status, nil
|
|
}
|
|
|
|
// AddStatus adds i to the "status" field.
|
|
func (m *ScaAuthUserMutation) AddStatus(i int8) {
|
|
if m.addstatus != nil {
|
|
*m.addstatus += i
|
|
} else {
|
|
m.addstatus = &i
|
|
}
|
|
}
|
|
|
|
// AddedStatus returns the value that was added to the "status" field in this mutation.
|
|
func (m *ScaAuthUserMutation) AddedStatus() (r int8, exists bool) {
|
|
v := m.addstatus
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (m *ScaAuthUserMutation) ClearStatus() {
|
|
m.status = nil
|
|
m.addstatus = nil
|
|
m.clearedFields[scaauthuser.FieldStatus] = struct{}{}
|
|
}
|
|
|
|
// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) StatusCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldStatus]
|
|
return ok
|
|
}
|
|
|
|
// ResetStatus resets all changes to the "status" field.
|
|
func (m *ScaAuthUserMutation) ResetStatus() {
|
|
m.status = nil
|
|
m.addstatus = nil
|
|
delete(m.clearedFields, scaauthuser.FieldStatus)
|
|
}
|
|
|
|
// SetIntroduce sets the "introduce" field.
|
|
func (m *ScaAuthUserMutation) SetIntroduce(s string) {
|
|
m.introduce = &s
|
|
}
|
|
|
|
// Introduce returns the value of the "introduce" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Introduce() (r string, exists bool) {
|
|
v := m.introduce
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldIntroduce returns the old "introduce" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldIntroduce(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldIntroduce is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldIntroduce requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldIntroduce: %w", err)
|
|
}
|
|
return oldValue.Introduce, nil
|
|
}
|
|
|
|
// ClearIntroduce clears the value of the "introduce" field.
|
|
func (m *ScaAuthUserMutation) ClearIntroduce() {
|
|
m.introduce = nil
|
|
m.clearedFields[scaauthuser.FieldIntroduce] = struct{}{}
|
|
}
|
|
|
|
// IntroduceCleared returns if the "introduce" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) IntroduceCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldIntroduce]
|
|
return ok
|
|
}
|
|
|
|
// ResetIntroduce resets all changes to the "introduce" field.
|
|
func (m *ScaAuthUserMutation) ResetIntroduce() {
|
|
m.introduce = nil
|
|
delete(m.clearedFields, scaauthuser.FieldIntroduce)
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *ScaAuthUserMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *ScaAuthUserMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *ScaAuthUserMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
}
|
|
|
|
// SetUpdateAt sets the "update_at" field.
|
|
func (m *ScaAuthUserMutation) SetUpdateAt(t time.Time) {
|
|
m.update_at = &t
|
|
}
|
|
|
|
// UpdateAt returns the value of the "update_at" field in the mutation.
|
|
func (m *ScaAuthUserMutation) UpdateAt() (r time.Time, exists bool) {
|
|
v := m.update_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdateAt returns the old "update_at" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldUpdateAt(ctx context.Context) (v *time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUpdateAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUpdateAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdateAt: %w", err)
|
|
}
|
|
return oldValue.UpdateAt, nil
|
|
}
|
|
|
|
// ClearUpdateAt clears the value of the "update_at" field.
|
|
func (m *ScaAuthUserMutation) ClearUpdateAt() {
|
|
m.update_at = nil
|
|
m.clearedFields[scaauthuser.FieldUpdateAt] = struct{}{}
|
|
}
|
|
|
|
// UpdateAtCleared returns if the "update_at" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) UpdateAtCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldUpdateAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetUpdateAt resets all changes to the "update_at" field.
|
|
func (m *ScaAuthUserMutation) ResetUpdateAt() {
|
|
m.update_at = nil
|
|
delete(m.clearedFields, scaauthuser.FieldUpdateAt)
|
|
}
|
|
|
|
// SetDeleted sets the "deleted" field.
|
|
func (m *ScaAuthUserMutation) SetDeleted(i int8) {
|
|
m.deleted = &i
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// Deleted returns the value of the "deleted" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Deleted() (r int8, exists bool) {
|
|
v := m.deleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDeleted returns the old "deleted" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldDeleted(ctx context.Context) (v int8, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDeleted requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
|
|
}
|
|
return oldValue.Deleted, nil
|
|
}
|
|
|
|
// AddDeleted adds i to the "deleted" field.
|
|
func (m *ScaAuthUserMutation) AddDeleted(i int8) {
|
|
if m.adddeleted != nil {
|
|
*m.adddeleted += i
|
|
} else {
|
|
m.adddeleted = &i
|
|
}
|
|
}
|
|
|
|
// AddedDeleted returns the value that was added to the "deleted" field in this mutation.
|
|
func (m *ScaAuthUserMutation) AddedDeleted() (r int8, exists bool) {
|
|
v := m.adddeleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetDeleted resets all changes to the "deleted" field.
|
|
func (m *ScaAuthUserMutation) ResetDeleted() {
|
|
m.deleted = nil
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// SetBlog sets the "blog" field.
|
|
func (m *ScaAuthUserMutation) SetBlog(s string) {
|
|
m.blog = &s
|
|
}
|
|
|
|
// Blog returns the value of the "blog" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Blog() (r string, exists bool) {
|
|
v := m.blog
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBlog returns the old "blog" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldBlog(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBlog is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBlog requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBlog: %w", err)
|
|
}
|
|
return oldValue.Blog, nil
|
|
}
|
|
|
|
// ClearBlog clears the value of the "blog" field.
|
|
func (m *ScaAuthUserMutation) ClearBlog() {
|
|
m.blog = nil
|
|
m.clearedFields[scaauthuser.FieldBlog] = struct{}{}
|
|
}
|
|
|
|
// BlogCleared returns if the "blog" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) BlogCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldBlog]
|
|
return ok
|
|
}
|
|
|
|
// ResetBlog resets all changes to the "blog" field.
|
|
func (m *ScaAuthUserMutation) ResetBlog() {
|
|
m.blog = nil
|
|
delete(m.clearedFields, scaauthuser.FieldBlog)
|
|
}
|
|
|
|
// SetLocation sets the "location" field.
|
|
func (m *ScaAuthUserMutation) SetLocation(s string) {
|
|
m.location = &s
|
|
}
|
|
|
|
// Location returns the value of the "location" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Location() (r string, exists bool) {
|
|
v := m.location
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocation returns the old "location" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldLocation(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocation is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocation requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocation: %w", err)
|
|
}
|
|
return oldValue.Location, nil
|
|
}
|
|
|
|
// ClearLocation clears the value of the "location" field.
|
|
func (m *ScaAuthUserMutation) ClearLocation() {
|
|
m.location = nil
|
|
m.clearedFields[scaauthuser.FieldLocation] = struct{}{}
|
|
}
|
|
|
|
// LocationCleared returns if the "location" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) LocationCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldLocation]
|
|
return ok
|
|
}
|
|
|
|
// ResetLocation resets all changes to the "location" field.
|
|
func (m *ScaAuthUserMutation) ResetLocation() {
|
|
m.location = nil
|
|
delete(m.clearedFields, scaauthuser.FieldLocation)
|
|
}
|
|
|
|
// SetCompany sets the "company" field.
|
|
func (m *ScaAuthUserMutation) SetCompany(s string) {
|
|
m.company = &s
|
|
}
|
|
|
|
// Company returns the value of the "company" field in the mutation.
|
|
func (m *ScaAuthUserMutation) Company() (r string, exists bool) {
|
|
v := m.company
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCompany returns the old "company" field's value of the ScaAuthUser entity.
|
|
// If the ScaAuthUser 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 *ScaAuthUserMutation) OldCompany(ctx context.Context) (v *string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCompany is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCompany requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCompany: %w", err)
|
|
}
|
|
return oldValue.Company, nil
|
|
}
|
|
|
|
// ClearCompany clears the value of the "company" field.
|
|
func (m *ScaAuthUserMutation) ClearCompany() {
|
|
m.company = nil
|
|
m.clearedFields[scaauthuser.FieldCompany] = struct{}{}
|
|
}
|
|
|
|
// CompanyCleared returns if the "company" field was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) CompanyCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuser.FieldCompany]
|
|
return ok
|
|
}
|
|
|
|
// ResetCompany resets all changes to the "company" field.
|
|
func (m *ScaAuthUserMutation) ResetCompany() {
|
|
m.company = nil
|
|
delete(m.clearedFields, scaauthuser.FieldCompany)
|
|
}
|
|
|
|
// AddScaAuthUserSocialIDs adds the "sca_auth_user_social" edge to the ScaAuthUserSocial entity by ids.
|
|
func (m *ScaAuthUserMutation) AddScaAuthUserSocialIDs(ids ...int64) {
|
|
if m.sca_auth_user_social == nil {
|
|
m.sca_auth_user_social = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.sca_auth_user_social[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearScaAuthUserSocial clears the "sca_auth_user_social" edge to the ScaAuthUserSocial entity.
|
|
func (m *ScaAuthUserMutation) ClearScaAuthUserSocial() {
|
|
m.clearedsca_auth_user_social = true
|
|
}
|
|
|
|
// ScaAuthUserSocialCleared reports if the "sca_auth_user_social" edge to the ScaAuthUserSocial entity was cleared.
|
|
func (m *ScaAuthUserMutation) ScaAuthUserSocialCleared() bool {
|
|
return m.clearedsca_auth_user_social
|
|
}
|
|
|
|
// RemoveScaAuthUserSocialIDs removes the "sca_auth_user_social" edge to the ScaAuthUserSocial entity by IDs.
|
|
func (m *ScaAuthUserMutation) RemoveScaAuthUserSocialIDs(ids ...int64) {
|
|
if m.removedsca_auth_user_social == nil {
|
|
m.removedsca_auth_user_social = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.sca_auth_user_social, ids[i])
|
|
m.removedsca_auth_user_social[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedScaAuthUserSocial returns the removed IDs of the "sca_auth_user_social" edge to the ScaAuthUserSocial entity.
|
|
func (m *ScaAuthUserMutation) RemovedScaAuthUserSocialIDs() (ids []int64) {
|
|
for id := range m.removedsca_auth_user_social {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthUserSocialIDs returns the "sca_auth_user_social" edge IDs in the mutation.
|
|
func (m *ScaAuthUserMutation) ScaAuthUserSocialIDs() (ids []int64) {
|
|
for id := range m.sca_auth_user_social {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthUserSocial resets all changes to the "sca_auth_user_social" edge.
|
|
func (m *ScaAuthUserMutation) ResetScaAuthUserSocial() {
|
|
m.sca_auth_user_social = nil
|
|
m.clearedsca_auth_user_social = false
|
|
m.removedsca_auth_user_social = nil
|
|
}
|
|
|
|
// AddScaAuthUserDeviceIDs adds the "sca_auth_user_device" edge to the ScaAuthUserDevice entity by ids.
|
|
func (m *ScaAuthUserMutation) AddScaAuthUserDeviceIDs(ids ...int64) {
|
|
if m.sca_auth_user_device == nil {
|
|
m.sca_auth_user_device = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.sca_auth_user_device[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearScaAuthUserDevice clears the "sca_auth_user_device" edge to the ScaAuthUserDevice entity.
|
|
func (m *ScaAuthUserMutation) ClearScaAuthUserDevice() {
|
|
m.clearedsca_auth_user_device = true
|
|
}
|
|
|
|
// ScaAuthUserDeviceCleared reports if the "sca_auth_user_device" edge to the ScaAuthUserDevice entity was cleared.
|
|
func (m *ScaAuthUserMutation) ScaAuthUserDeviceCleared() bool {
|
|
return m.clearedsca_auth_user_device
|
|
}
|
|
|
|
// RemoveScaAuthUserDeviceIDs removes the "sca_auth_user_device" edge to the ScaAuthUserDevice entity by IDs.
|
|
func (m *ScaAuthUserMutation) RemoveScaAuthUserDeviceIDs(ids ...int64) {
|
|
if m.removedsca_auth_user_device == nil {
|
|
m.removedsca_auth_user_device = make(map[int64]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.sca_auth_user_device, ids[i])
|
|
m.removedsca_auth_user_device[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedScaAuthUserDevice returns the removed IDs of the "sca_auth_user_device" edge to the ScaAuthUserDevice entity.
|
|
func (m *ScaAuthUserMutation) RemovedScaAuthUserDeviceIDs() (ids []int64) {
|
|
for id := range m.removedsca_auth_user_device {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthUserDeviceIDs returns the "sca_auth_user_device" edge IDs in the mutation.
|
|
func (m *ScaAuthUserMutation) ScaAuthUserDeviceIDs() (ids []int64) {
|
|
for id := range m.sca_auth_user_device {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthUserDevice resets all changes to the "sca_auth_user_device" edge.
|
|
func (m *ScaAuthUserMutation) ResetScaAuthUserDevice() {
|
|
m.sca_auth_user_device = nil
|
|
m.clearedsca_auth_user_device = false
|
|
m.removedsca_auth_user_device = nil
|
|
}
|
|
|
|
// Where appends a list predicates to the ScaAuthUserMutation builder.
|
|
func (m *ScaAuthUserMutation) Where(ps ...predicate.ScaAuthUser) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the ScaAuthUserMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *ScaAuthUserMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.ScaAuthUser, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *ScaAuthUserMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *ScaAuthUserMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (ScaAuthUser).
|
|
func (m *ScaAuthUserMutation) 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 *ScaAuthUserMutation) Fields() []string {
|
|
fields := make([]string, 0, 16)
|
|
if m.uid != nil {
|
|
fields = append(fields, scaauthuser.FieldUID)
|
|
}
|
|
if m.username != nil {
|
|
fields = append(fields, scaauthuser.FieldUsername)
|
|
}
|
|
if m.nickname != nil {
|
|
fields = append(fields, scaauthuser.FieldNickname)
|
|
}
|
|
if m.email != nil {
|
|
fields = append(fields, scaauthuser.FieldEmail)
|
|
}
|
|
if m.phone != nil {
|
|
fields = append(fields, scaauthuser.FieldPhone)
|
|
}
|
|
if m.password != nil {
|
|
fields = append(fields, scaauthuser.FieldPassword)
|
|
}
|
|
if m.gender != nil {
|
|
fields = append(fields, scaauthuser.FieldGender)
|
|
}
|
|
if m.avatar != nil {
|
|
fields = append(fields, scaauthuser.FieldAvatar)
|
|
}
|
|
if m.status != nil {
|
|
fields = append(fields, scaauthuser.FieldStatus)
|
|
}
|
|
if m.introduce != nil {
|
|
fields = append(fields, scaauthuser.FieldIntroduce)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, scaauthuser.FieldCreatedAt)
|
|
}
|
|
if m.update_at != nil {
|
|
fields = append(fields, scaauthuser.FieldUpdateAt)
|
|
}
|
|
if m.deleted != nil {
|
|
fields = append(fields, scaauthuser.FieldDeleted)
|
|
}
|
|
if m.blog != nil {
|
|
fields = append(fields, scaauthuser.FieldBlog)
|
|
}
|
|
if m.location != nil {
|
|
fields = append(fields, scaauthuser.FieldLocation)
|
|
}
|
|
if m.company != nil {
|
|
fields = append(fields, scaauthuser.FieldCompany)
|
|
}
|
|
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 *ScaAuthUserMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthuser.FieldUID:
|
|
return m.UID()
|
|
case scaauthuser.FieldUsername:
|
|
return m.Username()
|
|
case scaauthuser.FieldNickname:
|
|
return m.Nickname()
|
|
case scaauthuser.FieldEmail:
|
|
return m.Email()
|
|
case scaauthuser.FieldPhone:
|
|
return m.Phone()
|
|
case scaauthuser.FieldPassword:
|
|
return m.Password()
|
|
case scaauthuser.FieldGender:
|
|
return m.Gender()
|
|
case scaauthuser.FieldAvatar:
|
|
return m.Avatar()
|
|
case scaauthuser.FieldStatus:
|
|
return m.Status()
|
|
case scaauthuser.FieldIntroduce:
|
|
return m.Introduce()
|
|
case scaauthuser.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
case scaauthuser.FieldUpdateAt:
|
|
return m.UpdateAt()
|
|
case scaauthuser.FieldDeleted:
|
|
return m.Deleted()
|
|
case scaauthuser.FieldBlog:
|
|
return m.Blog()
|
|
case scaauthuser.FieldLocation:
|
|
return m.Location()
|
|
case scaauthuser.FieldCompany:
|
|
return m.Company()
|
|
}
|
|
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 *ScaAuthUserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case scaauthuser.FieldUID:
|
|
return m.OldUID(ctx)
|
|
case scaauthuser.FieldUsername:
|
|
return m.OldUsername(ctx)
|
|
case scaauthuser.FieldNickname:
|
|
return m.OldNickname(ctx)
|
|
case scaauthuser.FieldEmail:
|
|
return m.OldEmail(ctx)
|
|
case scaauthuser.FieldPhone:
|
|
return m.OldPhone(ctx)
|
|
case scaauthuser.FieldPassword:
|
|
return m.OldPassword(ctx)
|
|
case scaauthuser.FieldGender:
|
|
return m.OldGender(ctx)
|
|
case scaauthuser.FieldAvatar:
|
|
return m.OldAvatar(ctx)
|
|
case scaauthuser.FieldStatus:
|
|
return m.OldStatus(ctx)
|
|
case scaauthuser.FieldIntroduce:
|
|
return m.OldIntroduce(ctx)
|
|
case scaauthuser.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
case scaauthuser.FieldUpdateAt:
|
|
return m.OldUpdateAt(ctx)
|
|
case scaauthuser.FieldDeleted:
|
|
return m.OldDeleted(ctx)
|
|
case scaauthuser.FieldBlog:
|
|
return m.OldBlog(ctx)
|
|
case scaauthuser.FieldLocation:
|
|
return m.OldLocation(ctx)
|
|
case scaauthuser.FieldCompany:
|
|
return m.OldCompany(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown ScaAuthUser 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 *ScaAuthUserMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthuser.FieldUID:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUID(v)
|
|
return nil
|
|
case scaauthuser.FieldUsername:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUsername(v)
|
|
return nil
|
|
case scaauthuser.FieldNickname:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetNickname(v)
|
|
return nil
|
|
case scaauthuser.FieldEmail:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetEmail(v)
|
|
return nil
|
|
case scaauthuser.FieldPhone:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPhone(v)
|
|
return nil
|
|
case scaauthuser.FieldPassword:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPassword(v)
|
|
return nil
|
|
case scaauthuser.FieldGender:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGender(v)
|
|
return nil
|
|
case scaauthuser.FieldAvatar:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetAvatar(v)
|
|
return nil
|
|
case scaauthuser.FieldStatus:
|
|
v, ok := value.(int8)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetStatus(v)
|
|
return nil
|
|
case scaauthuser.FieldIntroduce:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetIntroduce(v)
|
|
return nil
|
|
case scaauthuser.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
case scaauthuser.FieldUpdateAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdateAt(v)
|
|
return nil
|
|
case scaauthuser.FieldDeleted:
|
|
v, ok := value.(int8)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDeleted(v)
|
|
return nil
|
|
case scaauthuser.FieldBlog:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBlog(v)
|
|
return nil
|
|
case scaauthuser.FieldLocation:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocation(v)
|
|
return nil
|
|
case scaauthuser.FieldCompany:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCompany(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *ScaAuthUserMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.addstatus != nil {
|
|
fields = append(fields, scaauthuser.FieldStatus)
|
|
}
|
|
if m.adddeleted != nil {
|
|
fields = append(fields, scaauthuser.FieldDeleted)
|
|
}
|
|
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 *ScaAuthUserMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthuser.FieldStatus:
|
|
return m.AddedStatus()
|
|
case scaauthuser.FieldDeleted:
|
|
return m.AddedDeleted()
|
|
}
|
|
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 *ScaAuthUserMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthuser.FieldStatus:
|
|
v, ok := value.(int8)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddStatus(v)
|
|
return nil
|
|
case scaauthuser.FieldDeleted:
|
|
v, ok := value.(int8)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddDeleted(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *ScaAuthUserMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(scaauthuser.FieldUsername) {
|
|
fields = append(fields, scaauthuser.FieldUsername)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldNickname) {
|
|
fields = append(fields, scaauthuser.FieldNickname)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldEmail) {
|
|
fields = append(fields, scaauthuser.FieldEmail)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldPhone) {
|
|
fields = append(fields, scaauthuser.FieldPhone)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldPassword) {
|
|
fields = append(fields, scaauthuser.FieldPassword)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldGender) {
|
|
fields = append(fields, scaauthuser.FieldGender)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldAvatar) {
|
|
fields = append(fields, scaauthuser.FieldAvatar)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldStatus) {
|
|
fields = append(fields, scaauthuser.FieldStatus)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldIntroduce) {
|
|
fields = append(fields, scaauthuser.FieldIntroduce)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldUpdateAt) {
|
|
fields = append(fields, scaauthuser.FieldUpdateAt)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldBlog) {
|
|
fields = append(fields, scaauthuser.FieldBlog)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldLocation) {
|
|
fields = append(fields, scaauthuser.FieldLocation)
|
|
}
|
|
if m.FieldCleared(scaauthuser.FieldCompany) {
|
|
fields = append(fields, scaauthuser.FieldCompany)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) 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 *ScaAuthUserMutation) ClearField(name string) error {
|
|
switch name {
|
|
case scaauthuser.FieldUsername:
|
|
m.ClearUsername()
|
|
return nil
|
|
case scaauthuser.FieldNickname:
|
|
m.ClearNickname()
|
|
return nil
|
|
case scaauthuser.FieldEmail:
|
|
m.ClearEmail()
|
|
return nil
|
|
case scaauthuser.FieldPhone:
|
|
m.ClearPhone()
|
|
return nil
|
|
case scaauthuser.FieldPassword:
|
|
m.ClearPassword()
|
|
return nil
|
|
case scaauthuser.FieldGender:
|
|
m.ClearGender()
|
|
return nil
|
|
case scaauthuser.FieldAvatar:
|
|
m.ClearAvatar()
|
|
return nil
|
|
case scaauthuser.FieldStatus:
|
|
m.ClearStatus()
|
|
return nil
|
|
case scaauthuser.FieldIntroduce:
|
|
m.ClearIntroduce()
|
|
return nil
|
|
case scaauthuser.FieldUpdateAt:
|
|
m.ClearUpdateAt()
|
|
return nil
|
|
case scaauthuser.FieldBlog:
|
|
m.ClearBlog()
|
|
return nil
|
|
case scaauthuser.FieldLocation:
|
|
m.ClearLocation()
|
|
return nil
|
|
case scaauthuser.FieldCompany:
|
|
m.ClearCompany()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser 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 *ScaAuthUserMutation) ResetField(name string) error {
|
|
switch name {
|
|
case scaauthuser.FieldUID:
|
|
m.ResetUID()
|
|
return nil
|
|
case scaauthuser.FieldUsername:
|
|
m.ResetUsername()
|
|
return nil
|
|
case scaauthuser.FieldNickname:
|
|
m.ResetNickname()
|
|
return nil
|
|
case scaauthuser.FieldEmail:
|
|
m.ResetEmail()
|
|
return nil
|
|
case scaauthuser.FieldPhone:
|
|
m.ResetPhone()
|
|
return nil
|
|
case scaauthuser.FieldPassword:
|
|
m.ResetPassword()
|
|
return nil
|
|
case scaauthuser.FieldGender:
|
|
m.ResetGender()
|
|
return nil
|
|
case scaauthuser.FieldAvatar:
|
|
m.ResetAvatar()
|
|
return nil
|
|
case scaauthuser.FieldStatus:
|
|
m.ResetStatus()
|
|
return nil
|
|
case scaauthuser.FieldIntroduce:
|
|
m.ResetIntroduce()
|
|
return nil
|
|
case scaauthuser.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
case scaauthuser.FieldUpdateAt:
|
|
m.ResetUpdateAt()
|
|
return nil
|
|
case scaauthuser.FieldDeleted:
|
|
m.ResetDeleted()
|
|
return nil
|
|
case scaauthuser.FieldBlog:
|
|
m.ResetBlog()
|
|
return nil
|
|
case scaauthuser.FieldLocation:
|
|
m.ResetLocation()
|
|
return nil
|
|
case scaauthuser.FieldCompany:
|
|
m.ResetCompany()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *ScaAuthUserMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.sca_auth_user_social != nil {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserSocial)
|
|
}
|
|
if m.sca_auth_user_device != nil {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserDevice)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *ScaAuthUserMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthuser.EdgeScaAuthUserSocial:
|
|
ids := make([]ent.Value, 0, len(m.sca_auth_user_social))
|
|
for id := range m.sca_auth_user_social {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
case scaauthuser.EdgeScaAuthUserDevice:
|
|
ids := make([]ent.Value, 0, len(m.sca_auth_user_device))
|
|
for id := range m.sca_auth_user_device {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *ScaAuthUserMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.removedsca_auth_user_social != nil {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserSocial)
|
|
}
|
|
if m.removedsca_auth_user_device != nil {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserDevice)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *ScaAuthUserMutation) RemovedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthuser.EdgeScaAuthUserSocial:
|
|
ids := make([]ent.Value, 0, len(m.removedsca_auth_user_social))
|
|
for id := range m.removedsca_auth_user_social {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
case scaauthuser.EdgeScaAuthUserDevice:
|
|
ids := make([]ent.Value, 0, len(m.removedsca_auth_user_device))
|
|
for id := range m.removedsca_auth_user_device {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.clearedsca_auth_user_social {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserSocial)
|
|
}
|
|
if m.clearedsca_auth_user_device {
|
|
edges = append(edges, scaauthuser.EdgeScaAuthUserDevice)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *ScaAuthUserMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case scaauthuser.EdgeScaAuthUserSocial:
|
|
return m.clearedsca_auth_user_social
|
|
case scaauthuser.EdgeScaAuthUserDevice:
|
|
return m.clearedsca_auth_user_device
|
|
}
|
|
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 *ScaAuthUserMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser 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 *ScaAuthUserMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case scaauthuser.EdgeScaAuthUserSocial:
|
|
m.ResetScaAuthUserSocial()
|
|
return nil
|
|
case scaauthuser.EdgeScaAuthUserDevice:
|
|
m.ResetScaAuthUserDevice()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUser edge %s", name)
|
|
}
|
|
|
|
// ScaAuthUserDeviceMutation represents an operation that mutates the ScaAuthUserDevice nodes in the graph.
|
|
type ScaAuthUserDeviceMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int64
|
|
user_id *string
|
|
ip *string
|
|
location *string
|
|
agent *string
|
|
created_at *time.Time
|
|
update_at *time.Time
|
|
deleted *int
|
|
adddeleted *int
|
|
browser *string
|
|
operating_system *string
|
|
browser_version *string
|
|
mobile *int
|
|
addmobile *int
|
|
bot *int
|
|
addbot *int
|
|
mozilla *string
|
|
platform *string
|
|
engine_name *string
|
|
engine_version *string
|
|
clearedFields map[string]struct{}
|
|
sca_auth_user *int64
|
|
clearedsca_auth_user bool
|
|
done bool
|
|
oldValue func(context.Context) (*ScaAuthUserDevice, error)
|
|
predicates []predicate.ScaAuthUserDevice
|
|
}
|
|
|
|
var _ ent.Mutation = (*ScaAuthUserDeviceMutation)(nil)
|
|
|
|
// scaauthuserdeviceOption allows management of the mutation configuration using functional options.
|
|
type scaauthuserdeviceOption func(*ScaAuthUserDeviceMutation)
|
|
|
|
// newScaAuthUserDeviceMutation creates new mutation for the ScaAuthUserDevice entity.
|
|
func newScaAuthUserDeviceMutation(c config, op Op, opts ...scaauthuserdeviceOption) *ScaAuthUserDeviceMutation {
|
|
m := &ScaAuthUserDeviceMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeScaAuthUserDevice,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withScaAuthUserDeviceID sets the ID field of the mutation.
|
|
func withScaAuthUserDeviceID(id int64) scaauthuserdeviceOption {
|
|
return func(m *ScaAuthUserDeviceMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *ScaAuthUserDevice
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*ScaAuthUserDevice, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().ScaAuthUserDevice.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withScaAuthUserDevice sets the old ScaAuthUserDevice of the mutation.
|
|
func withScaAuthUserDevice(node *ScaAuthUserDevice) scaauthuserdeviceOption {
|
|
return func(m *ScaAuthUserDeviceMutation) {
|
|
m.oldValue = func(context.Context) (*ScaAuthUserDevice, 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 ScaAuthUserDeviceMutation) 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 ScaAuthUserDeviceMutation) 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 ScaAuthUserDevice entities.
|
|
func (m *ScaAuthUserDeviceMutation) 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 *ScaAuthUserDeviceMutation) 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 *ScaAuthUserDeviceMutation) 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().ScaAuthUserDevice.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetUserID(s string) {
|
|
m.user_id = &s
|
|
}
|
|
|
|
// UserID returns the value of the "user_id" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) UserID() (r string, exists bool) {
|
|
v := m.user_id
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUserID returns the old "user_id" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldUserID(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUserID is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUserID requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUserID: %w", err)
|
|
}
|
|
return oldValue.UserID, nil
|
|
}
|
|
|
|
// ResetUserID resets all changes to the "user_id" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetUserID() {
|
|
m.user_id = nil
|
|
}
|
|
|
|
// SetIP sets the "ip" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetIP(s string) {
|
|
m.ip = &s
|
|
}
|
|
|
|
// IP returns the value of the "ip" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) IP() (r string, exists bool) {
|
|
v := m.ip
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldIP returns the old "ip" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldIP(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldIP is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldIP requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldIP: %w", err)
|
|
}
|
|
return oldValue.IP, nil
|
|
}
|
|
|
|
// ResetIP resets all changes to the "ip" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetIP() {
|
|
m.ip = nil
|
|
}
|
|
|
|
// SetLocation sets the "location" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetLocation(s string) {
|
|
m.location = &s
|
|
}
|
|
|
|
// Location returns the value of the "location" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Location() (r string, exists bool) {
|
|
v := m.location
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocation returns the old "location" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldLocation(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocation is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocation requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocation: %w", err)
|
|
}
|
|
return oldValue.Location, nil
|
|
}
|
|
|
|
// ResetLocation resets all changes to the "location" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetLocation() {
|
|
m.location = nil
|
|
}
|
|
|
|
// SetAgent sets the "agent" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetAgent(s string) {
|
|
m.agent = &s
|
|
}
|
|
|
|
// Agent returns the value of the "agent" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Agent() (r string, exists bool) {
|
|
v := m.agent
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldAgent returns the old "agent" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldAgent(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldAgent is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldAgent requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldAgent: %w", err)
|
|
}
|
|
return oldValue.Agent, nil
|
|
}
|
|
|
|
// ResetAgent resets all changes to the "agent" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetAgent() {
|
|
m.agent = nil
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
func (m *ScaAuthUserDeviceMutation) ClearCreatedAt() {
|
|
m.created_at = nil
|
|
m.clearedFields[scaauthuserdevice.FieldCreatedAt] = struct{}{}
|
|
}
|
|
|
|
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) CreatedAtCleared() bool {
|
|
_, ok := m.clearedFields[scaauthuserdevice.FieldCreatedAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
delete(m.clearedFields, scaauthuserdevice.FieldCreatedAt)
|
|
}
|
|
|
|
// SetUpdateAt sets the "update_at" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetUpdateAt(t time.Time) {
|
|
m.update_at = &t
|
|
}
|
|
|
|
// UpdateAt returns the value of the "update_at" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) UpdateAt() (r time.Time, exists bool) {
|
|
v := m.update_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdateAt returns the old "update_at" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldUpdateAt(ctx context.Context) (v *time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUpdateAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUpdateAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdateAt: %w", err)
|
|
}
|
|
return oldValue.UpdateAt, nil
|
|
}
|
|
|
|
// ResetUpdateAt resets all changes to the "update_at" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetUpdateAt() {
|
|
m.update_at = nil
|
|
}
|
|
|
|
// SetDeleted sets the "deleted" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetDeleted(i int) {
|
|
m.deleted = &i
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// Deleted returns the value of the "deleted" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Deleted() (r int, exists bool) {
|
|
v := m.deleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDeleted returns the old "deleted" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldDeleted(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDeleted requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
|
|
}
|
|
return oldValue.Deleted, nil
|
|
}
|
|
|
|
// AddDeleted adds i to the "deleted" field.
|
|
func (m *ScaAuthUserDeviceMutation) AddDeleted(i int) {
|
|
if m.adddeleted != nil {
|
|
*m.adddeleted += i
|
|
} else {
|
|
m.adddeleted = &i
|
|
}
|
|
}
|
|
|
|
// AddedDeleted returns the value that was added to the "deleted" field in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedDeleted() (r int, exists bool) {
|
|
v := m.adddeleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetDeleted resets all changes to the "deleted" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetDeleted() {
|
|
m.deleted = nil
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// SetBrowser sets the "browser" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetBrowser(s string) {
|
|
m.browser = &s
|
|
}
|
|
|
|
// Browser returns the value of the "browser" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Browser() (r string, exists bool) {
|
|
v := m.browser
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBrowser returns the old "browser" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldBrowser(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBrowser is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBrowser requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBrowser: %w", err)
|
|
}
|
|
return oldValue.Browser, nil
|
|
}
|
|
|
|
// ResetBrowser resets all changes to the "browser" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetBrowser() {
|
|
m.browser = nil
|
|
}
|
|
|
|
// SetOperatingSystem sets the "operating_system" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetOperatingSystem(s string) {
|
|
m.operating_system = &s
|
|
}
|
|
|
|
// OperatingSystem returns the value of the "operating_system" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) OperatingSystem() (r string, exists bool) {
|
|
v := m.operating_system
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldOperatingSystem returns the old "operating_system" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldOperatingSystem(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldOperatingSystem is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldOperatingSystem requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldOperatingSystem: %w", err)
|
|
}
|
|
return oldValue.OperatingSystem, nil
|
|
}
|
|
|
|
// ResetOperatingSystem resets all changes to the "operating_system" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetOperatingSystem() {
|
|
m.operating_system = nil
|
|
}
|
|
|
|
// SetBrowserVersion sets the "browser_version" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetBrowserVersion(s string) {
|
|
m.browser_version = &s
|
|
}
|
|
|
|
// BrowserVersion returns the value of the "browser_version" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) BrowserVersion() (r string, exists bool) {
|
|
v := m.browser_version
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBrowserVersion returns the old "browser_version" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldBrowserVersion(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBrowserVersion is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBrowserVersion requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBrowserVersion: %w", err)
|
|
}
|
|
return oldValue.BrowserVersion, nil
|
|
}
|
|
|
|
// ResetBrowserVersion resets all changes to the "browser_version" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetBrowserVersion() {
|
|
m.browser_version = nil
|
|
}
|
|
|
|
// SetMobile sets the "mobile" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetMobile(i int) {
|
|
m.mobile = &i
|
|
m.addmobile = nil
|
|
}
|
|
|
|
// Mobile returns the value of the "mobile" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Mobile() (r int, exists bool) {
|
|
v := m.mobile
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMobile returns the old "mobile" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldMobile(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldMobile is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldMobile requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMobile: %w", err)
|
|
}
|
|
return oldValue.Mobile, nil
|
|
}
|
|
|
|
// AddMobile adds i to the "mobile" field.
|
|
func (m *ScaAuthUserDeviceMutation) AddMobile(i int) {
|
|
if m.addmobile != nil {
|
|
*m.addmobile += i
|
|
} else {
|
|
m.addmobile = &i
|
|
}
|
|
}
|
|
|
|
// AddedMobile returns the value that was added to the "mobile" field in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedMobile() (r int, exists bool) {
|
|
v := m.addmobile
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetMobile resets all changes to the "mobile" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetMobile() {
|
|
m.mobile = nil
|
|
m.addmobile = nil
|
|
}
|
|
|
|
// SetBot sets the "bot" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetBot(i int) {
|
|
m.bot = &i
|
|
m.addbot = nil
|
|
}
|
|
|
|
// Bot returns the value of the "bot" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Bot() (r int, exists bool) {
|
|
v := m.bot
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBot returns the old "bot" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldBot(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBot is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBot requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBot: %w", err)
|
|
}
|
|
return oldValue.Bot, nil
|
|
}
|
|
|
|
// AddBot adds i to the "bot" field.
|
|
func (m *ScaAuthUserDeviceMutation) AddBot(i int) {
|
|
if m.addbot != nil {
|
|
*m.addbot += i
|
|
} else {
|
|
m.addbot = &i
|
|
}
|
|
}
|
|
|
|
// AddedBot returns the value that was added to the "bot" field in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedBot() (r int, exists bool) {
|
|
v := m.addbot
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetBot resets all changes to the "bot" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetBot() {
|
|
m.bot = nil
|
|
m.addbot = nil
|
|
}
|
|
|
|
// SetMozilla sets the "mozilla" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetMozilla(s string) {
|
|
m.mozilla = &s
|
|
}
|
|
|
|
// Mozilla returns the value of the "mozilla" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Mozilla() (r string, exists bool) {
|
|
v := m.mozilla
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMozilla returns the old "mozilla" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldMozilla(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldMozilla is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldMozilla requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMozilla: %w", err)
|
|
}
|
|
return oldValue.Mozilla, nil
|
|
}
|
|
|
|
// ResetMozilla resets all changes to the "mozilla" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetMozilla() {
|
|
m.mozilla = nil
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetPlatform(s string) {
|
|
m.platform = &s
|
|
}
|
|
|
|
// Platform returns the value of the "platform" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) Platform() (r string, exists bool) {
|
|
v := m.platform
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPlatform returns the old "platform" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldPlatform(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPlatform is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPlatform requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPlatform: %w", err)
|
|
}
|
|
return oldValue.Platform, nil
|
|
}
|
|
|
|
// ResetPlatform resets all changes to the "platform" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetPlatform() {
|
|
m.platform = nil
|
|
}
|
|
|
|
// SetEngineName sets the "engine_name" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetEngineName(s string) {
|
|
m.engine_name = &s
|
|
}
|
|
|
|
// EngineName returns the value of the "engine_name" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) EngineName() (r string, exists bool) {
|
|
v := m.engine_name
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldEngineName returns the old "engine_name" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldEngineName(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldEngineName is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldEngineName requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldEngineName: %w", err)
|
|
}
|
|
return oldValue.EngineName, nil
|
|
}
|
|
|
|
// ResetEngineName resets all changes to the "engine_name" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetEngineName() {
|
|
m.engine_name = nil
|
|
}
|
|
|
|
// SetEngineVersion sets the "engine_version" field.
|
|
func (m *ScaAuthUserDeviceMutation) SetEngineVersion(s string) {
|
|
m.engine_version = &s
|
|
}
|
|
|
|
// EngineVersion returns the value of the "engine_version" field in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) EngineVersion() (r string, exists bool) {
|
|
v := m.engine_version
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldEngineVersion returns the old "engine_version" field's value of the ScaAuthUserDevice entity.
|
|
// If the ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) OldEngineVersion(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldEngineVersion is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldEngineVersion requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldEngineVersion: %w", err)
|
|
}
|
|
return oldValue.EngineVersion, nil
|
|
}
|
|
|
|
// ResetEngineVersion resets all changes to the "engine_version" field.
|
|
func (m *ScaAuthUserDeviceMutation) ResetEngineVersion() {
|
|
m.engine_version = nil
|
|
}
|
|
|
|
// SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by id.
|
|
func (m *ScaAuthUserDeviceMutation) SetScaAuthUserID(id int64) {
|
|
m.sca_auth_user = &id
|
|
}
|
|
|
|
// ClearScaAuthUser clears the "sca_auth_user" edge to the ScaAuthUser entity.
|
|
func (m *ScaAuthUserDeviceMutation) ClearScaAuthUser() {
|
|
m.clearedsca_auth_user = true
|
|
}
|
|
|
|
// ScaAuthUserCleared reports if the "sca_auth_user" edge to the ScaAuthUser entity was cleared.
|
|
func (m *ScaAuthUserDeviceMutation) ScaAuthUserCleared() bool {
|
|
return m.clearedsca_auth_user
|
|
}
|
|
|
|
// ScaAuthUserID returns the "sca_auth_user" edge ID in the mutation.
|
|
func (m *ScaAuthUserDeviceMutation) ScaAuthUserID() (id int64, exists bool) {
|
|
if m.sca_auth_user != nil {
|
|
return *m.sca_auth_user, true
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthUserIDs returns the "sca_auth_user" edge IDs in the mutation.
|
|
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
// ScaAuthUserID instead. It exists only for internal usage by the builders.
|
|
func (m *ScaAuthUserDeviceMutation) ScaAuthUserIDs() (ids []int64) {
|
|
if id := m.sca_auth_user; id != nil {
|
|
ids = append(ids, *id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthUser resets all changes to the "sca_auth_user" edge.
|
|
func (m *ScaAuthUserDeviceMutation) ResetScaAuthUser() {
|
|
m.sca_auth_user = nil
|
|
m.clearedsca_auth_user = false
|
|
}
|
|
|
|
// Where appends a list predicates to the ScaAuthUserDeviceMutation builder.
|
|
func (m *ScaAuthUserDeviceMutation) Where(ps ...predicate.ScaAuthUserDevice) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the ScaAuthUserDeviceMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *ScaAuthUserDeviceMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.ScaAuthUserDevice, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *ScaAuthUserDeviceMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *ScaAuthUserDeviceMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (ScaAuthUserDevice).
|
|
func (m *ScaAuthUserDeviceMutation) 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 *ScaAuthUserDeviceMutation) Fields() []string {
|
|
fields := make([]string, 0, 16)
|
|
if m.user_id != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldUserID)
|
|
}
|
|
if m.ip != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldIP)
|
|
}
|
|
if m.location != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldLocation)
|
|
}
|
|
if m.agent != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldAgent)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldCreatedAt)
|
|
}
|
|
if m.update_at != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldUpdateAt)
|
|
}
|
|
if m.deleted != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldDeleted)
|
|
}
|
|
if m.browser != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldBrowser)
|
|
}
|
|
if m.operating_system != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldOperatingSystem)
|
|
}
|
|
if m.browser_version != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldBrowserVersion)
|
|
}
|
|
if m.mobile != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldMobile)
|
|
}
|
|
if m.bot != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldBot)
|
|
}
|
|
if m.mozilla != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldMozilla)
|
|
}
|
|
if m.platform != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldPlatform)
|
|
}
|
|
if m.engine_name != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldEngineName)
|
|
}
|
|
if m.engine_version != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldEngineVersion)
|
|
}
|
|
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 *ScaAuthUserDeviceMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthuserdevice.FieldUserID:
|
|
return m.UserID()
|
|
case scaauthuserdevice.FieldIP:
|
|
return m.IP()
|
|
case scaauthuserdevice.FieldLocation:
|
|
return m.Location()
|
|
case scaauthuserdevice.FieldAgent:
|
|
return m.Agent()
|
|
case scaauthuserdevice.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
case scaauthuserdevice.FieldUpdateAt:
|
|
return m.UpdateAt()
|
|
case scaauthuserdevice.FieldDeleted:
|
|
return m.Deleted()
|
|
case scaauthuserdevice.FieldBrowser:
|
|
return m.Browser()
|
|
case scaauthuserdevice.FieldOperatingSystem:
|
|
return m.OperatingSystem()
|
|
case scaauthuserdevice.FieldBrowserVersion:
|
|
return m.BrowserVersion()
|
|
case scaauthuserdevice.FieldMobile:
|
|
return m.Mobile()
|
|
case scaauthuserdevice.FieldBot:
|
|
return m.Bot()
|
|
case scaauthuserdevice.FieldMozilla:
|
|
return m.Mozilla()
|
|
case scaauthuserdevice.FieldPlatform:
|
|
return m.Platform()
|
|
case scaauthuserdevice.FieldEngineName:
|
|
return m.EngineName()
|
|
case scaauthuserdevice.FieldEngineVersion:
|
|
return m.EngineVersion()
|
|
}
|
|
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 *ScaAuthUserDeviceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case scaauthuserdevice.FieldUserID:
|
|
return m.OldUserID(ctx)
|
|
case scaauthuserdevice.FieldIP:
|
|
return m.OldIP(ctx)
|
|
case scaauthuserdevice.FieldLocation:
|
|
return m.OldLocation(ctx)
|
|
case scaauthuserdevice.FieldAgent:
|
|
return m.OldAgent(ctx)
|
|
case scaauthuserdevice.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
case scaauthuserdevice.FieldUpdateAt:
|
|
return m.OldUpdateAt(ctx)
|
|
case scaauthuserdevice.FieldDeleted:
|
|
return m.OldDeleted(ctx)
|
|
case scaauthuserdevice.FieldBrowser:
|
|
return m.OldBrowser(ctx)
|
|
case scaauthuserdevice.FieldOperatingSystem:
|
|
return m.OldOperatingSystem(ctx)
|
|
case scaauthuserdevice.FieldBrowserVersion:
|
|
return m.OldBrowserVersion(ctx)
|
|
case scaauthuserdevice.FieldMobile:
|
|
return m.OldMobile(ctx)
|
|
case scaauthuserdevice.FieldBot:
|
|
return m.OldBot(ctx)
|
|
case scaauthuserdevice.FieldMozilla:
|
|
return m.OldMozilla(ctx)
|
|
case scaauthuserdevice.FieldPlatform:
|
|
return m.OldPlatform(ctx)
|
|
case scaauthuserdevice.FieldEngineName:
|
|
return m.OldEngineName(ctx)
|
|
case scaauthuserdevice.FieldEngineVersion:
|
|
return m.OldEngineVersion(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthuserdevice.FieldUserID:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUserID(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldIP:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetIP(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldLocation:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocation(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldAgent:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetAgent(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldUpdateAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdateAt(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDeleted(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldBrowser:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBrowser(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldOperatingSystem:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetOperatingSystem(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldBrowserVersion:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBrowserVersion(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldMobile:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMobile(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldBot:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBot(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldMozilla:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMozilla(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldPlatform:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPlatform(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldEngineName:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetEngineName(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldEngineVersion:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetEngineVersion(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.adddeleted != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldDeleted)
|
|
}
|
|
if m.addmobile != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldMobile)
|
|
}
|
|
if m.addbot != nil {
|
|
fields = append(fields, scaauthuserdevice.FieldBot)
|
|
}
|
|
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 *ScaAuthUserDeviceMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthuserdevice.FieldDeleted:
|
|
return m.AddedDeleted()
|
|
case scaauthuserdevice.FieldMobile:
|
|
return m.AddedMobile()
|
|
case scaauthuserdevice.FieldBot:
|
|
return m.AddedBot()
|
|
}
|
|
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 *ScaAuthUserDeviceMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthuserdevice.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddDeleted(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldMobile:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddMobile(v)
|
|
return nil
|
|
case scaauthuserdevice.FieldBot:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddBot(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *ScaAuthUserDeviceMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(scaauthuserdevice.FieldCreatedAt) {
|
|
fields = append(fields, scaauthuserdevice.FieldCreatedAt)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) 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 *ScaAuthUserDeviceMutation) ClearField(name string) error {
|
|
switch name {
|
|
case scaauthuserdevice.FieldCreatedAt:
|
|
m.ClearCreatedAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) ResetField(name string) error {
|
|
switch name {
|
|
case scaauthuserdevice.FieldUserID:
|
|
m.ResetUserID()
|
|
return nil
|
|
case scaauthuserdevice.FieldIP:
|
|
m.ResetIP()
|
|
return nil
|
|
case scaauthuserdevice.FieldLocation:
|
|
m.ResetLocation()
|
|
return nil
|
|
case scaauthuserdevice.FieldAgent:
|
|
m.ResetAgent()
|
|
return nil
|
|
case scaauthuserdevice.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
case scaauthuserdevice.FieldUpdateAt:
|
|
m.ResetUpdateAt()
|
|
return nil
|
|
case scaauthuserdevice.FieldDeleted:
|
|
m.ResetDeleted()
|
|
return nil
|
|
case scaauthuserdevice.FieldBrowser:
|
|
m.ResetBrowser()
|
|
return nil
|
|
case scaauthuserdevice.FieldOperatingSystem:
|
|
m.ResetOperatingSystem()
|
|
return nil
|
|
case scaauthuserdevice.FieldBrowserVersion:
|
|
m.ResetBrowserVersion()
|
|
return nil
|
|
case scaauthuserdevice.FieldMobile:
|
|
m.ResetMobile()
|
|
return nil
|
|
case scaauthuserdevice.FieldBot:
|
|
m.ResetBot()
|
|
return nil
|
|
case scaauthuserdevice.FieldMozilla:
|
|
m.ResetMozilla()
|
|
return nil
|
|
case scaauthuserdevice.FieldPlatform:
|
|
m.ResetPlatform()
|
|
return nil
|
|
case scaauthuserdevice.FieldEngineName:
|
|
m.ResetEngineName()
|
|
return nil
|
|
case scaauthuserdevice.FieldEngineVersion:
|
|
m.ResetEngineVersion()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.sca_auth_user != nil {
|
|
edges = append(edges, scaauthuserdevice.EdgeScaAuthUser)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthuserdevice.EdgeScaAuthUser:
|
|
if id := m.sca_auth_user; id != nil {
|
|
return []ent.Value{*id}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedsca_auth_user {
|
|
edges = append(edges, scaauthuserdevice.EdgeScaAuthUser)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *ScaAuthUserDeviceMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case scaauthuserdevice.EdgeScaAuthUser:
|
|
return m.clearedsca_auth_user
|
|
}
|
|
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 *ScaAuthUserDeviceMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
case scaauthuserdevice.EdgeScaAuthUser:
|
|
m.ClearScaAuthUser()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice 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 *ScaAuthUserDeviceMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case scaauthuserdevice.EdgeScaAuthUser:
|
|
m.ResetScaAuthUser()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserDevice edge %s", name)
|
|
}
|
|
|
|
// ScaAuthUserSocialMutation represents an operation that mutates the ScaAuthUserSocial nodes in the graph.
|
|
type ScaAuthUserSocialMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int64
|
|
user_id *string
|
|
open_id *string
|
|
source *string
|
|
status *int
|
|
addstatus *int
|
|
created_at *time.Time
|
|
update_at *time.Time
|
|
deleted *int
|
|
adddeleted *int
|
|
clearedFields map[string]struct{}
|
|
sca_auth_user *int64
|
|
clearedsca_auth_user bool
|
|
done bool
|
|
oldValue func(context.Context) (*ScaAuthUserSocial, error)
|
|
predicates []predicate.ScaAuthUserSocial
|
|
}
|
|
|
|
var _ ent.Mutation = (*ScaAuthUserSocialMutation)(nil)
|
|
|
|
// scaauthusersocialOption allows management of the mutation configuration using functional options.
|
|
type scaauthusersocialOption func(*ScaAuthUserSocialMutation)
|
|
|
|
// newScaAuthUserSocialMutation creates new mutation for the ScaAuthUserSocial entity.
|
|
func newScaAuthUserSocialMutation(c config, op Op, opts ...scaauthusersocialOption) *ScaAuthUserSocialMutation {
|
|
m := &ScaAuthUserSocialMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeScaAuthUserSocial,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withScaAuthUserSocialID sets the ID field of the mutation.
|
|
func withScaAuthUserSocialID(id int64) scaauthusersocialOption {
|
|
return func(m *ScaAuthUserSocialMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *ScaAuthUserSocial
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*ScaAuthUserSocial, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().ScaAuthUserSocial.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withScaAuthUserSocial sets the old ScaAuthUserSocial of the mutation.
|
|
func withScaAuthUserSocial(node *ScaAuthUserSocial) scaauthusersocialOption {
|
|
return func(m *ScaAuthUserSocialMutation) {
|
|
m.oldValue = func(context.Context) (*ScaAuthUserSocial, 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 ScaAuthUserSocialMutation) 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 ScaAuthUserSocialMutation) 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 ScaAuthUserSocial entities.
|
|
func (m *ScaAuthUserSocialMutation) 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 *ScaAuthUserSocialMutation) 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 *ScaAuthUserSocialMutation) 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().ScaAuthUserSocial.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (m *ScaAuthUserSocialMutation) SetUserID(s string) {
|
|
m.user_id = &s
|
|
}
|
|
|
|
// UserID returns the value of the "user_id" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) UserID() (r string, exists bool) {
|
|
v := m.user_id
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUserID returns the old "user_id" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldUserID(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUserID is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUserID requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUserID: %w", err)
|
|
}
|
|
return oldValue.UserID, nil
|
|
}
|
|
|
|
// ResetUserID resets all changes to the "user_id" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetUserID() {
|
|
m.user_id = nil
|
|
}
|
|
|
|
// SetOpenID sets the "open_id" field.
|
|
func (m *ScaAuthUserSocialMutation) SetOpenID(s string) {
|
|
m.open_id = &s
|
|
}
|
|
|
|
// OpenID returns the value of the "open_id" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) OpenID() (r string, exists bool) {
|
|
v := m.open_id
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldOpenID returns the old "open_id" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldOpenID(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldOpenID is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldOpenID requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldOpenID: %w", err)
|
|
}
|
|
return oldValue.OpenID, nil
|
|
}
|
|
|
|
// ResetOpenID resets all changes to the "open_id" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetOpenID() {
|
|
m.open_id = nil
|
|
}
|
|
|
|
// SetSource sets the "source" field.
|
|
func (m *ScaAuthUserSocialMutation) SetSource(s string) {
|
|
m.source = &s
|
|
}
|
|
|
|
// Source returns the value of the "source" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) Source() (r string, exists bool) {
|
|
v := m.source
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldSource returns the old "source" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldSource(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldSource is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldSource requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldSource: %w", err)
|
|
}
|
|
return oldValue.Source, nil
|
|
}
|
|
|
|
// ResetSource resets all changes to the "source" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetSource() {
|
|
m.source = nil
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (m *ScaAuthUserSocialMutation) SetStatus(i int) {
|
|
m.status = &i
|
|
m.addstatus = nil
|
|
}
|
|
|
|
// Status returns the value of the "status" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) Status() (r int, exists bool) {
|
|
v := m.status
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldStatus returns the old "status" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldStatus(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldStatus is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldStatus requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldStatus: %w", err)
|
|
}
|
|
return oldValue.Status, nil
|
|
}
|
|
|
|
// AddStatus adds i to the "status" field.
|
|
func (m *ScaAuthUserSocialMutation) AddStatus(i int) {
|
|
if m.addstatus != nil {
|
|
*m.addstatus += i
|
|
} else {
|
|
m.addstatus = &i
|
|
}
|
|
}
|
|
|
|
// AddedStatus returns the value that was added to the "status" field in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) AddedStatus() (r int, exists bool) {
|
|
v := m.addstatus
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetStatus resets all changes to the "status" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetStatus() {
|
|
m.status = nil
|
|
m.addstatus = nil
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *ScaAuthUserSocialMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
}
|
|
|
|
// SetUpdateAt sets the "update_at" field.
|
|
func (m *ScaAuthUserSocialMutation) SetUpdateAt(t time.Time) {
|
|
m.update_at = &t
|
|
}
|
|
|
|
// UpdateAt returns the value of the "update_at" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) UpdateAt() (r time.Time, exists bool) {
|
|
v := m.update_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdateAt returns the old "update_at" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldUpdateAt(ctx context.Context) (v *time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUpdateAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUpdateAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdateAt: %w", err)
|
|
}
|
|
return oldValue.UpdateAt, nil
|
|
}
|
|
|
|
// ClearUpdateAt clears the value of the "update_at" field.
|
|
func (m *ScaAuthUserSocialMutation) ClearUpdateAt() {
|
|
m.update_at = nil
|
|
m.clearedFields[scaauthusersocial.FieldUpdateAt] = struct{}{}
|
|
}
|
|
|
|
// UpdateAtCleared returns if the "update_at" field was cleared in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) UpdateAtCleared() bool {
|
|
_, ok := m.clearedFields[scaauthusersocial.FieldUpdateAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetUpdateAt resets all changes to the "update_at" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetUpdateAt() {
|
|
m.update_at = nil
|
|
delete(m.clearedFields, scaauthusersocial.FieldUpdateAt)
|
|
}
|
|
|
|
// SetDeleted sets the "deleted" field.
|
|
func (m *ScaAuthUserSocialMutation) SetDeleted(i int) {
|
|
m.deleted = &i
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// Deleted returns the value of the "deleted" field in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) Deleted() (r int, exists bool) {
|
|
v := m.deleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDeleted returns the old "deleted" field's value of the ScaAuthUserSocial entity.
|
|
// If the ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) OldDeleted(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDeleted requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
|
|
}
|
|
return oldValue.Deleted, nil
|
|
}
|
|
|
|
// AddDeleted adds i to the "deleted" field.
|
|
func (m *ScaAuthUserSocialMutation) AddDeleted(i int) {
|
|
if m.adddeleted != nil {
|
|
*m.adddeleted += i
|
|
} else {
|
|
m.adddeleted = &i
|
|
}
|
|
}
|
|
|
|
// AddedDeleted returns the value that was added to the "deleted" field in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) AddedDeleted() (r int, exists bool) {
|
|
v := m.adddeleted
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetDeleted resets all changes to the "deleted" field.
|
|
func (m *ScaAuthUserSocialMutation) ResetDeleted() {
|
|
m.deleted = nil
|
|
m.adddeleted = nil
|
|
}
|
|
|
|
// SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by id.
|
|
func (m *ScaAuthUserSocialMutation) SetScaAuthUserID(id int64) {
|
|
m.sca_auth_user = &id
|
|
}
|
|
|
|
// ClearScaAuthUser clears the "sca_auth_user" edge to the ScaAuthUser entity.
|
|
func (m *ScaAuthUserSocialMutation) ClearScaAuthUser() {
|
|
m.clearedsca_auth_user = true
|
|
}
|
|
|
|
// ScaAuthUserCleared reports if the "sca_auth_user" edge to the ScaAuthUser entity was cleared.
|
|
func (m *ScaAuthUserSocialMutation) ScaAuthUserCleared() bool {
|
|
return m.clearedsca_auth_user
|
|
}
|
|
|
|
// ScaAuthUserID returns the "sca_auth_user" edge ID in the mutation.
|
|
func (m *ScaAuthUserSocialMutation) ScaAuthUserID() (id int64, exists bool) {
|
|
if m.sca_auth_user != nil {
|
|
return *m.sca_auth_user, true
|
|
}
|
|
return
|
|
}
|
|
|
|
// ScaAuthUserIDs returns the "sca_auth_user" edge IDs in the mutation.
|
|
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
// ScaAuthUserID instead. It exists only for internal usage by the builders.
|
|
func (m *ScaAuthUserSocialMutation) ScaAuthUserIDs() (ids []int64) {
|
|
if id := m.sca_auth_user; id != nil {
|
|
ids = append(ids, *id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetScaAuthUser resets all changes to the "sca_auth_user" edge.
|
|
func (m *ScaAuthUserSocialMutation) ResetScaAuthUser() {
|
|
m.sca_auth_user = nil
|
|
m.clearedsca_auth_user = false
|
|
}
|
|
|
|
// Where appends a list predicates to the ScaAuthUserSocialMutation builder.
|
|
func (m *ScaAuthUserSocialMutation) Where(ps ...predicate.ScaAuthUserSocial) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the ScaAuthUserSocialMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *ScaAuthUserSocialMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.ScaAuthUserSocial, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *ScaAuthUserSocialMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *ScaAuthUserSocialMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (ScaAuthUserSocial).
|
|
func (m *ScaAuthUserSocialMutation) 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 *ScaAuthUserSocialMutation) Fields() []string {
|
|
fields := make([]string, 0, 7)
|
|
if m.user_id != nil {
|
|
fields = append(fields, scaauthusersocial.FieldUserID)
|
|
}
|
|
if m.open_id != nil {
|
|
fields = append(fields, scaauthusersocial.FieldOpenID)
|
|
}
|
|
if m.source != nil {
|
|
fields = append(fields, scaauthusersocial.FieldSource)
|
|
}
|
|
if m.status != nil {
|
|
fields = append(fields, scaauthusersocial.FieldStatus)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, scaauthusersocial.FieldCreatedAt)
|
|
}
|
|
if m.update_at != nil {
|
|
fields = append(fields, scaauthusersocial.FieldUpdateAt)
|
|
}
|
|
if m.deleted != nil {
|
|
fields = append(fields, scaauthusersocial.FieldDeleted)
|
|
}
|
|
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 *ScaAuthUserSocialMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthusersocial.FieldUserID:
|
|
return m.UserID()
|
|
case scaauthusersocial.FieldOpenID:
|
|
return m.OpenID()
|
|
case scaauthusersocial.FieldSource:
|
|
return m.Source()
|
|
case scaauthusersocial.FieldStatus:
|
|
return m.Status()
|
|
case scaauthusersocial.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
case scaauthusersocial.FieldUpdateAt:
|
|
return m.UpdateAt()
|
|
case scaauthusersocial.FieldDeleted:
|
|
return m.Deleted()
|
|
}
|
|
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 *ScaAuthUserSocialMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case scaauthusersocial.FieldUserID:
|
|
return m.OldUserID(ctx)
|
|
case scaauthusersocial.FieldOpenID:
|
|
return m.OldOpenID(ctx)
|
|
case scaauthusersocial.FieldSource:
|
|
return m.OldSource(ctx)
|
|
case scaauthusersocial.FieldStatus:
|
|
return m.OldStatus(ctx)
|
|
case scaauthusersocial.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
case scaauthusersocial.FieldUpdateAt:
|
|
return m.OldUpdateAt(ctx)
|
|
case scaauthusersocial.FieldDeleted:
|
|
return m.OldDeleted(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthusersocial.FieldUserID:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUserID(v)
|
|
return nil
|
|
case scaauthusersocial.FieldOpenID:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetOpenID(v)
|
|
return nil
|
|
case scaauthusersocial.FieldSource:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetSource(v)
|
|
return nil
|
|
case scaauthusersocial.FieldStatus:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetStatus(v)
|
|
return nil
|
|
case scaauthusersocial.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
case scaauthusersocial.FieldUpdateAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdateAt(v)
|
|
return nil
|
|
case scaauthusersocial.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDeleted(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *ScaAuthUserSocialMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.addstatus != nil {
|
|
fields = append(fields, scaauthusersocial.FieldStatus)
|
|
}
|
|
if m.adddeleted != nil {
|
|
fields = append(fields, scaauthusersocial.FieldDeleted)
|
|
}
|
|
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 *ScaAuthUserSocialMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case scaauthusersocial.FieldStatus:
|
|
return m.AddedStatus()
|
|
case scaauthusersocial.FieldDeleted:
|
|
return m.AddedDeleted()
|
|
}
|
|
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 *ScaAuthUserSocialMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case scaauthusersocial.FieldStatus:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddStatus(v)
|
|
return nil
|
|
case scaauthusersocial.FieldDeleted:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddDeleted(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *ScaAuthUserSocialMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(scaauthusersocial.FieldUpdateAt) {
|
|
fields = append(fields, scaauthusersocial.FieldUpdateAt)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) 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 *ScaAuthUserSocialMutation) ClearField(name string) error {
|
|
switch name {
|
|
case scaauthusersocial.FieldUpdateAt:
|
|
m.ClearUpdateAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) ResetField(name string) error {
|
|
switch name {
|
|
case scaauthusersocial.FieldUserID:
|
|
m.ResetUserID()
|
|
return nil
|
|
case scaauthusersocial.FieldOpenID:
|
|
m.ResetOpenID()
|
|
return nil
|
|
case scaauthusersocial.FieldSource:
|
|
m.ResetSource()
|
|
return nil
|
|
case scaauthusersocial.FieldStatus:
|
|
m.ResetStatus()
|
|
return nil
|
|
case scaauthusersocial.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
case scaauthusersocial.FieldUpdateAt:
|
|
m.ResetUpdateAt()
|
|
return nil
|
|
case scaauthusersocial.FieldDeleted:
|
|
m.ResetDeleted()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.sca_auth_user != nil {
|
|
edges = append(edges, scaauthusersocial.EdgeScaAuthUser)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case scaauthusersocial.EdgeScaAuthUser:
|
|
if id := m.sca_auth_user; id != nil {
|
|
return []ent.Value{*id}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedsca_auth_user {
|
|
edges = append(edges, scaauthusersocial.EdgeScaAuthUser)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *ScaAuthUserSocialMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case scaauthusersocial.EdgeScaAuthUser:
|
|
return m.clearedsca_auth_user
|
|
}
|
|
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 *ScaAuthUserSocialMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
case scaauthusersocial.EdgeScaAuthUser:
|
|
m.ClearScaAuthUser()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial 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 *ScaAuthUserSocialMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case scaauthusersocial.EdgeScaAuthUser:
|
|
m.ResetScaAuthUser()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ScaAuthUserSocial edge %s", name)
|
|
}
|