func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
	var (
		err  error
		node *User
	)
	uc.defaults()
	if len(uc.hooks) == 0 {
		if err = uc.check(); err != nil {
			return nil, err
		}
		node, err = uc.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*UserMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = uc.check(); err != nil {
				return nil, err
			}
			uc.mutation = mutation
			if node, err = uc.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(uc.hooks) - 1; i >= 0; i-- {
			if uc.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = uc.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, uc.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
Save creates the User in the database.
package ent
import (
	"context"
	"errors"
	"fmt"
	"time"
	"entgo.io/contrib/entproto/internal/todo/ent/attachment"
	"entgo.io/contrib/entproto/internal/todo/ent/group"
	"entgo.io/contrib/entproto/internal/todo/ent/schema"
	"entgo.io/contrib/entproto/internal/todo/ent/user"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)
type UserCreate struct {
	config
	mutation *UserMutation
	hooks    []Hook
}
func (uc *UserCreate) SetUserName(s string) *UserCreate {
	uc.mutation.SetUserName(s)
	return uc
}
func (uc *UserCreate) SetJoined(t time.Time) *UserCreate {
	uc.mutation.SetJoined(t)
	return uc
}
func (uc *UserCreate) SetPoints(u uint) *UserCreate {
	uc.mutation.SetPoints(u)
	return uc
}
func (uc *UserCreate) SetExp(u uint64) *UserCreate {
	uc.mutation.SetExp(u)
	return uc
}
func (uc *UserCreate) SetStatus(u user.Status) *UserCreate {
	uc.mutation.SetStatus(u)
	return uc
}
func (uc *UserCreate) SetExternalID(i int) *UserCreate {
	uc.mutation.SetExternalID(i)
	return uc
}
func (uc *UserCreate) SetCrmID(u uuid.UUID) *UserCreate {
	uc.mutation.SetCrmID(u)
	return uc
}
func (uc *UserCreate) SetBanned(b bool) *UserCreate {
	uc.mutation.SetBanned(b)
	return uc
}
func (uc *UserCreate) SetNillableBanned(b *bool) *UserCreate {
	if b != nil {
		uc.SetBanned(*b)
	}
	return uc
}
func (uc *UserCreate) SetCustomPb(u uint8) *UserCreate {
	uc.mutation.SetCustomPb(u)
	return uc
}
func (uc *UserCreate) SetOptNum(i int) *UserCreate {
	uc.mutation.SetOptNum(i)
	return uc
}
func (uc *UserCreate) SetNillableOptNum(i *int) *UserCreate {
	if i != nil {
		uc.SetOptNum(*i)
	}
	return uc
}
func (uc *UserCreate) SetOptStr(s string) *UserCreate {
	uc.mutation.SetOptStr(s)
	return uc
}
func (uc *UserCreate) SetNillableOptStr(s *string) *UserCreate {
	if s != nil {
		uc.SetOptStr(*s)
	}
	return uc
}
func (uc *UserCreate) SetOptBool(b bool) *UserCreate {
	uc.mutation.SetOptBool(b)
	return uc
}
func (uc *UserCreate) SetNillableOptBool(b *bool) *UserCreate {
	if b != nil {
		uc.SetOptBool(*b)
	}
	return uc
}
func (uc *UserCreate) SetBigInt(si schema.BigInt) *UserCreate {
	uc.mutation.SetBigInt(si)
	return uc
}
func (uc *UserCreate) SetNillableBigInt(si *schema.BigInt) *UserCreate {
	if si != nil {
		uc.SetBigInt(*si)
	}
	return uc
}
func (uc *UserCreate) SetBUser1(i int) *UserCreate {
	uc.mutation.SetBUser1(i)
	return uc
}
func (uc *UserCreate) SetNillableBUser1(i *int) *UserCreate {
	if i != nil {
		uc.SetBUser1(*i)
	}
	return uc
}
func (uc *UserCreate) SetGroupID(id int) *UserCreate {
	uc.mutation.SetGroupID(id)
	return uc
}
func (uc *UserCreate) SetNillableGroupID(id *int) *UserCreate {
	if id != nil {
		uc = uc.SetGroupID(*id)
	}
	return uc
}
func (uc *UserCreate) SetGroup(g *Group) *UserCreate {
	return uc.SetGroupID(g.ID)
}
func (uc *UserCreate) SetAttachmentID(id uuid.UUID) *UserCreate {
	uc.mutation.SetAttachmentID(id)
	return uc
}
func (uc *UserCreate) SetNillableAttachmentID(id *uuid.UUID) *UserCreate {
	if id != nil {
		uc = uc.SetAttachmentID(*id)
	}
	return uc
}
func (uc *UserCreate) SetAttachment(a *Attachment) *UserCreate {
	return uc.SetAttachmentID(a.ID)
}
func (uc *UserCreate) AddReceived1IDs(ids ...uuid.UUID) *UserCreate {
	uc.mutation.AddReceived1IDs(ids...)
	return uc
}
func (uc *UserCreate) AddReceived1(a ...*Attachment) *UserCreate {
	ids := make([]uuid.UUID, len(a))
	for i := range a {
		ids[i] = a[i].ID
	}
	return uc.AddReceived1IDs(ids...)
}
func (uc *UserCreate) Mutation() *UserMutation {
	return uc.mutation
}