// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"time"

	"ariga.io/ogent/internal/integration/ogent/ent/alltypes"
	"ariga.io/ogent/internal/integration/ogent/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)

// AllTypesUpdate is the builder for updating AllTypes entities.
type AllTypesUpdate struct {
	config
	hooks    []Hook
	mutation *AllTypesMutation
}

// Where appends a list predicates to the AllTypesUpdate builder.
func (atu *AllTypesUpdate) Where(ps ...predicate.AllTypes) *AllTypesUpdate {
	atu.mutation.Where(ps...)
	return atu
}

// SetInt sets the "int" field.
func (atu *AllTypesUpdate) SetInt(i int) *AllTypesUpdate {
	atu.mutation.ResetInt()
	atu.mutation.SetInt(i)
	return atu
}

// AddInt adds i to the "int" field.
func (atu *AllTypesUpdate) AddInt(i int) *AllTypesUpdate {
	atu.mutation.AddInt(i)
	return atu
}

// SetInt8 sets the "int8" field.
func (atu *AllTypesUpdate) SetInt8(i int8) *AllTypesUpdate {
	atu.mutation.ResetInt8()
	atu.mutation.SetInt8(i)
	return atu
}

// AddInt8 adds i to the "int8" field.
func (atu *AllTypesUpdate) AddInt8(i int8) *AllTypesUpdate {
	atu.mutation.AddInt8(i)
	return atu
}

// SetInt16 sets the "int16" field.
func (atu *AllTypesUpdate) SetInt16(i int16) *AllTypesUpdate {
	atu.mutation.ResetInt16()
	atu.mutation.SetInt16(i)
	return atu
}

// AddInt16 adds i to the "int16" field.
func (atu *AllTypesUpdate) AddInt16(i int16) *AllTypesUpdate {
	atu.mutation.AddInt16(i)
	return atu
}

// SetInt32 sets the "int32" field.
func (atu *AllTypesUpdate) SetInt32(i int32) *AllTypesUpdate {
	atu.mutation.ResetInt32()
	atu.mutation.SetInt32(i)
	return atu
}

// AddInt32 adds i to the "int32" field.
func (atu *AllTypesUpdate) AddInt32(i int32) *AllTypesUpdate {
	atu.mutation.AddInt32(i)
	return atu
}

// SetInt64 sets the "int64" field.
func (atu *AllTypesUpdate) SetInt64(i int64) *AllTypesUpdate {
	atu.mutation.ResetInt64()
	atu.mutation.SetInt64(i)
	return atu
}

// AddInt64 adds i to the "int64" field.
func (atu *AllTypesUpdate) AddInt64(i int64) *AllTypesUpdate {
	atu.mutation.AddInt64(i)
	return atu
}

// SetUint sets the "uint" field.
func (atu *AllTypesUpdate) SetUint(u uint) *AllTypesUpdate {
	atu.mutation.ResetUint()
	atu.mutation.SetUint(u)
	return atu
}

// AddUint adds u to the "uint" field.
func (atu *AllTypesUpdate) AddUint(u int) *AllTypesUpdate {
	atu.mutation.AddUint(u)
	return atu
}

// SetUint8 sets the "uint8" field.
func (atu *AllTypesUpdate) SetUint8(u uint8) *AllTypesUpdate {
	atu.mutation.ResetUint8()
	atu.mutation.SetUint8(u)
	return atu
}

// AddUint8 adds u to the "uint8" field.
func (atu *AllTypesUpdate) AddUint8(u int8) *AllTypesUpdate {
	atu.mutation.AddUint8(u)
	return atu
}

// SetUint16 sets the "uint16" field.
func (atu *AllTypesUpdate) SetUint16(u uint16) *AllTypesUpdate {
	atu.mutation.ResetUint16()
	atu.mutation.SetUint16(u)
	return atu
}

// AddUint16 adds u to the "uint16" field.
func (atu *AllTypesUpdate) AddUint16(u int16) *AllTypesUpdate {
	atu.mutation.AddUint16(u)
	return atu
}

// SetUint32 sets the "uint32" field.
func (atu *AllTypesUpdate) SetUint32(u uint32) *AllTypesUpdate {
	atu.mutation.ResetUint32()
	atu.mutation.SetUint32(u)
	return atu
}

// AddUint32 adds u to the "uint32" field.
func (atu *AllTypesUpdate) AddUint32(u int32) *AllTypesUpdate {
	atu.mutation.AddUint32(u)
	return atu
}

// SetUint64 sets the "uint64" field.
func (atu *AllTypesUpdate) SetUint64(u uint64) *AllTypesUpdate {
	atu.mutation.ResetUint64()
	atu.mutation.SetUint64(u)
	return atu
}

// AddUint64 adds u to the "uint64" field.
func (atu *AllTypesUpdate) AddUint64(u int64) *AllTypesUpdate {
	atu.mutation.AddUint64(u)
	return atu
}

// SetFloat32 sets the "float32" field.
func (atu *AllTypesUpdate) SetFloat32(f float32) *AllTypesUpdate {
	atu.mutation.ResetFloat32()
	atu.mutation.SetFloat32(f)
	return atu
}

// AddFloat32 adds f to the "float32" field.
func (atu *AllTypesUpdate) AddFloat32(f float32) *AllTypesUpdate {
	atu.mutation.AddFloat32(f)
	return atu
}

// SetFloat64 sets the "float64" field.
func (atu *AllTypesUpdate) SetFloat64(f float64) *AllTypesUpdate {
	atu.mutation.ResetFloat64()
	atu.mutation.SetFloat64(f)
	return atu
}

// AddFloat64 adds f to the "float64" field.
func (atu *AllTypesUpdate) AddFloat64(f float64) *AllTypesUpdate {
	atu.mutation.AddFloat64(f)
	return atu
}

// SetStringType sets the "string_type" field.
func (atu *AllTypesUpdate) SetStringType(s string) *AllTypesUpdate {
	atu.mutation.SetStringType(s)
	return atu
}

// SetBool sets the "bool" field.
func (atu *AllTypesUpdate) SetBool(b bool) *AllTypesUpdate {
	atu.mutation.SetBool(b)
	return atu
}

// SetUUID sets the "uuid" field.
func (atu *AllTypesUpdate) SetUUID(u uuid.UUID) *AllTypesUpdate {
	atu.mutation.SetUUID(u)
	return atu
}

// SetTime sets the "time" field.
func (atu *AllTypesUpdate) SetTime(t time.Time) *AllTypesUpdate {
	atu.mutation.SetTime(t)
	return atu
}

// SetText sets the "text" field.
func (atu *AllTypesUpdate) SetText(s string) *AllTypesUpdate {
	atu.mutation.SetText(s)
	return atu
}

// SetState sets the "state" field.
func (atu *AllTypesUpdate) SetState(a alltypes.State) *AllTypesUpdate {
	atu.mutation.SetState(a)
	return atu
}

// SetBytes sets the "bytes" field.
func (atu *AllTypesUpdate) SetBytes(b []byte) *AllTypesUpdate {
	atu.mutation.SetBytes(b)
	return atu
}

// SetNilable sets the "nilable" field.
func (atu *AllTypesUpdate) SetNilable(s string) *AllTypesUpdate {
	atu.mutation.SetNilable(s)
	return atu
}

// Mutation returns the AllTypesMutation object of the builder.
func (atu *AllTypesUpdate) Mutation() *AllTypesMutation {
	return atu.mutation
}

// Save executes the query and returns the number of nodes affected by the update operation.
func (atu *AllTypesUpdate) Save(ctx context.Context) (int, error) {
	return withHooks[int, AllTypesMutation](ctx, atu.sqlSave, atu.mutation, atu.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (atu *AllTypesUpdate) SaveX(ctx context.Context) int {
	affected, err := atu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}

// Exec executes the query.
func (atu *AllTypesUpdate) Exec(ctx context.Context) error {
	_, err := atu.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (atu *AllTypesUpdate) ExecX(ctx context.Context) {
	if err := atu.Exec(ctx); err != nil {
		panic(err)
	}
}

// check runs all checks and user-defined validators on the builder.
func (atu *AllTypesUpdate) check() error {
	if v, ok := atu.mutation.State(); ok {
		if err := alltypes.StateValidator(v); err != nil {
			return &ValidationError{Name: "state", err: fmt.Errorf(`ent: validator failed for field "AllTypes.state": %w`, err)}
		}
	}
	return nil
}

func (atu *AllTypesUpdate) sqlSave(ctx context.Context) (n int, err error) {
	if err := atu.check(); err != nil {
		return n, err
	}
	_spec := sqlgraph.NewUpdateSpec(alltypes.Table, alltypes.Columns, sqlgraph.NewFieldSpec(alltypes.FieldID, field.TypeUint32))
	if ps := atu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := atu.mutation.Int(); ok {
		_spec.SetField(alltypes.FieldInt, field.TypeInt, value)
	}
	if value, ok := atu.mutation.AddedInt(); ok {
		_spec.AddField(alltypes.FieldInt, field.TypeInt, value)
	}
	if value, ok := atu.mutation.Int8(); ok {
		_spec.SetField(alltypes.FieldInt8, field.TypeInt8, value)
	}
	if value, ok := atu.mutation.AddedInt8(); ok {
		_spec.AddField(alltypes.FieldInt8, field.TypeInt8, value)
	}
	if value, ok := atu.mutation.Int16(); ok {
		_spec.SetField(alltypes.FieldInt16, field.TypeInt16, value)
	}
	if value, ok := atu.mutation.AddedInt16(); ok {
		_spec.AddField(alltypes.FieldInt16, field.TypeInt16, value)
	}
	if value, ok := atu.mutation.Int32(); ok {
		_spec.SetField(alltypes.FieldInt32, field.TypeInt32, value)
	}
	if value, ok := atu.mutation.AddedInt32(); ok {
		_spec.AddField(alltypes.FieldInt32, field.TypeInt32, value)
	}
	if value, ok := atu.mutation.Int64(); ok {
		_spec.SetField(alltypes.FieldInt64, field.TypeInt64, value)
	}
	if value, ok := atu.mutation.AddedInt64(); ok {
		_spec.AddField(alltypes.FieldInt64, field.TypeInt64, value)
	}
	if value, ok := atu.mutation.Uint(); ok {
		_spec.SetField(alltypes.FieldUint, field.TypeUint, value)
	}
	if value, ok := atu.mutation.AddedUint(); ok {
		_spec.AddField(alltypes.FieldUint, field.TypeUint, value)
	}
	if value, ok := atu.mutation.Uint8(); ok {
		_spec.SetField(alltypes.FieldUint8, field.TypeUint8, value)
	}
	if value, ok := atu.mutation.AddedUint8(); ok {
		_spec.AddField(alltypes.FieldUint8, field.TypeUint8, value)
	}
	if value, ok := atu.mutation.Uint16(); ok {
		_spec.SetField(alltypes.FieldUint16, field.TypeUint16, value)
	}
	if value, ok := atu.mutation.AddedUint16(); ok {
		_spec.AddField(alltypes.FieldUint16, field.TypeUint16, value)
	}
	if value, ok := atu.mutation.Uint32(); ok {
		_spec.SetField(alltypes.FieldUint32, field.TypeUint32, value)
	}
	if value, ok := atu.mutation.AddedUint32(); ok {
		_spec.AddField(alltypes.FieldUint32, field.TypeUint32, value)
	}
	if value, ok := atu.mutation.Uint64(); ok {
		_spec.SetField(alltypes.FieldUint64, field.TypeUint64, value)
	}
	if value, ok := atu.mutation.AddedUint64(); ok {
		_spec.AddField(alltypes.FieldUint64, field.TypeUint64, value)
	}
	if value, ok := atu.mutation.Float32(); ok {
		_spec.SetField(alltypes.FieldFloat32, field.TypeFloat32, value)
	}
	if value, ok := atu.mutation.AddedFloat32(); ok {
		_spec.AddField(alltypes.FieldFloat32, field.TypeFloat32, value)
	}
	if value, ok := atu.mutation.Float64(); ok {
		_spec.SetField(alltypes.FieldFloat64, field.TypeFloat64, value)
	}
	if value, ok := atu.mutation.AddedFloat64(); ok {
		_spec.AddField(alltypes.FieldFloat64, field.TypeFloat64, value)
	}
	if value, ok := atu.mutation.StringType(); ok {
		_spec.SetField(alltypes.FieldStringType, field.TypeString, value)
	}
	if value, ok := atu.mutation.Bool(); ok {
		_spec.SetField(alltypes.FieldBool, field.TypeBool, value)
	}
	if value, ok := atu.mutation.UUID(); ok {
		_spec.SetField(alltypes.FieldUUID, field.TypeUUID, value)
	}
	if value, ok := atu.mutation.Time(); ok {
		_spec.SetField(alltypes.FieldTime, field.TypeTime, value)
	}
	if value, ok := atu.mutation.Text(); ok {
		_spec.SetField(alltypes.FieldText, field.TypeString, value)
	}
	if value, ok := atu.mutation.State(); ok {
		_spec.SetField(alltypes.FieldState, field.TypeEnum, value)
	}
	if value, ok := atu.mutation.Bytes(); ok {
		_spec.SetField(alltypes.FieldBytes, field.TypeBytes, value)
	}
	if value, ok := atu.mutation.Nilable(); ok {
		_spec.SetField(alltypes.FieldNilable, field.TypeString, value)
	}
	if n, err = sqlgraph.UpdateNodes(ctx, atu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{alltypes.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return 0, err
	}
	atu.mutation.done = true
	return n, nil
}

// AllTypesUpdateOne is the builder for updating a single AllTypes entity.
type AllTypesUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *AllTypesMutation
}

// SetInt sets the "int" field.
func (atuo *AllTypesUpdateOne) SetInt(i int) *AllTypesUpdateOne {
	atuo.mutation.ResetInt()
	atuo.mutation.SetInt(i)
	return atuo
}

// AddInt adds i to the "int" field.
func (atuo *AllTypesUpdateOne) AddInt(i int) *AllTypesUpdateOne {
	atuo.mutation.AddInt(i)
	return atuo
}

// SetInt8 sets the "int8" field.
func (atuo *AllTypesUpdateOne) SetInt8(i int8) *AllTypesUpdateOne {
	atuo.mutation.ResetInt8()
	atuo.mutation.SetInt8(i)
	return atuo
}

// AddInt8 adds i to the "int8" field.
func (atuo *AllTypesUpdateOne) AddInt8(i int8) *AllTypesUpdateOne {
	atuo.mutation.AddInt8(i)
	return atuo
}

// SetInt16 sets the "int16" field.
func (atuo *AllTypesUpdateOne) SetInt16(i int16) *AllTypesUpdateOne {
	atuo.mutation.ResetInt16()
	atuo.mutation.SetInt16(i)
	return atuo
}

// AddInt16 adds i to the "int16" field.
func (atuo *AllTypesUpdateOne) AddInt16(i int16) *AllTypesUpdateOne {
	atuo.mutation.AddInt16(i)
	return atuo
}

// SetInt32 sets the "int32" field.
func (atuo *AllTypesUpdateOne) SetInt32(i int32) *AllTypesUpdateOne {
	atuo.mutation.ResetInt32()
	atuo.mutation.SetInt32(i)
	return atuo
}

// AddInt32 adds i to the "int32" field.
func (atuo *AllTypesUpdateOne) AddInt32(i int32) *AllTypesUpdateOne {
	atuo.mutation.AddInt32(i)
	return atuo
}

// SetInt64 sets the "int64" field.
func (atuo *AllTypesUpdateOne) SetInt64(i int64) *AllTypesUpdateOne {
	atuo.mutation.ResetInt64()
	atuo.mutation.SetInt64(i)
	return atuo
}

// AddInt64 adds i to the "int64" field.
func (atuo *AllTypesUpdateOne) AddInt64(i int64) *AllTypesUpdateOne {
	atuo.mutation.AddInt64(i)
	return atuo
}

// SetUint sets the "uint" field.
func (atuo *AllTypesUpdateOne) SetUint(u uint) *AllTypesUpdateOne {
	atuo.mutation.ResetUint()
	atuo.mutation.SetUint(u)
	return atuo
}

// AddUint adds u to the "uint" field.
func (atuo *AllTypesUpdateOne) AddUint(u int) *AllTypesUpdateOne {
	atuo.mutation.AddUint(u)
	return atuo
}

// SetUint8 sets the "uint8" field.
func (atuo *AllTypesUpdateOne) SetUint8(u uint8) *AllTypesUpdateOne {
	atuo.mutation.ResetUint8()
	atuo.mutation.SetUint8(u)
	return atuo
}

// AddUint8 adds u to the "uint8" field.
func (atuo *AllTypesUpdateOne) AddUint8(u int8) *AllTypesUpdateOne {
	atuo.mutation.AddUint8(u)
	return atuo
}

// SetUint16 sets the "uint16" field.
func (atuo *AllTypesUpdateOne) SetUint16(u uint16) *AllTypesUpdateOne {
	atuo.mutation.ResetUint16()
	atuo.mutation.SetUint16(u)
	return atuo
}

// AddUint16 adds u to the "uint16" field.
func (atuo *AllTypesUpdateOne) AddUint16(u int16) *AllTypesUpdateOne {
	atuo.mutation.AddUint16(u)
	return atuo
}

// SetUint32 sets the "uint32" field.
func (atuo *AllTypesUpdateOne) SetUint32(u uint32) *AllTypesUpdateOne {
	atuo.mutation.ResetUint32()
	atuo.mutation.SetUint32(u)
	return atuo
}

// AddUint32 adds u to the "uint32" field.
func (atuo *AllTypesUpdateOne) AddUint32(u int32) *AllTypesUpdateOne {
	atuo.mutation.AddUint32(u)
	return atuo
}

// SetUint64 sets the "uint64" field.
func (atuo *AllTypesUpdateOne) SetUint64(u uint64) *AllTypesUpdateOne {
	atuo.mutation.ResetUint64()
	atuo.mutation.SetUint64(u)
	return atuo
}

// AddUint64 adds u to the "uint64" field.
func (atuo *AllTypesUpdateOne) AddUint64(u int64) *AllTypesUpdateOne {
	atuo.mutation.AddUint64(u)
	return atuo
}

// SetFloat32 sets the "float32" field.
func (atuo *AllTypesUpdateOne) SetFloat32(f float32) *AllTypesUpdateOne {
	atuo.mutation.ResetFloat32()
	atuo.mutation.SetFloat32(f)
	return atuo
}

// AddFloat32 adds f to the "float32" field.
func (atuo *AllTypesUpdateOne) AddFloat32(f float32) *AllTypesUpdateOne {
	atuo.mutation.AddFloat32(f)
	return atuo
}

// SetFloat64 sets the "float64" field.
func (atuo *AllTypesUpdateOne) SetFloat64(f float64) *AllTypesUpdateOne {
	atuo.mutation.ResetFloat64()
	atuo.mutation.SetFloat64(f)
	return atuo
}

// AddFloat64 adds f to the "float64" field.
func (atuo *AllTypesUpdateOne) AddFloat64(f float64) *AllTypesUpdateOne {
	atuo.mutation.AddFloat64(f)
	return atuo
}

// SetStringType sets the "string_type" field.
func (atuo *AllTypesUpdateOne) SetStringType(s string) *AllTypesUpdateOne {
	atuo.mutation.SetStringType(s)
	return atuo
}

// SetBool sets the "bool" field.
func (atuo *AllTypesUpdateOne) SetBool(b bool) *AllTypesUpdateOne {
	atuo.mutation.SetBool(b)
	return atuo
}

// SetUUID sets the "uuid" field.
func (atuo *AllTypesUpdateOne) SetUUID(u uuid.UUID) *AllTypesUpdateOne {
	atuo.mutation.SetUUID(u)
	return atuo
}

// SetTime sets the "time" field.
func (atuo *AllTypesUpdateOne) SetTime(t time.Time) *AllTypesUpdateOne {
	atuo.mutation.SetTime(t)
	return atuo
}

// SetText sets the "text" field.
func (atuo *AllTypesUpdateOne) SetText(s string) *AllTypesUpdateOne {
	atuo.mutation.SetText(s)
	return atuo
}

// SetState sets the "state" field.
func (atuo *AllTypesUpdateOne) SetState(a alltypes.State) *AllTypesUpdateOne {
	atuo.mutation.SetState(a)
	return atuo
}

// SetBytes sets the "bytes" field.
func (atuo *AllTypesUpdateOne) SetBytes(b []byte) *AllTypesUpdateOne {
	atuo.mutation.SetBytes(b)
	return atuo
}

// SetNilable sets the "nilable" field.
func (atuo *AllTypesUpdateOne) SetNilable(s string) *AllTypesUpdateOne {
	atuo.mutation.SetNilable(s)
	return atuo
}

// Mutation returns the AllTypesMutation object of the builder.
func (atuo *AllTypesUpdateOne) Mutation() *AllTypesMutation {
	return atuo.mutation
}

// Where appends a list predicates to the AllTypesUpdate builder.
func (atuo *AllTypesUpdateOne) Where(ps ...predicate.AllTypes) *AllTypesUpdateOne {
	atuo.mutation.Where(ps...)
	return atuo
}

// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (atuo *AllTypesUpdateOne) Select(field string, fields ...string) *AllTypesUpdateOne {
	atuo.fields = append([]string{field}, fields...)
	return atuo
}

// Save executes the query and returns the updated AllTypes entity.
func (atuo *AllTypesUpdateOne) Save(ctx context.Context) (*AllTypes, error) {
	return withHooks[*AllTypes, AllTypesMutation](ctx, atuo.sqlSave, atuo.mutation, atuo.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (atuo *AllTypesUpdateOne) SaveX(ctx context.Context) *AllTypes {
	node, err := atuo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}

// Exec executes the query on the entity.
func (atuo *AllTypesUpdateOne) Exec(ctx context.Context) error {
	_, err := atuo.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (atuo *AllTypesUpdateOne) ExecX(ctx context.Context) {
	if err := atuo.Exec(ctx); err != nil {
		panic(err)
	}
}

// check runs all checks and user-defined validators on the builder.
func (atuo *AllTypesUpdateOne) check() error {
	if v, ok := atuo.mutation.State(); ok {
		if err := alltypes.StateValidator(v); err != nil {
			return &ValidationError{Name: "state", err: fmt.Errorf(`ent: validator failed for field "AllTypes.state": %w`, err)}
		}
	}
	return nil
}

func (atuo *AllTypesUpdateOne) sqlSave(ctx context.Context) (_node *AllTypes, err error) {
	if err := atuo.check(); err != nil {
		return _node, err
	}
	_spec := sqlgraph.NewUpdateSpec(alltypes.Table, alltypes.Columns, sqlgraph.NewFieldSpec(alltypes.FieldID, field.TypeUint32))
	id, ok := atuo.mutation.ID()
	if !ok {
		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AllTypes.id" for update`)}
	}
	_spec.Node.ID.Value = id
	if fields := atuo.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, alltypes.FieldID)
		for _, f := range fields {
			if !alltypes.ValidColumn(f) {
				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
			}
			if f != alltypes.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, f)
			}
		}
	}
	if ps := atuo.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := atuo.mutation.Int(); ok {
		_spec.SetField(alltypes.FieldInt, field.TypeInt, value)
	}
	if value, ok := atuo.mutation.AddedInt(); ok {
		_spec.AddField(alltypes.FieldInt, field.TypeInt, value)
	}
	if value, ok := atuo.mutation.Int8(); ok {
		_spec.SetField(alltypes.FieldInt8, field.TypeInt8, value)
	}
	if value, ok := atuo.mutation.AddedInt8(); ok {
		_spec.AddField(alltypes.FieldInt8, field.TypeInt8, value)
	}
	if value, ok := atuo.mutation.Int16(); ok {
		_spec.SetField(alltypes.FieldInt16, field.TypeInt16, value)
	}
	if value, ok := atuo.mutation.AddedInt16(); ok {
		_spec.AddField(alltypes.FieldInt16, field.TypeInt16, value)
	}
	if value, ok := atuo.mutation.Int32(); ok {
		_spec.SetField(alltypes.FieldInt32, field.TypeInt32, value)
	}
	if value, ok := atuo.mutation.AddedInt32(); ok {
		_spec.AddField(alltypes.FieldInt32, field.TypeInt32, value)
	}
	if value, ok := atuo.mutation.Int64(); ok {
		_spec.SetField(alltypes.FieldInt64, field.TypeInt64, value)
	}
	if value, ok := atuo.mutation.AddedInt64(); ok {
		_spec.AddField(alltypes.FieldInt64, field.TypeInt64, value)
	}
	if value, ok := atuo.mutation.Uint(); ok {
		_spec.SetField(alltypes.FieldUint, field.TypeUint, value)
	}
	if value, ok := atuo.mutation.AddedUint(); ok {
		_spec.AddField(alltypes.FieldUint, field.TypeUint, value)
	}
	if value, ok := atuo.mutation.Uint8(); ok {
		_spec.SetField(alltypes.FieldUint8, field.TypeUint8, value)
	}
	if value, ok := atuo.mutation.AddedUint8(); ok {
		_spec.AddField(alltypes.FieldUint8, field.TypeUint8, value)
	}
	if value, ok := atuo.mutation.Uint16(); ok {
		_spec.SetField(alltypes.FieldUint16, field.TypeUint16, value)
	}
	if value, ok := atuo.mutation.AddedUint16(); ok {
		_spec.AddField(alltypes.FieldUint16, field.TypeUint16, value)
	}
	if value, ok := atuo.mutation.Uint32(); ok {
		_spec.SetField(alltypes.FieldUint32, field.TypeUint32, value)
	}
	if value, ok := atuo.mutation.AddedUint32(); ok {
		_spec.AddField(alltypes.FieldUint32, field.TypeUint32, value)
	}
	if value, ok := atuo.mutation.Uint64(); ok {
		_spec.SetField(alltypes.FieldUint64, field.TypeUint64, value)
	}
	if value, ok := atuo.mutation.AddedUint64(); ok {
		_spec.AddField(alltypes.FieldUint64, field.TypeUint64, value)
	}
	if value, ok := atuo.mutation.Float32(); ok {
		_spec.SetField(alltypes.FieldFloat32, field.TypeFloat32, value)
	}
	if value, ok := atuo.mutation.AddedFloat32(); ok {
		_spec.AddField(alltypes.FieldFloat32, field.TypeFloat32, value)
	}
	if value, ok := atuo.mutation.Float64(); ok {
		_spec.SetField(alltypes.FieldFloat64, field.TypeFloat64, value)
	}
	if value, ok := atuo.mutation.AddedFloat64(); ok {
		_spec.AddField(alltypes.FieldFloat64, field.TypeFloat64, value)
	}
	if value, ok := atuo.mutation.StringType(); ok {
		_spec.SetField(alltypes.FieldStringType, field.TypeString, value)
	}
	if value, ok := atuo.mutation.Bool(); ok {
		_spec.SetField(alltypes.FieldBool, field.TypeBool, value)
	}
	if value, ok := atuo.mutation.UUID(); ok {
		_spec.SetField(alltypes.FieldUUID, field.TypeUUID, value)
	}
	if value, ok := atuo.mutation.Time(); ok {
		_spec.SetField(alltypes.FieldTime, field.TypeTime, value)
	}
	if value, ok := atuo.mutation.Text(); ok {
		_spec.SetField(alltypes.FieldText, field.TypeString, value)
	}
	if value, ok := atuo.mutation.State(); ok {
		_spec.SetField(alltypes.FieldState, field.TypeEnum, value)
	}
	if value, ok := atuo.mutation.Bytes(); ok {
		_spec.SetField(alltypes.FieldBytes, field.TypeBytes, value)
	}
	if value, ok := atuo.mutation.Nilable(); ok {
		_spec.SetField(alltypes.FieldNilable, field.TypeString, value)
	}
	_node = &AllTypes{config: atuo.config}
	_spec.Assign = _node.assignValues
	_spec.ScanValues = _node.scanValues
	if err = sqlgraph.UpdateNode(ctx, atuo.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{alltypes.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	atuo.mutation.done = true
	return _node, nil
}
