mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-12-22 00:36:41 +02:00
сделал mutex_GetVersionModel
This commit is contained in:
parent
bf06f0a9f6
commit
fa92e78f8c
@ -8,6 +8,7 @@ import (
|
|||||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_proto"
|
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_proto"
|
||||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
|
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
|
||||||
"log"
|
"log"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,9 +22,14 @@ const TableName string = "lawsuit_status_types"
|
|||||||
type Crud_GRPC struct {
|
type Crud_GRPC struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mutex_GetVersionModel - защита от многопоточности GetVersionModel()
|
||||||
|
var mutex_GetVersionModel = sync.Mutex{}
|
||||||
|
|
||||||
// GetVersionModel - возвращает хэш версии структуры модели
|
// GetVersionModel - возвращает хэш версии структуры модели
|
||||||
func (crud Crud_GRPC) GetVersionModel() uint32 {
|
func (crud Crud_GRPC) GetVersionModel() uint32 {
|
||||||
if VersionModel == 0 {
|
if VersionModel == 0 {
|
||||||
|
mutex_GetVersionModel.Lock()
|
||||||
|
defer mutex_GetVersionModel.Unlock()
|
||||||
VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
|
VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
|
||||||
}
|
}
|
||||||
return VersionModel
|
return VersionModel
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/nrpc/grpc_client/constants"
|
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/nrpc/grpc_client/constants"
|
||||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
|
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
|
||||||
"log"
|
"log"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VersionModel - хранит версию структуры модели
|
// VersionModel - хранит версию структуры модели
|
||||||
@ -19,9 +20,14 @@ const TableName string = "lawsuit_status_types"
|
|||||||
type Crud_NRPC struct {
|
type Crud_NRPC struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mutex_GetVersionModel - защита от многопоточности GetVersionModel()
|
||||||
|
var mutex_GetVersionModel = sync.Mutex{}
|
||||||
|
|
||||||
// GetVersionModel - возвращает хэш версии структуры модели
|
// GetVersionModel - возвращает хэш версии структуры модели
|
||||||
func (crud Crud_NRPC) GetVersionModel() uint32 {
|
func (crud Crud_NRPC) GetVersionModel() uint32 {
|
||||||
if VersionModel == 0 {
|
if VersionModel == 0 {
|
||||||
|
mutex_GetVersionModel.Lock()
|
||||||
|
defer mutex_GetVersionModel.Unlock()
|
||||||
VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
|
VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
|
||||||
}
|
}
|
||||||
return VersionModel
|
return VersionModel
|
||||||
|
Loading…
Reference in New Issue
Block a user