Fields of the User.
()
| 35 | |
| 36 | // Fields of the User. |
| 37 | func (User) Fields() []ent.Field { |
| 38 | return []ent.Field{ |
| 39 | field.String("email"). |
| 40 | Unique(). |
| 41 | Validate(func(email string) error { |
| 42 | _, err := mail.ParseAddress(email) |
| 43 | return err |
| 44 | }), |
| 45 | field.UUID("id", uuid.UUID{}).Default(uuid.New).Unique(), |
| 46 | field.Time("created_at"). |
| 47 | Default(time.Now). |
| 48 | Immutable(). |
| 49 | Annotations(&entsql.Annotation{ |
| 50 | Default: "CURRENT_TIMESTAMP", |
| 51 | }), |
| 52 | field.Time("updated_at"). |
| 53 | Default(time.Now). |
| 54 | Annotations(&entsql.Annotation{ |
| 55 | Default: "CURRENT_TIMESTAMP", |
| 56 | }), |
| 57 | field.Bool("has_restricted_access").Optional().Nillable(), |
| 58 | field.String("first_name").Optional(), |
| 59 | field.String("last_name").Optional(), |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Edges of the User. |
| 64 | func (User) Edges() []ent.Edge { |