-
Notifications
You must be signed in to change notification settings - Fork 1
/
supplier_contact_relation.go
55 lines (49 loc) · 1.26 KB
/
supplier_contact_relation.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
49
50
51
52
53
54
55
package schema
import (
"entgo.io/contrib/entproto"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/donech/pearl/pkg/ent/mixin"
)
// SupplierContact holds the schema definition for the SupplierContact entity.
type SupplierContactRelation struct {
ent.Schema
}
// Fields of the SupplierContact.
func (SupplierContactRelation) Fields() []ent.Field {
return []ent.Field{
field.Int64("contact_id").Optional().Nillable().Annotations(
entproto.Field(2),
),
field.Int8("type").Default(0).Annotations(
entproto.Field(3),
),
field.String("value").Default("").NotEmpty().Annotations(
entproto.Field(4),
),
}
}
// Edges of the SupplierContact.
func (SupplierContactRelation) Edges() []ent.Edge {
return []ent.Edge{
edge.From("contact", SupplierContact.Type).
Ref("relations").
Unique().Field("contact_id"),
}
}
// Annotations of the SupplierContact.
func (SupplierContactRelation) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{
Table: "supplier_contact_relation",
Collation: "utf8mb4_general_ci",
},
entproto.Message(),
}
}
func (SupplierContactRelation) Mixin() []ent.Mixin {
return []ent.Mixin{mixin.CUDTime{}}
}