MSP-325 rename model to repository
This commit is contained in:
1 parent
ed83722c76
commit
71e78d01e7
9 files changed
+23
-22
No files matched your search
@@ -8,7 +8,7 @@ import (
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/log_code"
|
||||
"isp-gate-service/model"
|
||||
"isp-gate-service/repository"
|
||||
"isp-gate-service/service/matcher"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -110,7 +110,7 @@ func (w *accountingWorker) recoveryAccounting(appId int32, limitStates map[strin
|
||||
importNotComplete = true
|
||||
)
|
||||
|
||||
dbSnapshot, err := model.SnapshotRep.GetByApplication(appId)
|
||||
dbSnapshot, err := repository.SnapshotRep.GetByApplication(appId)
|
||||
if err != nil {
|
||||
log.Warn(log_code.ErrorSnapshotAccounting, err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/model"
|
||||
"isp-gate-service/repository"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -65,7 +65,7 @@ var (
|
||||
func TestAccounting(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
snapshotRep := newSnapshotRepository(false)
|
||||
model.SnapshotRep = snapshotRep
|
||||
repository.SnapshotRep = snapshotRep
|
||||
worker = &accountingWorker{
|
||||
accountingStorage: make(map[int32]Accounting),
|
||||
requestsStoring: make(map[int32]bool),
|
||||
@@ -115,7 +115,7 @@ func TestAccounting(t *testing.T) {
|
||||
func TestWorker_recoveryAccounting(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
snapshotRep := newSnapshotRepository(true)
|
||||
model.SnapshotRep = snapshotRep
|
||||
repository.SnapshotRep = snapshotRep
|
||||
|
||||
worker = &accountingWorker{
|
||||
accountingStorage: make(map[int32]Accounting),
|
||||
@@ -138,7 +138,7 @@ func TestWorker_recoveryAccounting(t *testing.T) {
|
||||
|
||||
time.Sleep(time.Millisecond * 300)
|
||||
a.True(snapshotRep.Wait())
|
||||
snapshot, err := model.SnapshotRep.GetByApplication(appId)
|
||||
snapshot, err := repository.SnapshotRep.GetByApplication(appId)
|
||||
a.NoError(err)
|
||||
a.NotNil(snapshot)
|
||||
a.Equal(len(request), int(snapshot.Version))
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/integration-system/isp-log/stdcodes"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/log_code"
|
||||
"isp-gate-service/model"
|
||||
"isp-gate-service/repository"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -66,7 +66,7 @@ func (t *snapshotTask) run(timeout time.Duration) {
|
||||
}
|
||||
|
||||
func (t *snapshotTask) unload(list []entity.Snapshot) {
|
||||
if err := model.SnapshotRep.Update(list); err != nil {
|
||||
if err := repository.SnapshotRep.Update(list); err != nil {
|
||||
log.Error(log_code.ErrorSnapshotAccounting, err)
|
||||
}
|
||||
t.wg.Done()
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/log_code"
|
||||
"isp-gate-service/model"
|
||||
"isp-gate-service/repository"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -100,7 +100,7 @@ func (t *storingTask) run(timeout time.Duration) {
|
||||
}
|
||||
|
||||
func (t *storingTask) unload(cache []entity.Request) {
|
||||
if err := model.RequestsRep.Insert(cache); err != nil {
|
||||
if err := repository.RequestsRep.Insert(cache); err != nil {
|
||||
log.Error(log_code.ErrorUnloadAccounting, err)
|
||||
}
|
||||
t.wg.Done()
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package accounting
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/model"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/entity"
|
||||
"isp-gate-service/repository"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -28,10 +29,10 @@ var (
|
||||
)
|
||||
|
||||
func initStoring(setting conf.StoringSetting) *requestsRepository {
|
||||
repository := &requestsRepository{cache: make([]entity.Request, 0), wg: &sync.WaitGroup{}}
|
||||
model.RequestsRep = repository
|
||||
rep := &requestsRepository{cache: make([]entity.Request, 0), wg: &sync.WaitGroup{}}
|
||||
repository.RequestsRep = rep
|
||||
InitStoringTask(setting)
|
||||
return repository
|
||||
return rep
|
||||
}
|
||||
|
||||
func wait(wg *sync.WaitGroup) bool {
|
||||
|
||||
@@ -15,9 +15,9 @@ import (
|
||||
"isp-gate-service/authenticate"
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/invoker"
|
||||
"isp-gate-service/model"
|
||||
"isp-gate-service/proxy"
|
||||
"isp-gate-service/redis"
|
||||
"isp-gate-service/repository"
|
||||
"isp-gate-service/routing"
|
||||
"isp-gate-service/server"
|
||||
"isp-gate-service/service"
|
||||
@@ -61,7 +61,7 @@ func onLocalConfigLoad(_ *conf.Configuration) {
|
||||
func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) {
|
||||
localCfg := config.Get().(*conf.Configuration)
|
||||
|
||||
model.DbClient.ReceiveConfiguration(remoteConfig.Database)
|
||||
repository.DbClient.ReceiveConfiguration(remoteConfig.Database)
|
||||
invoker.Journal.ReceiveConfiguration(remoteConfig.JournalSetting.Journal, localCfg.ModuleName)
|
||||
matcher.JournalMethods = matcher.NewAtLeastOneMatcher(remoteConfig.JournalSetting.MethodsPatterns)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model
|
||||
package repository
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/v2/database"
|
||||
@@ -1,4 +1,4 @@
|
||||
package model
|
||||
package repository
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg/v9/orm"
|
||||
@@ -1,4 +1,4 @@
|
||||
package model
|
||||
package repository
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg/v9"
|
||||
Reference in new issue
Block a user