package schema import ( "time" "entgo.io/ent" "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" ) // Role holds the schema definition for the Role entity. type Role struct { ent.Schema } func (Role) Annotations() []schema.Annotation { return []schema.Annotation{ entsql.Annotation{Table: "roles"}, } } // Fields of the Role. func (Role) Fields() []ent.Field { return []ent.Field{ field.Int64("id"), field.String("name"), field.Text("description"), field.Time("created_at").Default(time.Now), } } // Edges of the Role. func (Role) Edges() []ent.Edge { return []ent.Edge{ edge.To("admins", Admin.Type).Through("admin_roles", AdminRole.Type), } }