summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-pg/pg/v10/orm/relation.go
blob: 28d915bcde3e40b62bde8c11610ad11ee93425db (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
package orm

import (
	"fmt"

	"github.com/go-pg/pg/v10/types"
)

const (
	InvalidRelation = iota
	HasOneRelation
	BelongsToRelation
	HasManyRelation
	Many2ManyRelation
)

type Relation struct {
	Type        int
	Field       *Field
	JoinTable   *Table
	BaseFKs     []*Field
	JoinFKs     []*Field
	Polymorphic *Field

	M2MTableName  types.Safe
	M2MTableAlias types.Safe
	M2MBaseFKs    []string
	M2MJoinFKs    []string
}

func (r *Relation) String() string {
	return fmt.Sprintf("relation=%s", r.Field.GoName)
}