package schema import ( "entgo.io/ent" "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "github.com/google/uuid" "time" ) // Account holds the schema definition for the Account entity. type Account struct { ent.Schema } // Fields of the Account. func (Account) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Unique().Immutable().Annotations(&entsql.Annotation{Default: "gen_random_uuid()"}), field.Time("created_at").Default(time.Now).Immutable(), field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now), field.String("nickname").Optional(), field.String("name").Optional(), field.Bytes("secret"), field.Bytes("aes").MinLen(16).MaxLen(32), field.Bytes("x509"), } } // Edges of the Account. func (Account) Edges() []ent.Edge { return []ent.Edge{ edge.To("emails", Email.Type), } }