mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-12-26 12:49:27 +02:00
сделал grpc proto
This commit is contained in:
parent
fa9df81165
commit
d722250106
@ -258,42 +258,42 @@ func (crud Crud_DB) Restore_ctx(ctx context.Context, m *model.LawsuitStatusType)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Find_ByExtID - находит запись в БД по ext_id и connection_id
|
// Find_ByExtID - находит запись в БД по ext_id и connection_id
|
||||||
//func Find_ByExtID(ext_id int64, connection_id int64) (model.LawsuitStatusType, error) {
|
func Find_ByExtID(ext_id int64, connection_id int64) (model.LawsuitStatusType, error) {
|
||||||
// var Otvet model.LawsuitStatusType
|
var Otvet model.LawsuitStatusType
|
||||||
// var err error
|
var err error
|
||||||
|
|
||||||
|
if ext_id <= 0 {
|
||||||
|
err = errors.New("Error: ext_id <=0")
|
||||||
|
return Otvet, err
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if ext_id <= 0 {
|
ctxMain := context.Background()
|
||||||
// err = errors.New("Error: ext_id <=0")
|
ctx, ctxCancelFunc := context.WithTimeout(ctxMain, time.Second*time.Duration(constants.TIMEOUT_DB_SECONDS))
|
||||||
// return Otvet, err
|
defer ctxCancelFunc()
|
||||||
// }
|
|
||||||
//
|
Otvet, err = Find_ByExtID_ctx(ctx, ext_id, connection_id)
|
||||||
// //
|
|
||||||
// ctxMain := context.Background()
|
return Otvet, err
|
||||||
// ctx, ctxCancelFunc := context.WithTimeout(ctxMain, time.Second*time.Duration(constants.TIMEOUT_DB_SECONDS))
|
}
|
||||||
// defer ctxCancelFunc()
|
|
||||||
//
|
// Find_ByExtID_ctx - находит запись в БД по ext_id и connection_id
|
||||||
// Otvet, err = Find_ByExtID_ctx(ctx, ext_id, connection_id)
|
func Find_ByExtID_ctx(ctx context.Context, ext_id int64, connection_id int64) (model.LawsuitStatusType, error) {
|
||||||
//
|
var Otvet model.LawsuitStatusType
|
||||||
// return Otvet, err
|
var err error
|
||||||
//}
|
//log.Trace("start Find_ByExtID() ", TableName, " ext_id: ", ext_id)
|
||||||
//
|
|
||||||
//// Find_ByExtID_ctx - находит запись в БД по ext_id и connection_id
|
if ext_id <= 0 {
|
||||||
//func Find_ByExtID_ctx(ctx context.Context, ext_id int64, connection_id int64) (model.LawsuitStatusType, error) {
|
err = errors.New("Error: ext_id <=0")
|
||||||
// var Otvet model.LawsuitStatusType
|
return Otvet, err
|
||||||
// var err error
|
}
|
||||||
// //log.Trace("start Find_ByExtID() ", TableName, " ext_id: ", ext_id)
|
|
||||||
//
|
db := postgres_gorm.GetConnection()
|
||||||
// if ext_id <= 0 {
|
db.WithContext(ctx)
|
||||||
// err = errors.New("Error: ext_id <=0")
|
|
||||||
// return Otvet, err
|
tx := db.Where("ext_id = ?", ext_id).Where("connection_id = ?", connection_id).First(&Otvet)
|
||||||
// }
|
err = tx.Error
|
||||||
//
|
|
||||||
// db := postgres_gorm.GetConnection()
|
return Otvet, err
|
||||||
// db.WithContext(ctx)
|
}
|
||||||
//
|
|
||||||
// tx := db.Where("ext_id = ?", ext_id).Where("connection_id = ?", connection_id).First(&Otvet)
|
|
||||||
// err = tx.Error
|
|
||||||
//
|
|
||||||
// return Otvet, err
|
|
||||||
//}
|
|
||||||
|
@ -95,17 +95,17 @@ func TestDelete(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//func TestFind_ByExtID(t *testing.T) {
|
func TestFind_ByExtID(t *testing.T) {
|
||||||
// config.LoadEnv()
|
config.LoadEnv()
|
||||||
// postgres_gorm.Connect()
|
postgres_gorm.Connect()
|
||||||
// defer postgres_gorm.CloseConnection()
|
defer postgres_gorm.CloseConnection()
|
||||||
//
|
|
||||||
// Otvet, err := Find_ByExtID(1, constants.CONNECTION_ID_TEST)
|
Otvet, err := Find_ByExtID(1, constants.CONNECTION_ID_TEST)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// t.Error("TestFind_ByExtID() error: ", err)
|
t.Error("TestFind_ByExtID() error: ", err)
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if Otvet.ID == 0 {
|
if Otvet.ID == 0 {
|
||||||
// t.Error("TestFind_ByExtID() error: ID =0")
|
t.Error("TestFind_ByExtID() error: ID =0")
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
@ -280,3 +280,43 @@ func (crud Crud_GRPC) Restore(m *model.LawsuitStatusType) error {
|
|||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find_ByExtID - находит модель в БД по ext_id и connection_id
|
||||||
|
func (crud Crud_GRPC) Find_ByExtID(e *model.LawsuitStatusType) error {
|
||||||
|
//подключение
|
||||||
|
if grpc_client.Client == nil {
|
||||||
|
grpc_client.Connect()
|
||||||
|
}
|
||||||
|
|
||||||
|
//подготовка запроса
|
||||||
|
var VersionModel = crud.GetVersionModel()
|
||||||
|
|
||||||
|
Request := &grpc_proto.RequestExtId{}
|
||||||
|
Request.ExtId = e.ExtID
|
||||||
|
Request.ConnectionId = e.ConnectionID
|
||||||
|
Request.VersionModel = VersionModel
|
||||||
|
|
||||||
|
ctxMain := context.Background()
|
||||||
|
ctx, ctxCancelFunc := context.WithTimeout(ctxMain, time.Second*time.Duration(constants.TIMEOUT_SECONDS))
|
||||||
|
defer ctxCancelFunc()
|
||||||
|
|
||||||
|
//запрос
|
||||||
|
Response, err := grpc_client.Client.LawsuitStatusType_FindByExtId(ctx, Request)
|
||||||
|
if err != nil {
|
||||||
|
sError := err.Error()
|
||||||
|
if sError[0:len(constants.TEXT_ERROR_MODEL_VERSION)] == constants.TEXT_ERROR_MODEL_VERSION {
|
||||||
|
log.Panic("table: ", TableName, " error: ", err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
//ответ
|
||||||
|
sModel := Response.ModelString
|
||||||
|
err = json.Unmarshal([]byte(sModel), e)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -150,3 +150,24 @@ func TestDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFindByExtID(t *testing.T) {
|
||||||
|
config.LoadEnv()
|
||||||
|
grpc_client.Connect()
|
||||||
|
defer grpc_client.CloseConnection()
|
||||||
|
|
||||||
|
crud := Crud_GRPC{}
|
||||||
|
Otvet := model.LawsuitStatusType{}
|
||||||
|
Otvet.ExtID = 1
|
||||||
|
Otvet.ConnectionID = constants.CONNECTION_ID_TEST
|
||||||
|
err := crud.Find_ByExtID(&Otvet)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Error("TestFindByExtID() error: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if Otvet.ID == 0 {
|
||||||
|
t.Error("TestFindByExtID() error: ID =0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"gitlab.aescorp.ru/dsp_dev/claim/common/object_model/pkg/grpc/grpc_proto"
|
"gitlab.aescorp.ru/dsp_dev/claim/common/object_model/pkg/grpc/grpc_proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LawsuitStatusTypes_Read - читает и возвращает модель из БД
|
// LawsuitStatusType_Read - читает и возвращает модель из БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Read(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Read(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -37,8 +37,8 @@ func (s *ServerGRPC) LawsuitStatusTypes_Read(ctx context.Context, Request *grpc_
|
|||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LawsuitStatusTypes_Delete - записывает в БД is_deleted = true и возвращает модель из БД
|
// LawsuitStatusType_Delete - записывает в БД is_deleted = true и возвращает модель из БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Delete(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Delete(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ func (s *ServerGRPC) LawsuitStatusTypes_Delete(ctx context.Context, Request *grp
|
|||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LawsuitStatusTypes_Restore - записывает в БД is_deleted = false и возвращает модель из БД
|
// LawsuitStatusType_Restore - записывает в БД is_deleted = false и возвращает модель из БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Restore(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Restore(ctx context.Context, Request *grpc_proto.RequestId) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -99,8 +99,8 @@ func (s *ServerGRPC) LawsuitStatusTypes_Restore(ctx context.Context, Request *gr
|
|||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LawsuitStatusTypes_Create - создаёт новую запись в БД
|
// LawsuitStatusType_Create - создаёт новую запись в БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Create(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Create(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ func (s *ServerGRPC) LawsuitStatusTypes_Create(ctx context.Context, Request *grp
|
|||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LawsuitStatusTypes_Update - обновляет новую запись в БД
|
// LawsuitStatusType_Update - обновляет новую запись в БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Update(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Update(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ func (s *ServerGRPC) LawsuitStatusTypes_Update(ctx context.Context, Request *grp
|
|||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LawsuitStatusTypes_Save - записывает (создаёт или обновляет) запись в БД
|
// LawsuitStatusType_Save - записывает (создаёт или обновляет) запись в БД
|
||||||
func (s *ServerGRPC) LawsuitStatusTypes_Save(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
func (s *ServerGRPC) LawsuitStatusType_Save(ctx context.Context, Request *grpc_proto.RequestModel) (*grpc_proto.Response, error) {
|
||||||
var Otvet grpc_proto.Response
|
var Otvet grpc_proto.Response
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -206,3 +206,36 @@ func (s *ServerGRPC) LawsuitStatusTypes_Save(ctx context.Context, Request *grpc_
|
|||||||
|
|
||||||
return &Otvet, err
|
return &Otvet, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LawsuitStatusType_FindByExtID - возвращает запись из БД по ext_id и connection_id
|
||||||
|
func (s *ServerGRPC) LawsuitStatusType_FindByExtID(ctx context.Context, Request *grpc_proto.RequestExtId) (*grpc_proto.Response, error) {
|
||||||
|
var Otvet grpc_proto.Response
|
||||||
|
var err error
|
||||||
|
|
||||||
|
//проверим совпадения версии модели
|
||||||
|
VersionServer := model.LawsuitStatusType{}.GetStructVersion()
|
||||||
|
VersionClient := Request.VersionModel
|
||||||
|
if VersionServer != VersionClient {
|
||||||
|
err = ErrorModelVersion(model.Employee{})
|
||||||
|
return &Otvet, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//запрос в БД
|
||||||
|
Model := &model.LawsuitStatusType{}
|
||||||
|
Model.ExtID = Request.ExtId
|
||||||
|
Model.ConnectionID = Request.ConnectionId
|
||||||
|
err = Model.Find_ByExtID()
|
||||||
|
if err != nil {
|
||||||
|
return &Otvet, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//заполяем ответ
|
||||||
|
ModelString, err := Model.GetJSON()
|
||||||
|
if err != nil {
|
||||||
|
return &Otvet, err
|
||||||
|
}
|
||||||
|
Otvet.ModelString = ModelString
|
||||||
|
|
||||||
|
return &Otvet, err
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
// LawsuitStatusType_ID_Test - ID таблицы для тестирования
|
// LawsuitStatusType_ID_Test - ID таблицы для тестирования
|
||||||
const LawsuitStatusType_ID_Test = 1
|
const LawsuitStatusType_ID_Test = 1
|
||||||
|
|
||||||
func Test_server_LawsuitStatusTypes_Read(t *testing.T) {
|
func Test_server_LawsuitStatusType_Read(t *testing.T) {
|
||||||
//t.SkipNow()
|
//t.SkipNow()
|
||||||
config.LoadEnv()
|
config.LoadEnv()
|
||||||
crud_starter.InitCrudTransport_DB()
|
crud_starter.InitCrudTransport_DB()
|
||||||
@ -23,7 +23,7 @@ func Test_server_LawsuitStatusTypes_Read(t *testing.T) {
|
|||||||
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
|
|
||||||
server1 := &ServerGRPC{}
|
server1 := &ServerGRPC{}
|
||||||
Otvet, err := server1.LawsuitStatusTypes_Read(ctx, &Request)
|
Otvet, err := server1.LawsuitStatusType_Read(ctx, &Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Read() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Read() error: ", err)
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ func Test_server_LawsuitStatusTypes_Read(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_server_LawsuitStatusTypes_Delete(t *testing.T) {
|
func Test_server_LawsuitStatusType_Delete(t *testing.T) {
|
||||||
config.LoadEnv()
|
config.LoadEnv()
|
||||||
crud_starter.InitCrudTransport_DB()
|
crud_starter.InitCrudTransport_DB()
|
||||||
|
|
||||||
@ -42,17 +42,17 @@ func Test_server_LawsuitStatusTypes_Delete(t *testing.T) {
|
|||||||
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
|
|
||||||
server1 := &ServerGRPC{}
|
server1 := &ServerGRPC{}
|
||||||
Otvet, err := server1.LawsuitStatusTypes_Delete(ctx, &Request)
|
Otvet, err := server1.LawsuitStatusType_Delete(ctx, &Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Delete() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Delete() error: ", err)
|
||||||
}
|
}
|
||||||
if Otvet.ModelString == "" {
|
if Otvet.ModelString == "" {
|
||||||
t.Error("Test_server_LawsuitStatusType_Delete() error: ModelString=''")
|
t.Error("Test_server_LawsuitStatusType_Delete() error: ModelString=''")
|
||||||
}
|
}
|
||||||
Otvet, err = server1.LawsuitStatusTypes_Restore(ctx, &Request)
|
Otvet, err = server1.LawsuitStatusType_Restore(ctx, &Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_server_LawsuitStatusTypes_Create(t *testing.T) {
|
func Test_server_LawsuitStatusType_Create(t *testing.T) {
|
||||||
config.LoadEnv()
|
config.LoadEnv()
|
||||||
crud_starter.InitCrudTransport_DB()
|
crud_starter.InitCrudTransport_DB()
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ func Test_server_LawsuitStatusTypes_Create(t *testing.T) {
|
|||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
server1 := &ServerGRPC{}
|
server1 := &ServerGRPC{}
|
||||||
Otvet, err := server1.LawsuitStatusTypes_Create(ctx, &RequestModel)
|
Otvet, err := server1.LawsuitStatusType_Create(ctx, &RequestModel)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Create() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Create() error: ", err)
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ func Test_server_LawsuitStatusTypes_Create(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_server_LawsuitStatusTypes_Update(t *testing.T) {
|
func Test_server_LawsuitStatusType_Update(t *testing.T) {
|
||||||
config.LoadEnv()
|
config.LoadEnv()
|
||||||
crud_starter.InitCrudTransport_DB()
|
crud_starter.InitCrudTransport_DB()
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ func Test_server_LawsuitStatusTypes_Update(t *testing.T) {
|
|||||||
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
|
|
||||||
server1 := &ServerGRPC{}
|
server1 := &ServerGRPC{}
|
||||||
Response1, err := server1.LawsuitStatusTypes_Read(ctx, &Request)
|
Response1, err := server1.LawsuitStatusType_Read(ctx, &Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Update() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Update() error: ", err)
|
||||||
return
|
return
|
||||||
@ -106,7 +106,7 @@ func Test_server_LawsuitStatusTypes_Update(t *testing.T) {
|
|||||||
RequestModel.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
RequestModel.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
RequestModel.ModelString = ModelString
|
RequestModel.ModelString = ModelString
|
||||||
|
|
||||||
Otvet, err := server1.LawsuitStatusTypes_Update(ctx, &RequestModel)
|
Otvet, err := server1.LawsuitStatusType_Update(ctx, &RequestModel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Update() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Update() error: ", err)
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ func Test_server_LawsuitStatusTypes_Update(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_server_LawsuitStatusTypes_Save(t *testing.T) {
|
func Test_server_LawsuitStatusType_Save(t *testing.T) {
|
||||||
config.LoadEnv()
|
config.LoadEnv()
|
||||||
crud_starter.InitCrudTransport_DB()
|
crud_starter.InitCrudTransport_DB()
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ func Test_server_LawsuitStatusTypes_Save(t *testing.T) {
|
|||||||
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
Request.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
|
|
||||||
server1 := &ServerGRPC{}
|
server1 := &ServerGRPC{}
|
||||||
Response1, err := server1.LawsuitStatusTypes_Read(ctx, &Request)
|
Response1, err := server1.LawsuitStatusType_Read(ctx, &Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Save() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Save() error: ", err)
|
||||||
return
|
return
|
||||||
@ -142,7 +142,7 @@ func Test_server_LawsuitStatusTypes_Save(t *testing.T) {
|
|||||||
RequestModel.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
RequestModel.VersionModel = model.LawsuitStatusType{}.GetStructVersion()
|
||||||
RequestModel.ModelString = ModelString
|
RequestModel.ModelString = ModelString
|
||||||
|
|
||||||
Otvet, err := server1.LawsuitStatusTypes_Save(ctx, &RequestModel)
|
Otvet, err := server1.LawsuitStatusType_Save(ctx, &RequestModel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Test_server_LawsuitStatusType_Save() error: ", err)
|
t.Error("Test_server_LawsuitStatusType_Save() error: ", err)
|
||||||
}
|
}
|
||||||
@ -151,3 +151,24 @@ func Test_server_LawsuitStatusTypes_Save(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_server_LawsuitStatusType_FindByExtID(t *testing.T) {
|
||||||
|
config.LoadEnv()
|
||||||
|
crud_starter.InitCrudTransport_DB()
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
Request := grpc_proto.RequestExtId{}
|
||||||
|
Request.ExtId = 1
|
||||||
|
Request.ConnectionId = 3
|
||||||
|
Request.VersionModel = model.Employee{}.GetStructVersion()
|
||||||
|
|
||||||
|
server1 := &ServerGRPC{}
|
||||||
|
Otvet, err := server1.LawsuitStatusType_FindByExtId(ctx, &Request)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("Test_server_LawsuitStatusType_FindByExtId() error: ", err)
|
||||||
|
}
|
||||||
|
if Otvet.ModelString == "" {
|
||||||
|
t.Error("Test_server_LawsuitStatusType_FindByExtId() error: ModelString=''")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ type ICrud_LawsuitStatusType interface {
|
|||||||
Create(*LawsuitStatusType) error
|
Create(*LawsuitStatusType) error
|
||||||
Delete(*LawsuitStatusType) error
|
Delete(*LawsuitStatusType) error
|
||||||
Restore(*LawsuitStatusType) error
|
Restore(*LawsuitStatusType) error
|
||||||
|
Find_ByExtID(*LawsuitStatusType) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName - возвращает имя таблицы в БД, нужен для gorm
|
// TableName - возвращает имя таблицы в БД, нужен для gorm
|
||||||
@ -135,6 +136,13 @@ func (m *LawsuitStatusType) Restore() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find_ByExtID - находит объект по ExtID
|
||||||
|
func (m *LawsuitStatusType) Find_ByExtID() error {
|
||||||
|
err := crud_LawsuitStatusType.Find_ByExtID(m)
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// SetCrudInterface - заполняет интерфейс crud: DB, GRPC, NRPC
|
// SetCrudInterface - заполняет интерфейс crud: DB, GRPC, NRPC
|
||||||
func (m LawsuitStatusType) SetCrudInterface(crud ICrud_LawsuitStatusType) {
|
func (m LawsuitStatusType) SetCrudInterface(crud ICrud_LawsuitStatusType) {
|
||||||
crud_LawsuitStatusType = crud
|
crud_LawsuitStatusType = crud
|
||||||
|
@ -254,3 +254,39 @@ func (crud Crud_NRPC) Restore(l *model.LawsuitStatusType) error {
|
|||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find_ByExtID - находит модель в БД по ext_id и connection_id
|
||||||
|
func (crud Crud_NRPC) Find_ByExtID(e *model.LawsuitStatusType) error {
|
||||||
|
//подключение
|
||||||
|
if nrpc_client.Client == nil {
|
||||||
|
nrpc_client.Connect()
|
||||||
|
}
|
||||||
|
|
||||||
|
//подготовка запроса
|
||||||
|
var VersionModel = crud.GetVersionModel()
|
||||||
|
|
||||||
|
Request := &grpc_proto.RequestExtId{}
|
||||||
|
Request.ExtId = e.ExtID
|
||||||
|
Request.ConnectionId = e.ConnectionID
|
||||||
|
Request.VersionModel = VersionModel
|
||||||
|
|
||||||
|
//запрос
|
||||||
|
Response, err := nrpc_client.Client.LawsuitStatusType_FindByExtId(Request)
|
||||||
|
if err != nil {
|
||||||
|
sError := err.Error()
|
||||||
|
if sError[0:len(constants.TEXT_ERROR_MODEL_VERSION)] == constants.TEXT_ERROR_MODEL_VERSION {
|
||||||
|
log.Panic("table: ", TableName, " error: ", err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
//ответ
|
||||||
|
sModel := Response.ModelString
|
||||||
|
err = json.Unmarshal([]byte(sModel), e)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -150,3 +150,24 @@ func TestDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFindByExtID(t *testing.T) {
|
||||||
|
config.LoadEnv()
|
||||||
|
nrpc_client.Connect()
|
||||||
|
defer nrpc_client.CloseConnection()
|
||||||
|
|
||||||
|
crud := Crud_NRPC{}
|
||||||
|
Otvet := model.LawsuitStatusType{}
|
||||||
|
Otvet.ExtID = 1
|
||||||
|
Otvet.ConnectionID = constants.CONNECTION_ID_TEST
|
||||||
|
err := crud.Find_ByExtID(&Otvet)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Error("TestFindByExtId() error: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if Otvet.ID == 0 {
|
||||||
|
t.Error("TestFindByExtId() error: ID =0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ func CreateFiles(Table1 *types.Table) error {
|
|||||||
TextDB = DeleteFuncRestoreCtx(TextDB, Table1)
|
TextDB = DeleteFuncRestoreCtx(TextDB, Table1)
|
||||||
}
|
}
|
||||||
TextDB = DeleteFuncFind_byExtID(TextDB, Table1)
|
TextDB = DeleteFuncFind_byExtID(TextDB, Table1)
|
||||||
|
TextDB = DeleteFuncFind_byExtIDCtx(TextDB, Table1)
|
||||||
TextDB = AddTextOmit(TextDB, Table1)
|
TextDB = AddTextOmit(TextDB, Table1)
|
||||||
|
|
||||||
//запись файла
|
//запись файла
|
||||||
@ -124,12 +125,10 @@ func CreateTestFiles(Table1 *types.Table) error {
|
|||||||
TextDB = constants.TEXT_GENERATED + TextDB
|
TextDB = constants.TEXT_GENERATED + TextDB
|
||||||
|
|
||||||
if config.Settings.HAS_IS_DELETED == true {
|
if config.Settings.HAS_IS_DELETED == true {
|
||||||
TextDB = DeleteFuncDelete(TextDB, Table1)
|
TextDB = DeleteFuncTestDelete(TextDB, Table1)
|
||||||
TextDB = DeleteFuncDeleteCtx(TextDB, Table1)
|
TextDB = DeleteFuncTestRestore(TextDB, Table1)
|
||||||
TextDB = DeleteFuncRestore(TextDB, Table1)
|
|
||||||
TextDB = DeleteFuncRestoreCtx(TextDB, Table1)
|
|
||||||
}
|
}
|
||||||
TextDB = DeleteFuncFind_byExtID(TextDB, Table1)
|
TextDB = DeleteFuncTestFind_byExtID(TextDB, Table1)
|
||||||
|
|
||||||
//запись файла
|
//запись файла
|
||||||
err = os.WriteFile(FilenameReadyDB, []byte(TextDB), constants.FILE_PERMISSIONS)
|
err = os.WriteFile(FilenameReadyDB, []byte(TextDB), constants.FILE_PERMISSIONS)
|
||||||
@ -197,23 +196,34 @@ func DeleteFuncRestoreCtx(Text string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncFind_byExtID(Text string, Table1 *types.Table) string {
|
func DeleteFuncFind_byExtID(Text string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteFuncFind_byExtIDCtx - удаляет функцию Find_ByExtID_ctx()
|
||||||
|
func DeleteFuncFind_byExtIDCtx(Text string, Table1 *types.Table) string {
|
||||||
|
Otvet := Text
|
||||||
|
|
||||||
|
//если есть обе колонки - ничего не делаем
|
||||||
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
|
if ok == true {
|
||||||
|
return Otvet
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID_ctx ")
|
||||||
|
|
||||||
|
return Otvet
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteFuncTestDelete - удаляет функцию Delete()
|
// DeleteFuncTestDelete - удаляет функцию Delete()
|
||||||
func DeleteFuncTestDelete(Text string, Table1 *types.Table) string {
|
func DeleteFuncTestDelete(Text string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
@ -246,18 +256,13 @@ func DeleteFuncTestRestore(Text string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncTestFind_byExtID(Text string, Table1 *types.Table) string {
|
func DeleteFuncTestFind_byExtID(Text string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFind_ByExtID")
|
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFind_ByExtID")
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
|
@ -123,12 +123,10 @@ func CreateTestFiles(Table1 *types.Table) error {
|
|||||||
TextDB = constants.TEXT_GENERATED + TextDB
|
TextDB = constants.TEXT_GENERATED + TextDB
|
||||||
|
|
||||||
if config.Settings.HAS_IS_DELETED == true {
|
if config.Settings.HAS_IS_DELETED == true {
|
||||||
TextDB = DeleteFuncDelete(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestDelete(TextDB, ModelName, Table1)
|
||||||
//TextDB = DeleteFuncDeleteCtx(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestRestore(TextDB, ModelName, Table1)
|
||||||
TextDB = DeleteFuncRestore(TextDB, ModelName, Table1)
|
|
||||||
//TextDB = DeleteFuncRestoreCtx(TextDB, ModelName, Table1)
|
|
||||||
}
|
}
|
||||||
TextDB = DeleteFuncFind_byExtID(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestFind_byExtID(TextDB, ModelName, Table1)
|
||||||
|
|
||||||
//запись файла
|
//запись файла
|
||||||
err = os.WriteFile(FilenameReadyGRPCClient, []byte(TextDB), constants.FILE_PERMISSIONS)
|
err = os.WriteFile(FilenameReadyGRPCClient, []byte(TextDB), constants.FILE_PERMISSIONS)
|
||||||
@ -196,18 +194,13 @@ func DeleteFuncRestoreCtx(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
@ -245,19 +238,14 @@ func DeleteFuncTestRestore(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFindByExtID")
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFind_ByExtID")
|
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,10 @@ func CreateTestFiles(Table1 *types.Table) error {
|
|||||||
TextDB = constants.TEXT_GENERATED + TextDB
|
TextDB = constants.TEXT_GENERATED + TextDB
|
||||||
|
|
||||||
if config.Settings.HAS_IS_DELETED == true {
|
if config.Settings.HAS_IS_DELETED == true {
|
||||||
TextDB = DeleteFuncDelete(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestDelete(TextDB, ModelName, Table1)
|
||||||
TextDB = DeleteFuncDeleteCtx(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestRestore(TextDB, ModelName, Table1)
|
||||||
TextDB = DeleteFuncRestore(TextDB, ModelName, Table1)
|
|
||||||
TextDB = DeleteFuncRestoreCtx(TextDB, ModelName, Table1)
|
|
||||||
}
|
}
|
||||||
TextDB = DeleteFuncFind_byExtID(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestFind_byExtID(TextDB, ModelName, Table1)
|
||||||
|
|
||||||
//запись файла
|
//запись файла
|
||||||
err = os.WriteFile(FilenameReadyGRPCServer, []byte(TextDB), constants.FILE_PERMISSIONS)
|
err = os.WriteFile(FilenameReadyGRPCServer, []byte(TextDB), constants.FILE_PERMISSIONS)
|
||||||
@ -178,19 +176,14 @@ func DeleteFuncRestoreCtx(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
Otvet = create_files.DeleteFuncFromComment(Text, "\n// "+ModelName+"_FindByExtID ")
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromComment(Text, "\n// "+ModelName+"_Find_ByExtID ")
|
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
@ -227,19 +220,14 @@ func DeleteFuncTestRestore(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "Test_server_"+ModelName+"_FindByExtID")
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "Test_server_"+ModelName+"Find_ByExtID")
|
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
@ -309,14 +309,14 @@ func DeleteFuncFind_byExtID(TextModel, Modelname string, Table1 *types.Table) st
|
|||||||
Otvet := TextModel
|
Otvet := TextModel
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
_, ok1 := Table1.MapColumns["ext_id"]
|
||||||
if ok == true {
|
//if ok == false {
|
||||||
return Otvet
|
// return Otvet
|
||||||
}
|
//}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
_, ok2 := Table1.MapColumns["connection_id"]
|
||||||
if ok == true {
|
if ok1 == true && ok2 == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,12 +123,10 @@ func CreateTestFiles(Table1 *types.Table) error {
|
|||||||
TextDB = constants.TEXT_GENERATED + TextDB
|
TextDB = constants.TEXT_GENERATED + TextDB
|
||||||
|
|
||||||
if config.Settings.HAS_IS_DELETED == true {
|
if config.Settings.HAS_IS_DELETED == true {
|
||||||
TextDB = DeleteFuncDelete(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestDelete(TextDB, ModelName, Table1)
|
||||||
//TextDB = DeleteFuncDeleteCtx(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestRestore(TextDB, ModelName, Table1)
|
||||||
TextDB = DeleteFuncRestore(TextDB, ModelName, Table1)
|
|
||||||
//TextDB = DeleteFuncRestoreCtx(TextDB, ModelName, Table1)
|
|
||||||
}
|
}
|
||||||
TextDB = DeleteFuncFind_byExtID(TextDB, ModelName, Table1)
|
TextDB = DeleteFuncTestFind_byExtID(TextDB, ModelName, Table1)
|
||||||
|
|
||||||
//запись файла
|
//запись файла
|
||||||
err = os.WriteFile(FilenameReadyNRPCClient, []byte(TextDB), constants.FILE_PERMISSIONS)
|
err = os.WriteFile(FilenameReadyNRPCClient, []byte(TextDB), constants.FILE_PERMISSIONS)
|
||||||
@ -196,18 +194,13 @@ func DeleteFuncRestoreCtx(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
Otvet = create_files.DeleteFuncFromComment(Text, "\n// Find_ByExtID ")
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
@ -245,19 +238,15 @@ func DeleteFuncTestRestore(Text, ModelName string, Table1 *types.Table) string {
|
|||||||
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
func DeleteFuncTestFind_byExtID(Text, ModelName string, Table1 *types.Table) string {
|
||||||
Otvet := Text
|
Otvet := Text
|
||||||
|
|
||||||
//
|
//если есть обе колонки - ничего не делаем
|
||||||
_, ok := Table1.MapColumns["ext_id"]
|
ok := create_files.Has_Column_ExtID_ConnectionID(Table1)
|
||||||
if ok == true {
|
if ok == true {
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
_, ok = Table1.MapColumns["connection_id"]
|
|
||||||
if ok == true {
|
|
||||||
return Otvet
|
|
||||||
}
|
|
||||||
|
|
||||||
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFind_ByExtID")
|
Otvet = create_files.DeleteFuncFromFuncName(Otvet, "TestFindByExtID")
|
||||||
|
|
||||||
return Otvet
|
return Otvet
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user