/
game_role_attribute.go
48 lines (42 loc) · 1.16 KB
/
game_role_attribute.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// GameRoleAttribute holds the schema definition for the GameRoleAttribute entity.
type GameRoleAttribute struct {
ent.Schema
}
// Fields of the GameRoleAttribute.
func (GameRoleAttribute) Fields() []ent.Field {
return []ent.Field{
field.Int64("id"),
field.Int64("user_id"),
field.String("account_id").MaxLen(30),
field.String("role_id").MaxLen(30),
field.String("name").MaxLen(100),
field.Int("type").Default(0),
field.String("value").Default(""),
field.Time("create_at").Default(time.Now).Immutable().SchemaType(map[string]string{
dialect.MySQL: "datetime",
}),
field.Time("update_at").Default(time.Now).UpdateDefault(time.Now).SchemaType(map[string]string{
dialect.MySQL: "datetime",
}),
}
}
func (GameRoleAttribute) Indexes() []ent.Index {
return []ent.Index{
index.Fields("user_id", "account_id", "role_id", "name").Unique(),
index.Fields("account_id"),
index.Fields("role_id"),
index.Fields("name"),
}
}
// Edges of the GameRoleAttribute.
func (GameRoleAttribute) Edges() []ent.Edge {
return nil
}