forked from CengSin/oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
namer.go
38 lines (29 loc) · 1014 Bytes
/
namer.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
package oracle
import (
"gorm.io/gorm/schema"
"strings"
)
type Namer struct {
schema.NamingStrategy
}
func ConvertNameToFormat(x string) string {
return strings.ToUpper(x)
}
func (n Namer) TableName(table string) (name string) {
return ConvertNameToFormat(n.NamingStrategy.TableName(table))
}
func (n Namer) ColumnName(table, column string) (name string) {
return ConvertNameToFormat(n.NamingStrategy.ColumnName(table, column))
}
func (n Namer) JoinTableName(table string) (name string) {
return ConvertNameToFormat(n.NamingStrategy.JoinTableName(table))
}
func (n Namer) RelationshipFKName(relationship schema.Relationship) (name string) {
return ConvertNameToFormat(n.NamingStrategy.RelationshipFKName(relationship))
}
func (n Namer) CheckerName(table, column string) (name string) {
return ConvertNameToFormat(n.NamingStrategy.CheckerName(table, column))
}
func (n Namer) IndexName(table, column string) (name string) {
return ConvertNameToFormat(n.NamingStrategy.IndexName(table, column))
}