gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

relation.go (535B)


      1 package schema
      2 
      3 import (
      4 	"fmt"
      5 )
      6 
      7 const (
      8 	InvalidRelation = iota
      9 	HasOneRelation
     10 	BelongsToRelation
     11 	HasManyRelation
     12 	ManyToManyRelation
     13 )
     14 
     15 type Relation struct {
     16 	Type       int
     17 	Field      *Field
     18 	JoinTable  *Table
     19 	BaseFields []*Field
     20 	JoinFields []*Field
     21 	OnUpdate   string
     22 	OnDelete   string
     23 	Condition  []string
     24 
     25 	PolymorphicField *Field
     26 	PolymorphicValue string
     27 
     28 	M2MTable      *Table
     29 	M2MBaseFields []*Field
     30 	M2MJoinFields []*Field
     31 }
     32 
     33 func (r *Relation) String() string {
     34 	return fmt.Sprintf("relation=%s", r.Field.GoName)
     35 }