package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" ) // UserProfile holds the schema definition for the UserProfile entity. type UserProfile struct { ent.Schema } // Fields of the UserProfile. func (UserProfile) Fields() []ent.Field { return []ent.Field{ field.String("name").Unique(), field.String("uuid"), } } // Edges of the UserProfile. func (UserProfile) Edges() []ent.Edge { return []ent.Edge{ edge.From("user", User.Type).Ref("profile").Required().Unique(), } } func (UserProfile) Indexes() []ent.Index { return []ent.Index{ index.Fields("name"), } }