func (mwouo *MessageWithOptionalsUpdateOne) AddFloatOptional(f float32) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.AddFloatOptional(f)
	return mwouo
}
AddFloatOptional adds f to the "float_optional" field.
package ent
import (
	"context"
	"fmt"
	"time"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithoptionals"
	"entgo.io/contrib/entproto/internal/entprototest/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)
type MessageWithOptionalsUpdate struct {
	config
	hooks    []Hook
	mutation *MessageWithOptionalsMutation
}
func (mwou *MessageWithOptionalsUpdate) Where(ps ...predicate.MessageWithOptionals) *MessageWithOptionalsUpdate {
	mwou.mutation.Where(ps...)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetStrOptional(s string) *MessageWithOptionalsUpdate {
	mwou.mutation.SetStrOptional(s)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableStrOptional(s *string) *MessageWithOptionalsUpdate {
	if s != nil {
		mwou.SetStrOptional(*s)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearStrOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearStrOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetIntOptional(i int8) *MessageWithOptionalsUpdate {
	mwou.mutation.ResetIntOptional()
	mwou.mutation.SetIntOptional(i)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableIntOptional(i *int8) *MessageWithOptionalsUpdate {
	if i != nil {
		mwou.SetIntOptional(*i)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) AddIntOptional(i int8) *MessageWithOptionalsUpdate {
	mwou.mutation.AddIntOptional(i)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearIntOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearIntOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetUintOptional(u uint8) *MessageWithOptionalsUpdate {
	mwou.mutation.ResetUintOptional()
	mwou.mutation.SetUintOptional(u)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableUintOptional(u *uint8) *MessageWithOptionalsUpdate {
	if u != nil {
		mwou.SetUintOptional(*u)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) AddUintOptional(u uint8) *MessageWithOptionalsUpdate {
	mwou.mutation.AddUintOptional(u)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearUintOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearUintOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetFloatOptional(f float32) *MessageWithOptionalsUpdate {
	mwou.mutation.ResetFloatOptional()
	mwou.mutation.SetFloatOptional(f)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableFloatOptional(f *float32) *MessageWithOptionalsUpdate {
	if f != nil {
		mwou.SetFloatOptional(*f)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) AddFloatOptional(f float32) *MessageWithOptionalsUpdate {
	mwou.mutation.AddFloatOptional(f)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearFloatOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearFloatOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetBoolOptional(b bool) *MessageWithOptionalsUpdate {
	mwou.mutation.SetBoolOptional(b)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableBoolOptional(b *bool) *MessageWithOptionalsUpdate {
	if b != nil {
		mwou.SetBoolOptional(*b)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearBoolOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearBoolOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetBytesOptional(b []byte) *MessageWithOptionalsUpdate {
	mwou.mutation.SetBytesOptional(b)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearBytesOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearBytesOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetUUIDOptional(u uuid.UUID) *MessageWithOptionalsUpdate {
	mwou.mutation.SetUUIDOptional(u)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearUUIDOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearUUIDOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetTimeOptional(t time.Time) *MessageWithOptionalsUpdate {
	mwou.mutation.SetTimeOptional(t)
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) SetNillableTimeOptional(t *time.Time) *MessageWithOptionalsUpdate {
	if t != nil {
		mwou.SetTimeOptional(*t)
	}
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) ClearTimeOptional() *MessageWithOptionalsUpdate {
	mwou.mutation.ClearTimeOptional()
	return mwou
}
func (mwou *MessageWithOptionalsUpdate) Mutation() *MessageWithOptionalsMutation {
	return mwou.mutation
}
func (mwou *MessageWithOptionalsUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(mwou.hooks) == 0 {
		affected, err = mwou.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithOptionalsMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwou.mutation = mutation
			affected, err = mwou.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(mwou.hooks) - 1; i >= 0; i-- {
			if mwou.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwou.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwou.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (mwou *MessageWithOptionalsUpdate) SaveX(ctx context.Context) int {
	affected, err := mwou.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (mwou *MessageWithOptionalsUpdate) Exec(ctx context.Context) error {
	_, err := mwou.Save(ctx)
	return err
}
func (mwou *MessageWithOptionalsUpdate) ExecX(ctx context.Context) {
	if err := mwou.Exec(ctx); err != nil {
		panic(err)
	}
}
func (mwou *MessageWithOptionalsUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   messagewithoptionals.Table,
			Columns: messagewithoptionals.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: messagewithoptionals.FieldID,
			},
		},
	}
	if ps := mwou.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := mwou.mutation.StrOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeString,
			Value:  value,
			Column: messagewithoptionals.FieldStrOptional,
		})
	}
	if mwou.mutation.StrOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeString,
			Column: messagewithoptionals.FieldStrOptional,
		})
	}
	if value, ok := mwou.mutation.IntOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeInt8,
			Value:  value,
			Column: messagewithoptionals.FieldIntOptional,
		})
	}
	if value, ok := mwou.mutation.AddedIntOptional(); ok {
		_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
			Type:   field.TypeInt8,
			Value:  value,
			Column: messagewithoptionals.FieldIntOptional,
		})
	}
	if mwou.mutation.IntOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeInt8,
			Column: messagewithoptionals.FieldIntOptional,
		})
	}
	if value, ok := mwou.mutation.UintOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeUint8,
			Value:  value,
			Column: messagewithoptionals.FieldUintOptional,
		})
	}
	if value, ok := mwou.mutation.AddedUintOptional(); ok {
		_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
			Type:   field.TypeUint8,
			Value:  value,
			Column: messagewithoptionals.FieldUintOptional,
		})
	}
	if mwou.mutation.UintOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeUint8,
			Column: messagewithoptionals.FieldUintOptional,
		})
	}
	if value, ok := mwou.mutation.FloatOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeFloat32,
			Value:  value,
			Column: messagewithoptionals.FieldFloatOptional,
		})
	}
	if value, ok := mwou.mutation.AddedFloatOptional(); ok {
		_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
			Type:   field.TypeFloat32,
			Value:  value,
			Column: messagewithoptionals.FieldFloatOptional,
		})
	}
	if mwou.mutation.FloatOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeFloat32,
			Column: messagewithoptionals.FieldFloatOptional,
		})
	}
	if value, ok := mwou.mutation.BoolOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeBool,
			Value:  value,
			Column: messagewithoptionals.FieldBoolOptional,
		})
	}
	if mwou.mutation.BoolOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeBool,
			Column: messagewithoptionals.FieldBoolOptional,
		})
	}
	if value, ok := mwou.mutation.BytesOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeBytes,
			Value:  value,
			Column: messagewithoptionals.FieldBytesOptional,
		})
	}
	if mwou.mutation.BytesOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeBytes,
			Column: messagewithoptionals.FieldBytesOptional,
		})
	}
	if value, ok := mwou.mutation.UUIDOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeUUID,
			Value:  value,
			Column: messagewithoptionals.FieldUUIDOptional,
		})
	}
	if mwou.mutation.UUIDOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeUUID,
			Column: messagewithoptionals.FieldUUIDOptional,
		})
	}
	if value, ok := mwou.mutation.TimeOptional(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeTime,
			Value:  value,
			Column: messagewithoptionals.FieldTimeOptional,
		})
	}
	if mwou.mutation.TimeOptionalCleared() {
		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
			Type:   field.TypeTime,
			Column: messagewithoptionals.FieldTimeOptional,
		})
	}
	if n, err = sqlgraph.UpdateNodes(ctx, mwou.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{messagewithoptionals.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type MessageWithOptionalsUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *MessageWithOptionalsMutation
}
func (mwouo *MessageWithOptionalsUpdateOne) SetStrOptional(s string) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.SetStrOptional(s)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetNillableStrOptional(s *string) *MessageWithOptionalsUpdateOne {
	if s != nil {
		mwouo.SetStrOptional(*s)
	}
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) ClearStrOptional() *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ClearStrOptional()
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetIntOptional(i int8) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ResetIntOptional()
	mwouo.mutation.SetIntOptional(i)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetNillableIntOptional(i *int8) *MessageWithOptionalsUpdateOne {
	if i != nil {
		mwouo.SetIntOptional(*i)
	}
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) AddIntOptional(i int8) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.AddIntOptional(i)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) ClearIntOptional() *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ClearIntOptional()
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetUintOptional(u uint8) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ResetUintOptional()
	mwouo.mutation.SetUintOptional(u)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetNillableUintOptional(u *uint8) *MessageWithOptionalsUpdateOne {
	if u != nil {
		mwouo.SetUintOptional(*u)
	}
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) AddUintOptional(u uint8) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.AddUintOptional(u)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) ClearUintOptional() *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ClearUintOptional()
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetFloatOptional(f float32) *MessageWithOptionalsUpdateOne {
	mwouo.mutation.ResetFloatOptional()
	mwouo.mutation.SetFloatOptional(f)
	return mwouo
}
func (mwouo *MessageWithOptionalsUpdateOne) SetNillableFloatOptional(f *float32) *MessageWithOptionalsUpdateOne {
	if f != nil {
		mwouo.SetFloatOptional(*f)
	}
	return mwouo
}