1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2025-02-17 08:04:09 +02:00

сделал find_by_functions.json

This commit is contained in:
Nikitin Aleksandr 2024-08-21 15:35:11 +03:00
parent bba3caded4
commit 3728093fcc
6 changed files with 52 additions and 13 deletions

View File

@ -335,3 +335,28 @@ TEMPLATES_MODEL_FINDMASSBY_FILENAME="model_table_findmassby.go_"
TEMPLATES_MODEL_FINDMASSBY_FUNCTION_FILENAME="model_table_findmassby_function.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME - short filename of "grpc_client_table_findby.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME="grpc_client_table_findby.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_TEST_FILENAME - short filename of "grpc_client_table_findby_test.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_TEST_FILENAME="grpc_client_table_findby_test.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FUNCTION_FILENAME - short filename of "grpc_client_table_findby_function.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FUNCTION_FILENAME="grpc_client_table_findby_function.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FUNCTION_TEST_FILENAME - short filename of "grpc_client_table_findby_function_test.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FUNCTION_TEST_FILENAME="grpc_client_table_findby_function_test.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME - short filename of "grpc_client_table_findmassby.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME="grpc_client_table_findmassby.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_TEST_FILENAME - short filename of "grpc_client_table_findmassby_test.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_TEST_FILENAME="grpc_client_table_findmassby_test.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FUNCTION_FILENAME - short filename of "grpc_client_table_findmassby_function.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FUNCTION_FILENAME="grpc_client_table_findmassby_function.go_"
#TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FUNCTION_TEST_FILENAME - short filename of "grpc_client_table_findmassby_function_test.go_" file
TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FUNCTION_TEST_FILENAME="grpc_client_table_findmassby_function_test.go_"

View File

@ -1,4 +1,4 @@
func TestFindBy_FieldsWithUnderline(t *testing.T) {
func TestFindBy_FieldNamesWithUnderline(t *testing.T) {
config_main.LoadEnv()
grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
defer grpc_client.CloseConnection()

View File

@ -1,11 +1,11 @@
func TestCrud_GRPC_FindMassBy_FieldsWithUnderline(t *testing.T) {
func TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline(t *testing.T) {
config_main.LoadEnv()
grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
defer grpc_client.CloseConnection()
crud := Crud_GRPC{}
Model1 := lawsuit_status_types.LawsuitStatusType{}
Model1.FieldName= 41
Model1.FieldName = 0
Otvet, err := crud.FindMassBy_FieldNamesWithUnderline(&Model1)
if err != nil {

View File

@ -87,6 +87,13 @@ func CreateAllFiles(MapAll map[string]*types.Table) error {
return err
}
//
err = CreateFilesFindByTest(Table1)
if err != nil {
log.Error("CreateFilesFindByTest() table: ", Table1.Name, " error: ", err)
return err
}
//
err = CreateFilesFindMassBy(Table1)
if err != nil {
@ -94,6 +101,13 @@ func CreateAllFiles(MapAll map[string]*types.Table) error {
return err
}
//
err = CreateFilesFindMassByTest(Table1)
if err != nil {
log.Error("CreateFilesFindMassByTest() table: ", Table1.Name, " error: ", err)
return err
}
}
return err

View File

@ -191,7 +191,7 @@ func CreateFilesFindByTest(Table1 *types.Table) error {
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME
TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go"
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go"
//создадим каталог
ok, err := micro.FileExists(DirReadyTable)
@ -286,11 +286,11 @@ func CreateFilesFindByTestTable1(Table1 *types.Table, TextTemplateFunction strin
FieldNamesWithComma := ""
//
TextAssignFind := "\t" + `Request.RequestFieldName = 0` + "\n"
TextAssignFind := "\t" + `Otvet.FieldName = 0` + "\n"
TextAssign := ""
TextFieldName_TEST := ""
MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString)
//MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString)
Underline := ""
Comma := ""
@ -300,8 +300,8 @@ func CreateFilesFindByTestTable1(Table1 *types.Table, TextTemplateFunction strin
log.Panic(Table1.Name + " .MapColumns[" + ColumnName1 + "] = false")
}
DefaultValue := create_files.FindTextDefaultValue(Column1.TypeGo)
RequestFieldName := create_files.FindRequestFieldName_FromMass(Column1, MassColumns)
TextAssign = TextAssign + "\t" + `Request` + RequestFieldName + ` = ` + DefaultValue + "\n"
//RequestFieldName := create_files.FindRequestFieldName_FromMass(Column1, MassColumns)
TextAssign = TextAssign + "\t" + `Otvet.` + Column1.NameGo + ` = ` + DefaultValue + "\n"
FieldNamesWithUnderline = FieldNamesWithUnderline + Underline + Column1.NameGo
FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo
TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue

View File

@ -190,7 +190,7 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error {
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME
TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go"
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go"
//создадим каталог
ok, err := micro.FileExists(DirReadyTable)
@ -285,11 +285,11 @@ func CreateFilesFindMassByTestTable1(Table1 *types.Table, TextTemplateFunction s
FieldNamesWithComma := ""
//
TextAssignFind := "\t" + `Request.RequestFieldName = 0` + "\n"
TextAssignFind := "\t" + `Model1.FieldName = 0` + "\n"
TextAssign := ""
TextFieldName_TEST := ""
MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString)
//MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString)
Underline := ""
Comma := ""
@ -299,8 +299,8 @@ func CreateFilesFindMassByTestTable1(Table1 *types.Table, TextTemplateFunction s
log.Panic(Table1.Name + " .MapColumns[" + ColumnName1 + "] = false")
}
DefaultValue := create_files.FindTextDefaultValue(Column1.TypeGo)
RequestFieldName := create_files.FindRequestFieldName_FromMass(Column1, MassColumns)
TextAssign = TextAssign + "\t" + `Request` + RequestFieldName + ` = ` + DefaultValue + "\n"
//RequestFieldName := create_files.FindRequestFieldName_FromMass(Column1, MassColumns)
TextAssign = TextAssign + "\t" + `Model1.` + Column1.NameGo + ` = ` + DefaultValue + "\n"
FieldNamesWithUnderline = FieldNamesWithUnderline + Underline + Column1.NameGo
FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo
TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue