func (ic *ImageCreate) Save(ctx context.Context) (*Image, error) {
	var (
		err  error
		node *Image
	)
	if len(ic.hooks) == 0 {
		if err = ic.check(); err != nil {
			return nil, err
		}
		node, err = ic.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*ImageMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = ic.check(); err != nil {
				return nil, err
			}
			ic.mutation = mutation
			if node, err = ic.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(ic.hooks) - 1; i >= 0; i-- {
			if ic.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = ic.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, ic.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
Save creates the Image in the database.
package ent
import (
	"context"
	"errors"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/image"
	"entgo.io/contrib/entproto/internal/entprototest/ent/user"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)
type ImageCreate struct {
	config
	mutation *ImageMutation
	hooks    []Hook
}
func (ic *ImageCreate) SetURLPath(s string) *ImageCreate {
	ic.mutation.SetURLPath(s)
	return ic
}
func (ic *ImageCreate) SetID(u uuid.UUID) *ImageCreate {
	ic.mutation.SetID(u)
	return ic
}
func (ic *ImageCreate) AddUserProfilePicIDs(ids ...int) *ImageCreate {
	ic.mutation.AddUserProfilePicIDs(ids...)
	return ic
}
func (ic *ImageCreate) AddUserProfilePic(u ...*User) *ImageCreate {
	ids := make([]int, len(u))
	for i := range u {
		ids[i] = u[i].ID
	}
	return ic.AddUserProfilePicIDs(ids...)
}
func (ic *ImageCreate) Mutation() *ImageMutation {
	return ic.mutation
}