72 lines
1002 B
Go
72 lines
1002 B
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Game holds the schema definition for the Game entity.
|
|
type Sev struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Sev) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
|
|
field.String("password").
|
|
NotEmpty().
|
|
Immutable().
|
|
Sensitive(),
|
|
|
|
field.String("token").
|
|
Optional().
|
|
Sensitive(),
|
|
|
|
field.Bool("limit").
|
|
Default(false).
|
|
Optional(),
|
|
|
|
field.Int("count").
|
|
Optional(),
|
|
|
|
field.String("handle").
|
|
Optional(),
|
|
|
|
field.String("did").
|
|
Optional(),
|
|
|
|
field.Int("uid").
|
|
Optional(),
|
|
|
|
field.Int("cid").
|
|
Optional(),
|
|
|
|
field.Int("cp").
|
|
Optional(),
|
|
|
|
field.Int("card").
|
|
Optional(),
|
|
|
|
field.Time("updated_at").
|
|
Optional(),
|
|
|
|
field.Time("created_at").
|
|
Immutable().
|
|
Optional().
|
|
Default(func() time.Time {
|
|
return time.Now().In(jst)
|
|
}),
|
|
}
|
|
}
|
|
|
|
func (Sev) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.From("owner", User.Type).
|
|
Ref("sev").
|
|
Unique().
|
|
Required(),
|
|
}
|
|
}
|