2019-12-25 07:24:30 +01:00
|
|
|
package psql
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
func (rt RelType) String() string {
|
|
|
|
switch rt {
|
|
|
|
case RelOneToOne:
|
|
|
|
return "one to one"
|
|
|
|
case RelOneToMany:
|
|
|
|
return "one to many"
|
|
|
|
case RelOneToManyThrough:
|
|
|
|
return "one to many through"
|
|
|
|
case RelRemote:
|
|
|
|
return "remote"
|
2020-01-28 06:26:53 +01:00
|
|
|
case RelEmbedded:
|
|
|
|
return "embedded"
|
2020-06-15 09:06:50 +02:00
|
|
|
case RelPolymorphic:
|
|
|
|
return "polymorphic"
|
2019-12-25 07:24:30 +01:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (re *DBRel) String() string {
|
2020-03-19 01:19:56 +01:00
|
|
|
if re.Type == RelOneToManyThrough {
|
2020-06-15 09:06:50 +02:00
|
|
|
return fmt.Sprintf("'%s.%s' --(%s.%s, %s.%s)--> '%s.%s'",
|
|
|
|
re.Left.Table, re.Left.Col,
|
|
|
|
re.Through.Table, re.Through.ColL, re.Through.Table, re.Through.ColR,
|
|
|
|
re.Right.Table, re.Right.Col)
|
2020-03-19 01:19:56 +01:00
|
|
|
}
|
2019-12-25 07:24:30 +01:00
|
|
|
return fmt.Sprintf("'%s.%s' --(%s)--> '%s.%s'",
|
|
|
|
re.Left.Table, re.Left.Col, re.Type, re.Right.Table, re.Right.Col)
|
|
|
|
}
|