Исправление названия внешних ключей
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
This commit is contained in:
parent
b3d90e7b15
commit
ef3413431d
|
@ -65,14 +65,19 @@ func GetModelNameAngular(project *structs.Project, value structs.VisField) strin
|
|||
}
|
||||
|
||||
func FieldInTableByName(name string, table *structs.Table) *structs.Field {
|
||||
/*if table != nil && table.Name == "ratio_gender_age" {
|
||||
fmt.Println(table)
|
||||
}*/
|
||||
for i := range table.Fields {
|
||||
if table.Fields[i].Name == FieldNamePrepare(name) {
|
||||
return &table.Fields[i]
|
||||
}
|
||||
}
|
||||
for i := range table.FkFields {
|
||||
//fmt.Println(FieldNamePrepare(name))
|
||||
if table.FkFields[i].Name == FieldNamePrepare(name) ||
|
||||
table.FkFields[i].Name+"ID" == FieldNamePrepare(name) {
|
||||
table.FkFields[i].Name+"ID" == FieldNamePrepare(name) ||
|
||||
table.FkFields[i].Name+"Id" == FieldNamePrepare(name) {
|
||||
|
||||
return &structs.Field{
|
||||
Name: table.FkFields[i].Name,
|
||||
|
|
|
@ -107,6 +107,8 @@ func FieldNamePrepare(value string) string {
|
|||
value = string(asRunes)
|
||||
i = strings.Index(value, "_")
|
||||
}
|
||||
var regexpForReplace = regexp.MustCompile(`([Ii][Dd]$)`)
|
||||
value = regexpForReplace.ReplaceAllString(value, "ID")
|
||||
return value
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue