1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-11-21 05:05:52 +02:00

сделал objects

This commit is contained in:
Nikitin Aleksandr 2024-11-07 16:39:09 +03:00
parent a7b2617dc6
commit 34b2cd6b27
18 changed files with 33 additions and 28 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/ManyakRus/starter/config_main"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_starter"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_func"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants"
"github.com/ManyakRus/starter/postgres_gorm"
@ -23,12 +24,9 @@ func Test_server_LawsuitStatusType_ReadObject(t *testing.T) {
Request.VersionModel = object_lawsuit_status_types.ObjectLawsuitStatusType{}.GetStructVersion()
server1 := &ServerGRPC{}
Otvet, err := server1.LawsuitStatusType_ReadObject(ctx, &Request)
if err != nil {
_, err := server1.LawsuitStatusType_ReadObject(ctx, &Request)
if err != nil && crud_func.IsRecordNotFound(err) == false {
t.Error("Test_server_LawsuitStatusType_ReadObject() error: ", err)
}
if Otvet.ModelString == "" {
t.Error("Test_server_LawsuitStatusType_ReadObject() error: ModelString=''")
}
}

View File

@ -766,7 +766,7 @@ func Find_CrudObjectTableURL(TableName string) string {
}
// Find_CrudFuncURL - возвращает URL репозитория crud_func
func Find_CrudFuncURL(string) string {
func Find_CrudFuncURL() string {
Otvet := ""
Otvet = config.Settings.SERVICE_REPOSITORY_URL + "/" + config.Settings.TEMPLATES_CRUD_FUNC_FOLDERNAME

View File

@ -1,4 +1,4 @@
package crud_object_tables
package crud_readobject_tables
import (
"github.com/ManyakRus/crud_generator/internal/create_files"

View File

@ -1,4 +1,4 @@
package crud_object_tables
package crud_readobject_tables
import (
"fmt"
@ -80,6 +80,11 @@ func CreateFiles_ReadObject(MapAll map[string]*types.Table, Table1 *types.Table)
FieldNamesWithCommaM := create_files.Find_FieldNamesWithComma_from_Table_VariableName(Table1, "m")
TextCrud = strings.ReplaceAll(TextCrud, "FieldNamesWithCommaM", FieldNamesWithCommaM)
//создание текста
TextCrud = create_files.Replace_TemplateModel_to_Model(TextCrud, Table1.NameGo)
TextCrud = create_files.Replace_TemplateTableName_to_TableName(TextCrud, Table1.Name)
TextCrud = create_files.AddText_ModuleGenerated(TextCrud)
//создание функций
TextCrud, TextCrudFunc := CreateFiles_ReadObjectTable(MapAll, Table1, TextCrud, TextTemplatedFunction)
//if TextCrudFunc == "" {
@ -88,11 +93,6 @@ func CreateFiles_ReadObject(MapAll map[string]*types.Table, Table1 *types.Table)
//TextCrud = TextCrud + TextCrudFunc
TextCrud = strings.ReplaceAll(TextCrud, "\t//TextFillManyFields", TextCrudFunc)
//создание текста
TextCrud = create_files.Replace_TemplateModel_to_Model(TextCrud, Table1.NameGo)
TextCrud = create_files.Replace_TemplateTableName_to_TableName(TextCrud, Table1.Name)
TextCrud = create_files.AddText_ModuleGenerated(TextCrud)
//TextCrud = strings.ReplaceAll(TextCrud, config.Settings.TEXT_TEMPLATE_MODEL, ModelName)
//TextCrud = strings.ReplaceAll(TextCrud, config.Settings.TEXT_TEMPLATE_TABLENAME, Table1.Name)
//TextCrud = config.Settings.TEXT_MODULE_GENERATED + TextCrud
@ -286,7 +286,7 @@ func CreateFiles_ReadObject_Test(MapAll map[string]*types.Table, Table1 *types.T
TextCrud = create_files.AddImport(TextCrud, CrudStarterURL)
//
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextCrud = create_files.AddImport(TextCrud, CrudFuncURL)
}

View File

@ -203,7 +203,7 @@ func CreateFiles_FindBy_Test(Table1 *types.Table) error {
ModelTableURL := create_files.Find_ModelTableURL(TableName)
TextCrud = create_files.AddImport(TextCrud, ModelTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextCrud = create_files.AddImport(TextCrud, CrudFuncURL)
}

View File

@ -220,7 +220,7 @@ func CreateFiles_FindMassBy_Test(Table1 *types.Table) error {
ModelTableURL := create_files.Find_ModelTableURL(TableName)
TextCrud = create_files.AddImport(TextCrud, ModelTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextCrud = create_files.AddImport(TextCrud, CrudFuncURL)
}

View File

@ -243,7 +243,7 @@ func CreateFiles_FindModelBy_Test(MapAll map[string]*types.Table, Table1 *types.
ModelTableURL := create_files.Find_ModelTableURL(TableName)
TextCrud = create_files.AddImport(TextCrud, ModelTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextCrud = create_files.AddImport(TextCrud, CrudFuncURL)
}

View File

@ -182,7 +182,7 @@ func CreateFiles_ReadAll_Test(Table1 *types.Table) error {
//ModelTableURL := create_files.Find_ModelTableURL(TableName)
//TextCrud = create_files.AddImport(TextCrud, ModelTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextCrud = create_files.AddImport(TextCrud, CrudFuncURL)
}

View File

@ -232,7 +232,7 @@ func CreateFiles_FindBy_Test(Table1 *types.Table) error {
GRPClientTableURL := create_files.Find_GRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, CrudFuncURL)
}

View File

@ -241,7 +241,7 @@ func CreateFiles_FindMassBy_Test(Table1 *types.Table) error {
GRPClientTableURL := create_files.Find_GRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, CrudFuncURL)
}

View File

@ -260,7 +260,7 @@ func CreateFiles_FindModelBy_Test(MapAll map[string]*types.Table, Table1 *types.
GRPClientTableURL := create_files.Find_GRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, CrudFuncURL)
}

View File

@ -197,7 +197,7 @@ func CreateFiles_ReadAll_Test(Table1 *types.Table) error {
GRPClientTableURL := create_files.Find_GRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, CrudFuncURL)
}

View File

@ -220,7 +220,7 @@ func CreateFiles_FindBy_Test(Table1 *types.Table) error {
ProtoURL := create_files.Find_ProtoURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudFuncURL)
}

View File

@ -228,7 +228,7 @@ func CreateFiles_FindMassBy_Test(Table1 *types.Table) error {
ProtoURL := create_files.Find_ProtoURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudFuncURL)
}

View File

@ -248,7 +248,7 @@ func CreateFiles_FindModelBy_Test(MapAll map[string]*types.Table, Table1 *types.
ProtoURL := create_files.Find_ProtoURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudFuncURL)
}

View File

@ -181,7 +181,7 @@ func CreateFiles_ReadAll_Test(Table1 *types.Table) error {
ProtoURL := create_files.Find_ProtoURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL)
CrudFuncURL := create_files.Find_CrudFuncURL(TableName)
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudFuncURL)
}

View File

@ -147,12 +147,19 @@ func CreateFiles_ReadObject_Test(Table1 *types.Table) error {
ProtoURL := create_files.Find_ProtoURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL)
//
CrudStarterURL := create_files.Find_CrudStarterURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudStarterURL)
//
CrudFuncURL := create_files.Find_CrudFuncURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudFuncURL)
//
ConstantsURL := create_files.Find_ConstantsURL()
TextGRPCServer = create_files.AddImport(TextGRPCServer, ConstantsURL)
//
TextGRPCServer = create_files.CheckAndAdd_Import(TextGRPCServer, "encoding/json")
//замена "postgres_gorm.Connect_WithApplicationName("

View File

@ -6,7 +6,7 @@ import (
"github.com/ManyakRus/crud_generator/internal/create_files/alias"
"github.com/ManyakRus/crud_generator/internal/create_files/constants_file"
"github.com/ManyakRus/crud_generator/internal/create_files/crud"
"github.com/ManyakRus/crud_generator/internal/create_files/crud_object_tables"
"github.com/ManyakRus/crud_generator/internal/create_files/crud_readobject_tables"
"github.com/ManyakRus/crud_generator/internal/create_files/crud_starter"
"github.com/ManyakRus/crud_generator/internal/create_files/crud_starter_tables"
"github.com/ManyakRus/crud_generator/internal/create_files/crud_tables"
@ -241,7 +241,7 @@ func StartFillAll() error {
return err
}
err = crud_object_tables.CreateAllFiles(MapAll)
err = crud_readobject_tables.CreateAllFiles(MapAll)
if err != nil {
//log.Error("env_file.CreateAllFiles() error: ", err)
return err