func (tc *TodoCreate) Save(ctx context.Context) (*Todo, error) {
	var (
		err  error
		node *Todo
	)
	tc.defaults()
	if len(tc.hooks) == 0 {
		if err = tc.check(); err != nil {
			return nil, err
		}
		node, err = tc.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*TodoMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = tc.check(); err != nil {
				return nil, err
			}
			tc.mutation = mutation
			if node, err = tc.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(tc.hooks) - 1; i >= 0; i-- {
			if tc.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = tc.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, tc.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
Save creates the Todo in the database.
package ent
import (
	"context"
	"errors"
	"fmt"
	"time"
	"entgo.io/contrib/entgql/internal/todo/ent/category"
	"entgo.io/contrib/entgql/internal/todo/ent/todo"
	"entgo.io/contrib/entgql/internal/todo/ent/verysecret"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type TodoCreate struct {
	config
	mutation *TodoMutation
	hooks    []Hook
}
func (tc *TodoCreate) SetCreatedAt(t time.Time) *TodoCreate {
	tc.mutation.SetCreatedAt(t)
	return tc
}
func (tc *TodoCreate) SetNillableCreatedAt(t *time.Time) *TodoCreate {
	if t != nil {
		tc.SetCreatedAt(*t)
	}
	return tc
}
func (tc *TodoCreate) SetStatus(t todo.Status) *TodoCreate {
	tc.mutation.SetStatus(t)
	return tc
}
func (tc *TodoCreate) SetPriority(i int) *TodoCreate {
	tc.mutation.SetPriority(i)
	return tc
}
func (tc *TodoCreate) SetNillablePriority(i *int) *TodoCreate {
	if i != nil {
		tc.SetPriority(*i)
	}
	return tc
}
func (tc *TodoCreate) SetText(s string) *TodoCreate {
	tc.mutation.SetText(s)
	return tc
}
func (tc *TodoCreate) SetBlob(b []byte) *TodoCreate {
	tc.mutation.SetBlob(b)
	return tc
}
func (tc *TodoCreate) SetParentID(id int) *TodoCreate {
	tc.mutation.SetParentID(id)
	return tc
}
func (tc *TodoCreate) SetNillableParentID(id *int) *TodoCreate {
	if id != nil {
		tc = tc.SetParentID(*id)
	}
	return tc
}
func (tc *TodoCreate) SetParent(t *Todo) *TodoCreate {
	return tc.SetParentID(t.ID)
}
func (tc *TodoCreate) AddChildIDs(ids ...int) *TodoCreate {
	tc.mutation.AddChildIDs(ids...)
	return tc
}
func (tc *TodoCreate) AddChildren(t ...*Todo) *TodoCreate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return tc.AddChildIDs(ids...)
}
func (tc *TodoCreate) SetCategoryID(id int) *TodoCreate {
	tc.mutation.SetCategoryID(id)
	return tc
}
func (tc *TodoCreate) SetNillableCategoryID(id *int) *TodoCreate {
	if id != nil {
		tc = tc.SetCategoryID(*id)
	}
	return tc
}
func (tc *TodoCreate) SetCategory(c *Category) *TodoCreate {
	return tc.SetCategoryID(c.ID)
}
func (tc *TodoCreate) SetSecretID(id int) *TodoCreate {
	tc.mutation.SetSecretID(id)
	return tc
}
func (tc *TodoCreate) SetNillableSecretID(id *int) *TodoCreate {
	if id != nil {
		tc = tc.SetSecretID(*id)
	}
	return tc
}
func (tc *TodoCreate) SetSecret(v *VerySecret) *TodoCreate {
	return tc.SetSecretID(v.ID)
}
func (tc *TodoCreate) Mutation() *TodoMutation {
	return tc.mutation
}