package schema import ( "entgo.io/ent" "entgo.io/ent/schema/field" "entgo.io/ent/schema/edge" "time" ) // Category holds the schema definition for the Category entity. type Category struct { ent.Schema } // Fields of the Category. func (Category) Fields() []ent.Field { return []ent.Field{ field.Time("created_at"). Default(time.Now), field.Time("updated_at"). Default(time.Now). UpdateDefault(time.Now), } } // Edges of the Category. func (Category) Edges() []ent.Edge { return []ent.Edge{ edge.To("contents", CategoryContent.Type), edge.To("posts", Post.Type), edge.To("daily_items", Daily.Type), } }