func (wmfc *WithModifiedFieldCreate) Save(ctx context.Context) (*WithModifiedField, error) {
	var (
		err  error
		node *WithModifiedField
	)
	if len(wmfc.hooks) == 0 {
		if err = wmfc.check(); err != nil {
			return nil, err
		}
		node, err = wmfc.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*WithModifiedFieldMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = wmfc.check(); err != nil {
				return nil, err
			}
			wmfc.mutation = mutation
			if node, err = wmfc.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(wmfc.hooks) - 1; i >= 0; i-- {
			if wmfc.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = wmfc.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, wmfc.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
Save creates the WithModifiedField in the database.
package ent
import (
	"context"
	"errors"
	"fmt"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/user"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withmodifiedfield"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type WithModifiedFieldCreate struct {
	config
	mutation *WithModifiedFieldMutation
	hooks    []Hook
}
func (wmfc *WithModifiedFieldCreate) SetName(s string) *WithModifiedFieldCreate {
	wmfc.mutation.SetName(s)
	return wmfc
}
func (wmfc *WithModifiedFieldCreate) SetOwnerID(id int) *WithModifiedFieldCreate {
	wmfc.mutation.SetOwnerID(id)
	return wmfc
}
func (wmfc *WithModifiedFieldCreate) SetNillableOwnerID(id *int) *WithModifiedFieldCreate {
	if id != nil {
		wmfc = wmfc.SetOwnerID(*id)
	}
	return wmfc
}
func (wmfc *WithModifiedFieldCreate) SetOwner(u *User) *WithModifiedFieldCreate {
	return wmfc.SetOwnerID(u.ID)
}
func (wmfc *WithModifiedFieldCreate) Mutation() *WithModifiedFieldMutation {
	return wmfc.mutation
}