personal-site/ent/schema/user.go
2021-12-14 21:16:48 -05:00

35 lines
544 B
Go

package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
// User holds the schema definition for the User entity.
type User struct {
ent.Schema
}
// Fields of the User.
func (User) Fields() []ent.Field {
return []ent.Field{
field.String("name").
NotEmpty(),
field.String("email").
NotEmpty().
Unique(),
field.String("password").
Sensitive().
NotEmpty(),
field.Time("created_at").
Default(time.Now).
Immutable(),
}
}
// Edges of the User.
func (User) Edges() []ent.Edge {
return nil
}