func (Todo) Edges() []ent.Edge {
	return []ent.Edge{
		edge.To("parent", Todo.Type).
			Annotations(entgql.Bind()).
			Unique().
			From("children").
			Annotations(entgql.Bind()),
	}
}
Edges of the Todo.
package schema
import (
	"entgo.io/contrib/entgql"
	"entgo.io/ent/schema/edge"
	"time"
	"entgo.io/ent"
	"entgo.io/ent/schema/field"
)
type Todo struct {
	ent.Schema
}
func (Todo) Fields() []ent.Field {
	return []ent.Field{
		field.Text("text").
			NotEmpty().
			Annotations(
				entgql.OrderField("TEXT"),
			),
		field.Time("created_at").
			Default(time.Now).
			Immutable().
			Annotations(
				entgql.OrderField("CREATED_AT"),
			),
		field.Enum("status").
			NamedValues(
				"InProgress", "IN_PROGRESS",
				"Completed", "COMPLETED",
			).
			Default("IN_PROGRESS").
			Annotations(
				entgql.OrderField("STATUS"),
			),
		field.Int("priority").
			Default(0).
			Annotations(
				entgql.OrderField("PRIORITY"),
			),
	}
}