-
Notifications
You must be signed in to change notification settings - Fork 35
/
manytomany.go
43 lines (35 loc) · 1.11 KB
/
manytomany.go
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
36
37
38
39
40
41
42
43
package gorma
import (
"strings"
"github.com/jinzhu/inflection"
)
// LeftNamePlural returns the pluralized version of
// the "owner" of the m2m relationship.
func (m *ManyToManyDefinition) LeftNamePlural() string {
return inflection.Plural(m.Left.ModelName)
}
// RightNamePlural returns the pluralized version
// of the "child" of the m2m relationship.
func (m *ManyToManyDefinition) RightNamePlural() string {
return inflection.Plural(m.Right.ModelName)
}
// LeftName returns the name of the "owner" of the
// m2m relationship.
func (m *ManyToManyDefinition) LeftName() string {
return m.Left.ModelName
}
// RightName returns the name of the "child" of the
// m2m relationship.
func (m *ManyToManyDefinition) RightName() string {
return m.Right.ModelName
}
// LowerLeftName returns the lower case name of the "owner" of the
// m2m relationship.
func (m *ManyToManyDefinition) LowerLeftName() string {
return strings.ToLower(m.Left.ModelName)
}
// LowerRightName returns the name of the "child" of the
// m2m relationship.
func (m *ManyToManyDefinition) LowerRightName() string {
return strings.ToLower(m.Right.ModelName)
}