mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-11-21 05:05:52 +02:00
сделал objects
This commit is contained in:
parent
706e46cd05
commit
357f01467d
@ -3084,3 +3084,14 @@ func Find_ObjectColumnModelName(ColumnName string) string {
|
||||
//
|
||||
// return Otvet
|
||||
//}
|
||||
|
||||
// SnakeCase_lower - возвращает строку в формате snake_case, в нижнем регистре
|
||||
func SnakeCase_lower(Text string) string {
|
||||
Otvet := Text
|
||||
|
||||
str := stringy.New(Otvet)
|
||||
Otvet = str.SnakeCase("?", "").Get()
|
||||
Otvet = strings.ToLower(Otvet)
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
@ -122,15 +122,16 @@ func CreateFiles1(MapAll map[string]*types.Table, Table1 *types.Table, TextGo st
|
||||
// continue
|
||||
//}
|
||||
|
||||
//добавим поле
|
||||
ModelNameColumn := create_files.Find_ObjectColumnModelName(Column1.NameGo)
|
||||
JsonName := create_files.SnakeCase_lower(ModelNameColumn)
|
||||
TextField1 := "\t" + ModelNameColumn + " " + TableFK.Name + "." + TableFK.NameGo + "\t`" + `json:"` + JsonName + `" gorm:"-:all"` + "`" + "\n"
|
||||
TextField = TextField + TextField1
|
||||
|
||||
//добавим import
|
||||
ModelTableURL := create_files.Find_ModelTableURL(TableNameFK)
|
||||
Otvet = create_files.AddImport(Otvet, ModelTableURL)
|
||||
|
||||
//добавим поле
|
||||
ModelNameColumn := create_files.Find_ObjectColumnModelName(Column1.NameGo)
|
||||
TextField1 := "\t" + ModelNameColumn + " " + TableFK.Name + "." + TableFK.NameGo + "\n"
|
||||
TextField = TextField + TextField1
|
||||
|
||||
}
|
||||
|
||||
//новые поля
|
||||
|
Loading…
Reference in New Issue
Block a user