mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-01-15 11:00:14 +00:00
98263a7de6
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
34 lines
510 B
Go
34 lines
510 B
Go
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)
|
|
}
|