blob: 6636e26a61e1229788e53742fff53f4b1e3ec713 (
plain)
| 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
 | package schema
import (
	"fmt"
)
const (
	InvalidRelation = iota
	HasOneRelation
	BelongsToRelation
	HasManyRelation
	ManyToManyRelation
)
type Relation struct {
	Type       int
	Field      *Field
	JoinTable  *Table
	BaseFields []*Field
	JoinFields []*Field
	OnUpdate   string
	OnDelete   string
	Condition  []string
	PolymorphicField *Field
	PolymorphicValue string
	M2MTable      *Table
	M2MBaseFields []*Field
	M2MJoinFields []*Field
}
func (r *Relation) String() string {
	return fmt.Sprintf("relation=%s", r.Field.GoName)
}
 |