// Code generated by ent, DO NOT EDIT.

package ent

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

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/crowdsecurity/crowdsec/pkg/database/ent/bouncer"
	"github.com/crowdsecurity/crowdsec/pkg/database/ent/predicate"
)

// BouncerUpdate is the builder for updating Bouncer entities.
type BouncerUpdate struct {
	config
	hooks    []Hook
	mutation *BouncerMutation
}

// Where appends a list predicates to the BouncerUpdate builder.
func (_u *BouncerUpdate) Where(ps ...predicate.Bouncer) *BouncerUpdate {
	_u.mutation.Where(ps...)
	return _u
}

// SetUpdatedAt sets the "updated_at" field.
func (_u *BouncerUpdate) SetUpdatedAt(v time.Time) *BouncerUpdate {
	_u.mutation.SetUpdatedAt(v)
	return _u
}

// SetAPIKey sets the "api_key" field.
func (_u *BouncerUpdate) SetAPIKey(v string) *BouncerUpdate {
	_u.mutation.SetAPIKey(v)
	return _u
}

// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableAPIKey(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetAPIKey(*v)
	}
	return _u
}

// SetRevoked sets the "revoked" field.
func (_u *BouncerUpdate) SetRevoked(v bool) *BouncerUpdate {
	_u.mutation.SetRevoked(v)
	return _u
}

// SetNillableRevoked sets the "revoked" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableRevoked(v *bool) *BouncerUpdate {
	if v != nil {
		_u.SetRevoked(*v)
	}
	return _u
}

// SetIPAddress sets the "ip_address" field.
func (_u *BouncerUpdate) SetIPAddress(v string) *BouncerUpdate {
	_u.mutation.SetIPAddress(v)
	return _u
}

// SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableIPAddress(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetIPAddress(*v)
	}
	return _u
}

// ClearIPAddress clears the value of the "ip_address" field.
func (_u *BouncerUpdate) ClearIPAddress() *BouncerUpdate {
	_u.mutation.ClearIPAddress()
	return _u
}

// SetType sets the "type" field.
func (_u *BouncerUpdate) SetType(v string) *BouncerUpdate {
	_u.mutation.SetType(v)
	return _u
}

// SetNillableType sets the "type" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableType(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetType(*v)
	}
	return _u
}

// ClearType clears the value of the "type" field.
func (_u *BouncerUpdate) ClearType() *BouncerUpdate {
	_u.mutation.ClearType()
	return _u
}

// SetVersion sets the "version" field.
func (_u *BouncerUpdate) SetVersion(v string) *BouncerUpdate {
	_u.mutation.SetVersion(v)
	return _u
}

// SetNillableVersion sets the "version" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableVersion(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetVersion(*v)
	}
	return _u
}

// ClearVersion clears the value of the "version" field.
func (_u *BouncerUpdate) ClearVersion() *BouncerUpdate {
	_u.mutation.ClearVersion()
	return _u
}

// SetLastPull sets the "last_pull" field.
func (_u *BouncerUpdate) SetLastPull(v time.Time) *BouncerUpdate {
	_u.mutation.SetLastPull(v)
	return _u
}

// SetNillableLastPull sets the "last_pull" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableLastPull(v *time.Time) *BouncerUpdate {
	if v != nil {
		_u.SetLastPull(*v)
	}
	return _u
}

// ClearLastPull clears the value of the "last_pull" field.
func (_u *BouncerUpdate) ClearLastPull() *BouncerUpdate {
	_u.mutation.ClearLastPull()
	return _u
}

// SetAuthType sets the "auth_type" field.
func (_u *BouncerUpdate) SetAuthType(v string) *BouncerUpdate {
	_u.mutation.SetAuthType(v)
	return _u
}

// SetNillableAuthType sets the "auth_type" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableAuthType(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetAuthType(*v)
	}
	return _u
}

// SetOsname sets the "osname" field.
func (_u *BouncerUpdate) SetOsname(v string) *BouncerUpdate {
	_u.mutation.SetOsname(v)
	return _u
}

// SetNillableOsname sets the "osname" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableOsname(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetOsname(*v)
	}
	return _u
}

// ClearOsname clears the value of the "osname" field.
func (_u *BouncerUpdate) ClearOsname() *BouncerUpdate {
	_u.mutation.ClearOsname()
	return _u
}

// SetOsfamily sets the "osfamily" field.
func (_u *BouncerUpdate) SetOsfamily(v string) *BouncerUpdate {
	_u.mutation.SetOsfamily(v)
	return _u
}

// SetNillableOsfamily sets the "osfamily" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableOsfamily(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetOsfamily(*v)
	}
	return _u
}

// ClearOsfamily clears the value of the "osfamily" field.
func (_u *BouncerUpdate) ClearOsfamily() *BouncerUpdate {
	_u.mutation.ClearOsfamily()
	return _u
}

// SetOsversion sets the "osversion" field.
func (_u *BouncerUpdate) SetOsversion(v string) *BouncerUpdate {
	_u.mutation.SetOsversion(v)
	return _u
}

// SetNillableOsversion sets the "osversion" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableOsversion(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetOsversion(*v)
	}
	return _u
}

// ClearOsversion clears the value of the "osversion" field.
func (_u *BouncerUpdate) ClearOsversion() *BouncerUpdate {
	_u.mutation.ClearOsversion()
	return _u
}

// SetFeatureflags sets the "featureflags" field.
func (_u *BouncerUpdate) SetFeatureflags(v string) *BouncerUpdate {
	_u.mutation.SetFeatureflags(v)
	return _u
}

// SetNillableFeatureflags sets the "featureflags" field if the given value is not nil.
func (_u *BouncerUpdate) SetNillableFeatureflags(v *string) *BouncerUpdate {
	if v != nil {
		_u.SetFeatureflags(*v)
	}
	return _u
}

// ClearFeatureflags clears the value of the "featureflags" field.
func (_u *BouncerUpdate) ClearFeatureflags() *BouncerUpdate {
	_u.mutation.ClearFeatureflags()
	return _u
}

// Mutation returns the BouncerMutation object of the builder.
func (_u *BouncerUpdate) Mutation() *BouncerMutation {
	return _u.mutation
}

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

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

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

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

// defaults sets the default values of the builder before save.
func (_u *BouncerUpdate) defaults() {
	if _, ok := _u.mutation.UpdatedAt(); !ok {
		v := bouncer.UpdateDefaultUpdatedAt()
		_u.mutation.SetUpdatedAt(v)
	}
}

func (_u *BouncerUpdate) sqlSave(ctx context.Context) (_node int, err error) {
	_spec := sqlgraph.NewUpdateSpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt))
	if ps := _u.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := _u.mutation.UpdatedAt(); ok {
		_spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value)
	}
	if value, ok := _u.mutation.APIKey(); ok {
		_spec.SetField(bouncer.FieldAPIKey, field.TypeString, value)
	}
	if value, ok := _u.mutation.Revoked(); ok {
		_spec.SetField(bouncer.FieldRevoked, field.TypeBool, value)
	}
	if value, ok := _u.mutation.IPAddress(); ok {
		_spec.SetField(bouncer.FieldIPAddress, field.TypeString, value)
	}
	if _u.mutation.IPAddressCleared() {
		_spec.ClearField(bouncer.FieldIPAddress, field.TypeString)
	}
	if value, ok := _u.mutation.GetType(); ok {
		_spec.SetField(bouncer.FieldType, field.TypeString, value)
	}
	if _u.mutation.TypeCleared() {
		_spec.ClearField(bouncer.FieldType, field.TypeString)
	}
	if value, ok := _u.mutation.Version(); ok {
		_spec.SetField(bouncer.FieldVersion, field.TypeString, value)
	}
	if _u.mutation.VersionCleared() {
		_spec.ClearField(bouncer.FieldVersion, field.TypeString)
	}
	if value, ok := _u.mutation.LastPull(); ok {
		_spec.SetField(bouncer.FieldLastPull, field.TypeTime, value)
	}
	if _u.mutation.LastPullCleared() {
		_spec.ClearField(bouncer.FieldLastPull, field.TypeTime)
	}
	if value, ok := _u.mutation.AuthType(); ok {
		_spec.SetField(bouncer.FieldAuthType, field.TypeString, value)
	}
	if value, ok := _u.mutation.Osname(); ok {
		_spec.SetField(bouncer.FieldOsname, field.TypeString, value)
	}
	if _u.mutation.OsnameCleared() {
		_spec.ClearField(bouncer.FieldOsname, field.TypeString)
	}
	if value, ok := _u.mutation.Osfamily(); ok {
		_spec.SetField(bouncer.FieldOsfamily, field.TypeString, value)
	}
	if _u.mutation.OsfamilyCleared() {
		_spec.ClearField(bouncer.FieldOsfamily, field.TypeString)
	}
	if value, ok := _u.mutation.Osversion(); ok {
		_spec.SetField(bouncer.FieldOsversion, field.TypeString, value)
	}
	if _u.mutation.OsversionCleared() {
		_spec.ClearField(bouncer.FieldOsversion, field.TypeString)
	}
	if value, ok := _u.mutation.Featureflags(); ok {
		_spec.SetField(bouncer.FieldFeatureflags, field.TypeString, value)
	}
	if _u.mutation.FeatureflagsCleared() {
		_spec.ClearField(bouncer.FieldFeatureflags, field.TypeString)
	}
	if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{bouncer.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return 0, err
	}
	_u.mutation.done = true
	return _node, nil
}

// BouncerUpdateOne is the builder for updating a single Bouncer entity.
type BouncerUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *BouncerMutation
}

// SetUpdatedAt sets the "updated_at" field.
func (_u *BouncerUpdateOne) SetUpdatedAt(v time.Time) *BouncerUpdateOne {
	_u.mutation.SetUpdatedAt(v)
	return _u
}

// SetAPIKey sets the "api_key" field.
func (_u *BouncerUpdateOne) SetAPIKey(v string) *BouncerUpdateOne {
	_u.mutation.SetAPIKey(v)
	return _u
}

// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableAPIKey(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetAPIKey(*v)
	}
	return _u
}

// SetRevoked sets the "revoked" field.
func (_u *BouncerUpdateOne) SetRevoked(v bool) *BouncerUpdateOne {
	_u.mutation.SetRevoked(v)
	return _u
}

// SetNillableRevoked sets the "revoked" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableRevoked(v *bool) *BouncerUpdateOne {
	if v != nil {
		_u.SetRevoked(*v)
	}
	return _u
}

// SetIPAddress sets the "ip_address" field.
func (_u *BouncerUpdateOne) SetIPAddress(v string) *BouncerUpdateOne {
	_u.mutation.SetIPAddress(v)
	return _u
}

// SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableIPAddress(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetIPAddress(*v)
	}
	return _u
}

// ClearIPAddress clears the value of the "ip_address" field.
func (_u *BouncerUpdateOne) ClearIPAddress() *BouncerUpdateOne {
	_u.mutation.ClearIPAddress()
	return _u
}

// SetType sets the "type" field.
func (_u *BouncerUpdateOne) SetType(v string) *BouncerUpdateOne {
	_u.mutation.SetType(v)
	return _u
}

// SetNillableType sets the "type" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableType(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetType(*v)
	}
	return _u
}

// ClearType clears the value of the "type" field.
func (_u *BouncerUpdateOne) ClearType() *BouncerUpdateOne {
	_u.mutation.ClearType()
	return _u
}

// SetVersion sets the "version" field.
func (_u *BouncerUpdateOne) SetVersion(v string) *BouncerUpdateOne {
	_u.mutation.SetVersion(v)
	return _u
}

// SetNillableVersion sets the "version" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableVersion(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetVersion(*v)
	}
	return _u
}

// ClearVersion clears the value of the "version" field.
func (_u *BouncerUpdateOne) ClearVersion() *BouncerUpdateOne {
	_u.mutation.ClearVersion()
	return _u
}

// SetLastPull sets the "last_pull" field.
func (_u *BouncerUpdateOne) SetLastPull(v time.Time) *BouncerUpdateOne {
	_u.mutation.SetLastPull(v)
	return _u
}

// SetNillableLastPull sets the "last_pull" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableLastPull(v *time.Time) *BouncerUpdateOne {
	if v != nil {
		_u.SetLastPull(*v)
	}
	return _u
}

// ClearLastPull clears the value of the "last_pull" field.
func (_u *BouncerUpdateOne) ClearLastPull() *BouncerUpdateOne {
	_u.mutation.ClearLastPull()
	return _u
}

// SetAuthType sets the "auth_type" field.
func (_u *BouncerUpdateOne) SetAuthType(v string) *BouncerUpdateOne {
	_u.mutation.SetAuthType(v)
	return _u
}

// SetNillableAuthType sets the "auth_type" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableAuthType(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetAuthType(*v)
	}
	return _u
}

// SetOsname sets the "osname" field.
func (_u *BouncerUpdateOne) SetOsname(v string) *BouncerUpdateOne {
	_u.mutation.SetOsname(v)
	return _u
}

// SetNillableOsname sets the "osname" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableOsname(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetOsname(*v)
	}
	return _u
}

// ClearOsname clears the value of the "osname" field.
func (_u *BouncerUpdateOne) ClearOsname() *BouncerUpdateOne {
	_u.mutation.ClearOsname()
	return _u
}

// SetOsfamily sets the "osfamily" field.
func (_u *BouncerUpdateOne) SetOsfamily(v string) *BouncerUpdateOne {
	_u.mutation.SetOsfamily(v)
	return _u
}

// SetNillableOsfamily sets the "osfamily" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableOsfamily(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetOsfamily(*v)
	}
	return _u
}

// ClearOsfamily clears the value of the "osfamily" field.
func (_u *BouncerUpdateOne) ClearOsfamily() *BouncerUpdateOne {
	_u.mutation.ClearOsfamily()
	return _u
}

// SetOsversion sets the "osversion" field.
func (_u *BouncerUpdateOne) SetOsversion(v string) *BouncerUpdateOne {
	_u.mutation.SetOsversion(v)
	return _u
}

// SetNillableOsversion sets the "osversion" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableOsversion(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetOsversion(*v)
	}
	return _u
}

// ClearOsversion clears the value of the "osversion" field.
func (_u *BouncerUpdateOne) ClearOsversion() *BouncerUpdateOne {
	_u.mutation.ClearOsversion()
	return _u
}

// SetFeatureflags sets the "featureflags" field.
func (_u *BouncerUpdateOne) SetFeatureflags(v string) *BouncerUpdateOne {
	_u.mutation.SetFeatureflags(v)
	return _u
}

// SetNillableFeatureflags sets the "featureflags" field if the given value is not nil.
func (_u *BouncerUpdateOne) SetNillableFeatureflags(v *string) *BouncerUpdateOne {
	if v != nil {
		_u.SetFeatureflags(*v)
	}
	return _u
}

// ClearFeatureflags clears the value of the "featureflags" field.
func (_u *BouncerUpdateOne) ClearFeatureflags() *BouncerUpdateOne {
	_u.mutation.ClearFeatureflags()
	return _u
}

// Mutation returns the BouncerMutation object of the builder.
func (_u *BouncerUpdateOne) Mutation() *BouncerMutation {
	return _u.mutation
}

// Where appends a list predicates to the BouncerUpdate builder.
func (_u *BouncerUpdateOne) Where(ps ...predicate.Bouncer) *BouncerUpdateOne {
	_u.mutation.Where(ps...)
	return _u
}

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

// Save executes the query and returns the updated Bouncer entity.
func (_u *BouncerUpdateOne) Save(ctx context.Context) (*Bouncer, error) {
	_u.defaults()
	return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}

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

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

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

// defaults sets the default values of the builder before save.
func (_u *BouncerUpdateOne) defaults() {
	if _, ok := _u.mutation.UpdatedAt(); !ok {
		v := bouncer.UpdateDefaultUpdatedAt()
		_u.mutation.SetUpdatedAt(v)
	}
}

func (_u *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err error) {
	_spec := sqlgraph.NewUpdateSpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt))
	id, ok := _u.mutation.ID()
	if !ok {
		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Bouncer.id" for update`)}
	}
	_spec.Node.ID.Value = id
	if fields := _u.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, bouncer.FieldID)
		for _, f := range fields {
			if !bouncer.ValidColumn(f) {
				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
			}
			if f != bouncer.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, f)
			}
		}
	}
	if ps := _u.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := _u.mutation.UpdatedAt(); ok {
		_spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value)
	}
	if value, ok := _u.mutation.APIKey(); ok {
		_spec.SetField(bouncer.FieldAPIKey, field.TypeString, value)
	}
	if value, ok := _u.mutation.Revoked(); ok {
		_spec.SetField(bouncer.FieldRevoked, field.TypeBool, value)
	}
	if value, ok := _u.mutation.IPAddress(); ok {
		_spec.SetField(bouncer.FieldIPAddress, field.TypeString, value)
	}
	if _u.mutation.IPAddressCleared() {
		_spec.ClearField(bouncer.FieldIPAddress, field.TypeString)
	}
	if value, ok := _u.mutation.GetType(); ok {
		_spec.SetField(bouncer.FieldType, field.TypeString, value)
	}
	if _u.mutation.TypeCleared() {
		_spec.ClearField(bouncer.FieldType, field.TypeString)
	}
	if value, ok := _u.mutation.Version(); ok {
		_spec.SetField(bouncer.FieldVersion, field.TypeString, value)
	}
	if _u.mutation.VersionCleared() {
		_spec.ClearField(bouncer.FieldVersion, field.TypeString)
	}
	if value, ok := _u.mutation.LastPull(); ok {
		_spec.SetField(bouncer.FieldLastPull, field.TypeTime, value)
	}
	if _u.mutation.LastPullCleared() {
		_spec.ClearField(bouncer.FieldLastPull, field.TypeTime)
	}
	if value, ok := _u.mutation.AuthType(); ok {
		_spec.SetField(bouncer.FieldAuthType, field.TypeString, value)
	}
	if value, ok := _u.mutation.Osname(); ok {
		_spec.SetField(bouncer.FieldOsname, field.TypeString, value)
	}
	if _u.mutation.OsnameCleared() {
		_spec.ClearField(bouncer.FieldOsname, field.TypeString)
	}
	if value, ok := _u.mutation.Osfamily(); ok {
		_spec.SetField(bouncer.FieldOsfamily, field.TypeString, value)
	}
	if _u.mutation.OsfamilyCleared() {
		_spec.ClearField(bouncer.FieldOsfamily, field.TypeString)
	}
	if value, ok := _u.mutation.Osversion(); ok {
		_spec.SetField(bouncer.FieldOsversion, field.TypeString, value)
	}
	if _u.mutation.OsversionCleared() {
		_spec.ClearField(bouncer.FieldOsversion, field.TypeString)
	}
	if value, ok := _u.mutation.Featureflags(); ok {
		_spec.SetField(bouncer.FieldFeatureflags, field.TypeString, value)
	}
	if _u.mutation.FeatureflagsCleared() {
		_spec.ClearField(bouncer.FieldFeatureflags, field.TypeString)
	}
	_node = &Bouncer{config: _u.config}
	_spec.Assign = _node.assignValues
	_spec.ScanValues = _node.scanValues
	if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{bouncer.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	_u.mutation.done = true
	return _node, nil
}
