mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-11-27 08:40:53 +02:00
сделал find_by_functions.json
This commit is contained in:
parent
67f8a10eb1
commit
e72cfee99f
@ -3,7 +3,6 @@ package crud_lawsuit_status_types
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/postgres_gorm"
|
||||
|
@ -10,6 +10,6 @@ const TIMEOUT_DB_SECONDS = 30
|
||||
|
||||
const TEXT_RECORD_NOT_FOUND = "record not found"
|
||||
|
||||
const TextCrudIsNotInit = "Need initializate crud with InitCrudTransport_GRPC() function at first."
|
||||
const TextCrudIsNotInit = "Need initializate crud with InitCrudTransport_DB() function at first."
|
||||
|
||||
var ErrorCrudIsNotInit error = errors.New(TextCrudIsNotInit)
|
||||
|
@ -2413,9 +2413,9 @@ func Replace_Model_ID_Test_ManyPK(Text string, Table1 *types.Table) string {
|
||||
for _, Column1 := range MassPK {
|
||||
Name := strings.ToUpper(Column1.NameGo)
|
||||
VariableName := Table1.NameGo + "_" + Name + "_Test"
|
||||
Text1 := ConvertGolangVariableToProtobufVariable(Table1, Column1, VariableName)
|
||||
//Text1 := ConvertGolangVariableToProtobufVariable(Table1, Column1, VariableName)
|
||||
RequestColumnName := FindRequestFieldName(Table1, Column1)
|
||||
TextNew = TextNew + "\tRequest." + RequestColumnName + " = " + Text1 + "\n"
|
||||
TextNew = TextNew + "\tRequest." + RequestColumnName + " = " + VariableName + "\n"
|
||||
}
|
||||
Otvet = strings.ReplaceAll(Otvet, TextFind, TextNew)
|
||||
|
||||
@ -2425,9 +2425,9 @@ func Replace_Model_ID_Test_ManyPK(Text string, Table1 *types.Table) string {
|
||||
for _, Column1 := range MassPK {
|
||||
Name := strings.ToUpper(Column1.NameGo)
|
||||
VariableName := Table1.NameGo + "_" + Name + "_Test"
|
||||
Text1 := ConvertGolangVariableToProtobufVariable(Table1, Column1, VariableName)
|
||||
//Text1 := ConvertGolangVariableToProtobufVariable(Table1, Column1, VariableName)
|
||||
RequestColumnName := FindRequestFieldName(Table1, Column1)
|
||||
TextNew = TextNew + "\tRequest2." + RequestColumnName + " = " + Text1 + "\n"
|
||||
TextNew = TextNew + "\tRequest2." + RequestColumnName + " = " + VariableName + "\n"
|
||||
}
|
||||
Otvet = strings.ReplaceAll(Otvet, TextFind, TextNew)
|
||||
|
||||
@ -3035,7 +3035,8 @@ func FindMassTableColumns(MapAll map[string]*types.Table, MassTableColumns_Strin
|
||||
for _, TableColumns_string1 := range MassTableColumns_String {
|
||||
Table1, ok := MapAll[TableColumns_string1.TableName]
|
||||
if ok == false {
|
||||
log.Panic(" Error: not found table: ", TableColumns_string1.TableName)
|
||||
log.Warn(" Error: not found table: ", TableColumns_string1.TableName)
|
||||
continue
|
||||
}
|
||||
Columns1 := FindMassColumns_from_MassColumnsString(Table1, TableColumns_string1.MassColumnNames)
|
||||
TableColumns1 := types.TableColumns{}
|
||||
|
@ -221,6 +221,9 @@ func CreateFiles(Table1 *types.Table) error {
|
||||
//переименование функций
|
||||
TextDB = RenameFunctions(TextDB, Table1)
|
||||
|
||||
//импорт "fmt"
|
||||
TextDB = create_files.CheckAndAddImportFmt(TextDB)
|
||||
|
||||
//удаление пустых строк
|
||||
TextDB = create_files.DeleteEmptyLines(TextDB)
|
||||
|
||||
@ -601,10 +604,10 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error {
|
||||
//создание текста
|
||||
TextUpdateEveryColumn := FindTextUpdateEveryColumn(TextCrudUpdateFunc, Table1)
|
||||
|
||||
// пустой файл не нужен
|
||||
if TextUpdateEveryColumn == "" {
|
||||
return err
|
||||
}
|
||||
//// пустой файл не нужен
|
||||
//if TextUpdateEveryColumn == "" {
|
||||
// return err
|
||||
//}
|
||||
|
||||
TextCrud = TextCrud + TextUpdateEveryColumn
|
||||
TextCrud = config.Settings.TEXT_MODULE_GENERATED + TextCrud
|
||||
@ -641,6 +644,9 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error {
|
||||
//удаление пустого импорта
|
||||
TextCrud = create_files.DeleteEmptyImport(TextCrud)
|
||||
|
||||
//импорт "fmt"
|
||||
TextCrud = create_files.CheckAndAddImportFmt(TextCrud)
|
||||
|
||||
//удаление пустых строк
|
||||
TextCrud = create_files.DeleteEmptyLines(TextCrud)
|
||||
|
||||
@ -808,12 +814,15 @@ func CreateFilesUpdateEveryColumnTest(Table1 *types.Table) error {
|
||||
|
||||
//создание текста
|
||||
TextUpdateEveryColumn := FindTextUpdateEveryColumnTest(TextCrudUpdateFunc, Table1)
|
||||
// пустой файл не нужен
|
||||
if TextUpdateEveryColumn == "" {
|
||||
return err
|
||||
}
|
||||
//// пустой файл не нужен
|
||||
//if TextUpdateEveryColumn == "" {
|
||||
// return err
|
||||
//}
|
||||
|
||||
TextCrud = TextCrud + TextUpdateEveryColumn
|
||||
|
||||
TextCrud = create_files.CheckAndAddImportFmt(TextCrud)
|
||||
|
||||
TextCrud = config.Settings.TEXT_MODULE_GENERATED + TextCrud
|
||||
|
||||
//SkipNow() если нет строк в БД
|
||||
|
@ -152,14 +152,8 @@ func CreateGRPCClientTest() error {
|
||||
if config.Settings.USE_DEFAULT_TEMPLATE == true {
|
||||
TextGRPCClient = create_files.DeleteTemplateRepositoryImports(TextGRPCClient)
|
||||
|
||||
DBConstantsURL := create_files.FindDBConstantsURL()
|
||||
TextGRPCClient = create_files.AddImport(TextGRPCClient, DBConstantsURL)
|
||||
|
||||
//заменим имя сервиса на новое
|
||||
ServiceNameTemplate := config.Settings.TEMPLATE_SERVICE_NAME
|
||||
ServiceName := config.Settings.SERVICE_NAME
|
||||
TextGRPCClient = strings.ReplaceAll(TextGRPCClient, ServiceNameTemplate, ServiceName)
|
||||
TextGRPCClient = strings.ReplaceAll(TextGRPCClient, strings.ToUpper(ServiceNameTemplate), strings.ToUpper(ServiceName))
|
||||
//DBConstantsURL := create_files.FindDBConstantsURL()
|
||||
//TextGRPCClient = create_files.AddImport(TextGRPCClient, DBConstantsURL)
|
||||
|
||||
}
|
||||
|
||||
|
@ -488,10 +488,10 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error {
|
||||
|
||||
//создание текста
|
||||
TextUpdateEveryColumn := FindTextUpdateEveryColumn(TextGRPC_Client_UpdateFunc, Table1)
|
||||
// пустой файл не нужен
|
||||
if TextUpdateEveryColumn == "" {
|
||||
return err
|
||||
}
|
||||
//// пустой файл не нужен
|
||||
//if TextUpdateEveryColumn == "" {
|
||||
// return err
|
||||
//}
|
||||
|
||||
//ModelName := Table1.NameGo
|
||||
//TextGRPC_Client = strings.ReplaceAll(TextGRPC_Client, config.Settings.TEXT_TEMPLATE_MODEL, ModelName)
|
||||
@ -661,10 +661,11 @@ func CreateFilesUpdateEveryColumnTest(Table1 *types.Table) error {
|
||||
|
||||
//создание текста
|
||||
TextUpdateEveryColumn := FindTextUpdateEveryColumnTest(TextGRPC_Client_UpdateFunc, Table1)
|
||||
// пустой файл не нужен
|
||||
if TextUpdateEveryColumn == "" {
|
||||
return err
|
||||
}
|
||||
//// пустой файл не нужен
|
||||
//if TextUpdateEveryColumn == "" {
|
||||
// return err
|
||||
//}
|
||||
|
||||
//ModelName := Table1.NameGo
|
||||
//TextGRPC_Client = strings.ReplaceAll(TextGRPC_Client, config.Settings.TEXT_TEMPLATE_MODEL, ModelName)
|
||||
//TextGRPC_Client = strings.ReplaceAll(TextGRPC_Client, config.Settings.TEXT_TEMPLATE_TABLENAME, Table1.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user