func (mwfocb *MessageWithFieldOneCreateBulk) Exec(ctx context.Context) error {
	_, err := mwfocb.Save(ctx)
	return err
}
Exec executes the query.
package ent
import (
	"context"
	"errors"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithfieldone"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type MessageWithFieldOneCreate struct {
	config
	mutation *MessageWithFieldOneMutation
	hooks    []Hook
}
func (mwfoc *MessageWithFieldOneCreate) SetFieldOne(i int32) *MessageWithFieldOneCreate {
	mwfoc.mutation.SetFieldOne(i)
	return mwfoc
}
func (mwfoc *MessageWithFieldOneCreate) Mutation() *MessageWithFieldOneMutation {
	return mwfoc.mutation
}
func (mwfoc *MessageWithFieldOneCreate) Save(ctx context.Context) (*MessageWithFieldOne, error) {
	var (
		err  error
		node *MessageWithFieldOne
	)
	if len(mwfoc.hooks) == 0 {
		if err = mwfoc.check(); err != nil {
			return nil, err
		}
		node, err = mwfoc.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithFieldOneMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = mwfoc.check(); err != nil {
				return nil, err
			}
			mwfoc.mutation = mutation
			if node, err = mwfoc.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(mwfoc.hooks) - 1; i >= 0; i-- {
			if mwfoc.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwfoc.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwfoc.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (mwfoc *MessageWithFieldOneCreate) SaveX(ctx context.Context) *MessageWithFieldOne {
	v, err := mwfoc.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (mwfoc *MessageWithFieldOneCreate) Exec(ctx context.Context) error {
	_, err := mwfoc.Save(ctx)
	return err
}
func (mwfoc *MessageWithFieldOneCreate) ExecX(ctx context.Context) {
	if err := mwfoc.Exec(ctx); err != nil {
		panic(err)
	}
}
func (mwfoc *MessageWithFieldOneCreate) check() error {
	if _, ok := mwfoc.mutation.FieldOne(); !ok {
		return &ValidationError{Name: "field_one", err: errors.New(`ent: missing required field "field_one"`)}
	}
	return nil
}
func (mwfoc *MessageWithFieldOneCreate) sqlSave(ctx context.Context) (*MessageWithFieldOne, error) {
	_node, _spec := mwfoc.createSpec()
	if err := sqlgraph.CreateNode(ctx, mwfoc.driver, _spec); err != nil {
		if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return nil, err
	}
	id := _spec.ID.Value.(int64)
	_node.ID = int(id)
	return _node, nil
}
func (mwfoc *MessageWithFieldOneCreate) createSpec() (*MessageWithFieldOne, *sqlgraph.CreateSpec) {
	var (
		_node = &MessageWithFieldOne{config: mwfoc.config}
		_spec = &sqlgraph.CreateSpec{
			Table: messagewithfieldone.Table,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: messagewithfieldone.FieldID,
			},
		}
	)
	if value, ok := mwfoc.mutation.FieldOne(); ok {
		_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
			Type:   field.TypeInt32,
			Value:  value,
			Column: messagewithfieldone.FieldFieldOne,
		})
		_node.FieldOne = value
	}
	return _node, _spec
}
type MessageWithFieldOneCreateBulk struct {
	config
	builders []*MessageWithFieldOneCreate
}
func (mwfocb *MessageWithFieldOneCreateBulk) Save(ctx context.Context) ([]*MessageWithFieldOne, error) {
	specs := make([]*sqlgraph.CreateSpec, len(mwfocb.builders))
	nodes := make([]*MessageWithFieldOne, len(mwfocb.builders))
	mutators := make([]Mutator, len(mwfocb.builders))
	for i := range mwfocb.builders {
		func(i int, root context.Context) {
			builder := mwfocb.builders[i]
			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
				mutation, ok := m.(*MessageWithFieldOneMutation)
				if !ok {
					return nil, fmt.Errorf("unexpected mutation type %T", m)
				}
				if err := builder.check(); err != nil {
					return nil, err
				}
				builder.mutation = mutation
				nodes[i], specs[i] = builder.createSpec()
				var err error
				if i < len(mutators)-1 {
					_, err = mutators[i+1].Mutate(root, mwfocb.builders[i+1].mutation)
				} else {
					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
					if err = sqlgraph.BatchCreate(ctx, mwfocb.driver, spec); err != nil {
						if sqlgraph.IsConstraintError(err) {
							err = &ConstraintError{err.Error(), err}
						}
					}
				}
				if err != nil {
					return nil, err
				}
				mutation.id = &nodes[i].ID
				mutation.done = true
				if specs[i].ID.Value != nil {
					id := specs[i].ID.Value.(int64)
					nodes[i].ID = int(id)
				}
				return nodes[i], nil
			})
			for i := len(builder.hooks) - 1; i >= 0; i-- {
				mut = builder.hooks[i](mut)
			}
			mutators[i] = mut
		}(i, ctx)
	}
	if len(mutators) > 0 {
		if _, err := mutators[0].Mutate(ctx, mwfocb.builders[0].mutation); err != nil {
			return nil, err
		}
	}
	return nodes, nil
}
func (mwfocb *MessageWithFieldOneCreateBulk) SaveX(ctx context.Context) []*MessageWithFieldOne {
	v, err := mwfocb.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}