33 lines
702 B
Go
33 lines
702 B
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Games holds the schema definition for the Games entity.
|
|
type Games struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Games.
|
|
func (Games) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int64("id").Immutable().Unique(),
|
|
field.String("name").MaxLen(100).Unique(),
|
|
field.String("icon"),
|
|
field.String("category").MaxLen(50),
|
|
field.Int("sort_order").Default(0),
|
|
field.Bool("is_active").Optional().Default(true),
|
|
field.Time("created_at").Default(time.Now).Immutable(),
|
|
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
|
|
}
|
|
}
|
|
|
|
// Edges of the Games.
|
|
func (Games) Edges() []ent.Edge {
|
|
return nil
|
|
}
|