storage

package
v0.0.0-...-d3a2b01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnDB

type ConnDB any

type ConnManager

type ConnManager interface {
	OpenConn(request *entities.AuthRequest, ctx context.Context) (ConnDB, string, error)
	CloseConn(conn ConnDB) error
}

type LayersManager

type LayersManager interface {
	GetLayers(conn ConnDB) (interfaces.LayersDTO, error)
	SaveLayer(conn ConnDB, layer string) error
}

type LayersRepository

type LayersRepository interface {
	LayerExist(conn ConnDB, layer string) (bool, error)
	GetAllLayers(conn ConnDB) ([]string, error)
	// GetLayerLanguages(conn ConnDB, layer string) ([]string, error)
	SaveLayer(conn ConnDB, name string) error
}

type MockStorage

type MockStorage struct {
	mock.Mock
}

MockStorage is an autogenerated mock type for the Storage type

func NewMockStorage

func NewMockStorage(t mockConstructorTestingTNewMockStorage) *MockStorage

NewMockStorage creates a new instance of MockStorage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockStorage) AddUser

func (_m *MockStorage) AddUser(conn ConnDB, user interfaces.UserDTO) error

AddUser provides a mock function with given fields: conn, user

func (*MockStorage) CloseConn

func (_m *MockStorage) CloseConn(_a0 ConnDB) error

CloseConn provides a mock function with given fields: _a0

func (*MockStorage) GetAllLayers

func (_m *MockStorage) GetAllLayers(conn ConnDB) ([]string, error)

GetAllLayers provides a mock function with given fields: conn

func (*MockStorage) GetAllModelElements

func (_m *MockStorage) GetAllModelElements(conn ConnDB, layer string) ([]entities.ModelElement, error)

GetAllModelElements provides a mock function with given fields: conn, layer

func (*MockStorage) GetAllModels

func (_m *MockStorage) GetAllModels(conn ConnDB, layer string) ([]entities.Model, error)

GetAllModels provides a mock function with given fields: conn, layer

func (*MockStorage) GetAllProperties

func (_m *MockStorage) GetAllProperties(conn ConnDB) ([]entities.Property, error)

GetAllProperties provides a mock function with given fields: conn

func (*MockStorage) GetAllUnits

func (_m *MockStorage) GetAllUnits(conn ConnDB, layer string) (interfaces.OutputUnitsDTO, error)

GetAllUnits provides a mock function with given fields: conn, layer

func (*MockStorage) GetPropertiesByUnit

func (_m *MockStorage) GetPropertiesByUnit(conn ConnDB, layer string, unit interfaces.SearchUnitDTO) ([]entities.Property, error)

GetPropertiesByUnit provides a mock function with given fields: conn, layer, unit

func (*MockStorage) GetUnitsByModels

func (_m *MockStorage) GetUnitsByModels(conn ConnDB, layer string, modelsID []int) (interfaces.OutputUnitsDTO, error)

GetUnitsByModels provides a mock function with given fields: conn, layer, modelsID

func (*MockStorage) GetUnitsByProperties

func (_m *MockStorage) GetUnitsByProperties(conn ConnDB, layer string, propertiesID []int) (interfaces.OutputUnitsDTO, error)

GetUnitsByProperties provides a mock function with given fields: conn, layer, propertiesID

func (*MockStorage) GetUserPassword

func (_m *MockStorage) GetUserPassword(conn ConnDB, username string) (string, error)

GetUserPassword provides a mock function with given fields: conn, username

func (*MockStorage) LayerExist

func (_m *MockStorage) LayerExist(conn ConnDB, layer string) (bool, error)

LayerExist provides a mock function with given fields: conn, layer

func (*MockStorage) OpenConn

func (_m *MockStorage) OpenConn(request *entities.AuthRequest, ctx context.Context) (ConnDB, string, error)

OpenConn provides a mock function with given fields: request, ctx

func (*MockStorage) RenameUnit

func (_m *MockStorage) RenameUnit(conn ConnDB, layer string, lang string, oldName string, newName string) error

RenameUnit provides a mock function with given fields: conn, layer, lang, oldName, newName

func (*MockStorage) SaveLayer

func (_m *MockStorage) SaveLayer(conn ConnDB, name string) error

SaveLayer provides a mock function with given fields: conn, name

func (*MockStorage) SaveModelElements

func (_m *MockStorage) SaveModelElements(conn ConnDB, layer string, modelElements []string) ([]int, error)

SaveModelElements provides a mock function with given fields: conn, layer, modelElements

func (*MockStorage) SaveModels

func (_m *MockStorage) SaveModels(conn ConnDB, layer string, models []string) ([]int, error)

SaveModels provides a mock function with given fields: conn, layer, models

func (*MockStorage) SaveProperties

func (_m *MockStorage) SaveProperties(conn ConnDB, properties []string) ([]int, error)

SaveProperties provides a mock function with given fields: conn, properties

func (*MockStorage) SaveUnits

func (_m *MockStorage) SaveUnits(conn ConnDB, layer string, data interfaces.SaveUnitsDTO) error

SaveUnits provides a mock function with given fields: conn, layer, data

func (*MockStorage) SetUnitProperties

func (_m *MockStorage) SetUnitProperties(conn ConnDB, layer string, lang string, unitName string, propertiesID []int) error

SetUnitProperties provides a mock function with given fields: conn, layer, lang, unitName, propertiesID

type MockStorageManager

type MockStorageManager struct {
	StorageManager
	mock.Mock
}

func (*MockStorageManager) CloseConn

func (m *MockStorageManager) CloseConn(conn ConnDB) error

func (*MockStorageManager) OpenConn

func (m *MockStorageManager) OpenConn(request *entities.AuthRequest, ctx context.Context) (ConnDB, string, error)

type ModelElementsManager

type ModelElementsManager interface {
	GetModelElements(conn ConnDB, layer string) (interfaces.OutputModelElementsDTO, error)
	SaveModelElements(conn ConnDB, layer string, modelElementsDTO interfaces.ModelElementNamesDTO) (interfaces.ModelElementsIdDTO, error)
}

type ModelElementsRepository

type ModelElementsRepository interface {
	GetAllModelElements(conn ConnDB, layer string) ([]entities.ModelElement, error)
	SaveModelElements(conn ConnDB, layer string, modelElements []string) ([]int, error)
}

type ModelsManager

type ModelsManager interface {
	GetModels(conn ConnDB, layer string) (interfaces.OutputModelsDTO, error)
	SaveModels(conn ConnDB, layer string, modelsDTO interfaces.ModelNamesDTO) (interfaces.ModelsIdDTO, error)
}

type ModelsRepository

type ModelsRepository interface {
	GetAllModels(conn ConnDB, layer string) ([]entities.Model, error)
	SaveModels(conn ConnDB, layer string, models []string) ([]int, error)
}

type PropertiesManager

type PropertiesManager interface {
	GetProperties(conn ConnDB) (interfaces.OutputPropertiesDTO, error)
	GetPropertiesByUnit(conn ConnDB, layer string, unit interfaces.SearchUnitDTO) (interfaces.OutputPropertiesDTO, error)
	SaveProperties(conn ConnDB, propertiesDTO interfaces.PropertyNamesDTO) (interfaces.PropertiesIdDTO, error)
}

type PropertiesRepository

type PropertiesRepository interface {
	GetAllProperties(conn ConnDB) ([]entities.Property, error)
	GetPropertiesByUnit(conn ConnDB, layer string, unit interfaces.SearchUnitDTO) ([]entities.Property, error)
	SaveProperties(conn ConnDB, properties []string) ([]int, error)
}

type Storage

type Storage interface {
	OpenConn(request *entities.AuthRequest, ctx context.Context) (ConnDB, string, error) // Get conn, role in database and error
	UsersRepository
	ModelsRepository
	ModelElementsRepository
	PropertiesRepository
	UnitsRepository
	LayersRepository
	CloseConn(ConnDB) error
}

type StorageService

type StorageService struct {
	// contains filtered or unexported fields
}

func NewStorageService

func NewStorageService(storage Storage, logger *log.Logger, repeatOnFailure int) *StorageService

func (*StorageService) AddUser

func (ss *StorageService) AddUser(conn ConnDB, user interfaces.UserDTO) error

func (*StorageService) CloseConn

func (ss *StorageService) CloseConn(conn ConnDB) error

func (*StorageService) GetAllUnits

func (ss *StorageService) GetAllUnits(conn ConnDB, layer string) (interfaces.OutputUnitsDTO, error)

func (*StorageService) GetLayers

func (ss *StorageService) GetLayers(conn ConnDB) (interfaces.LayersDTO, error)

func (*StorageService) GetModelElements

func (ss *StorageService) GetModelElements(conn ConnDB, layer string) (interfaces.OutputModelElementsDTO, error)

func (*StorageService) GetModels

func (ss *StorageService) GetModels(conn ConnDB, layer string) (interfaces.OutputModelsDTO, error)

func (*StorageService) GetProperties

func (ss *StorageService) GetProperties(conn ConnDB) (interfaces.OutputPropertiesDTO, error)

func (*StorageService) GetPropertiesByUnit

func (ss *StorageService) GetPropertiesByUnit(conn ConnDB, layer string, unit interfaces.SearchUnitDTO) (interfaces.OutputPropertiesDTO, error)

func (*StorageService) GetUnitsByModels

func (ss *StorageService) GetUnitsByModels(conn ConnDB, layer string, modelsDTO interfaces.ModelsIdDTO) (interfaces.OutputUnitsDTO, error)

func (*StorageService) GetUnitsByProperties

func (ss *StorageService) GetUnitsByProperties(conn ConnDB, layer string, propertiesDTO interfaces.PropertiesIdDTO) (interfaces.OutputUnitsDTO, error)

func (*StorageService) OpenConn

func (ss *StorageService) OpenConn(request *entities.AuthRequest, ctx context.Context) (ConnDB, string, error)

func (*StorageService) SaveLayer

func (ss *StorageService) SaveLayer(conn ConnDB, layer string) error

func (*StorageService) SaveModelElements

func (ss *StorageService) SaveModelElements(conn ConnDB, layer string, modelElementsDTO interfaces.ModelElementNamesDTO) (interfaces.ModelElementsIdDTO, error)

func (*StorageService) SaveModels

func (ss *StorageService) SaveModels(conn ConnDB, layer string, modelsDTO interfaces.ModelNamesDTO) (interfaces.ModelsIdDTO, error)

func (*StorageService) SaveProperties

func (ss *StorageService) SaveProperties(conn ConnDB, propertiesDTO interfaces.PropertyNamesDTO) (interfaces.PropertiesIdDTO, error)

func (*StorageService) SaveUnits

func (ss *StorageService) SaveUnits(conn ConnDB, layer string, unitsDTO interfaces.SaveUnitsDTO) error

func (*StorageService) UpdateUnits

func (ss *StorageService) UpdateUnits(conn ConnDB, layer string, unitsDTO interfaces.UpdateUnitsDTO) error

type UnitsManager

type UnitsManager interface {
	GetAllUnits(conn ConnDB, layer string) (interfaces.OutputUnitsDTO, error)
	GetUnitsByModels(conn ConnDB, layer string, modelsDTO interfaces.ModelsIdDTO) (interfaces.OutputUnitsDTO, error)
	GetUnitsByProperties(conn ConnDB, layer string, propertiesDTO interfaces.PropertiesIdDTO) (interfaces.OutputUnitsDTO, error)
	SaveUnits(conn ConnDB, layer string, unitsDTO interfaces.SaveUnitsDTO) error
	UpdateUnits(conn ConnDB, layer string, unitsDTO interfaces.UpdateUnitsDTO) error
}

type UnitsRepository

type UnitsRepository interface {
	GetAllUnits(conn ConnDB, layer string) (interfaces.OutputUnitsDTO, error)
	GetUnitsByModels(conn ConnDB, layer string, modelsID []int) (interfaces.OutputUnitsDTO, error)
	GetUnitsByProperties(conn ConnDB, layer string, propertiesID []int) (interfaces.OutputUnitsDTO, error)
	SaveUnits(conn ConnDB, layer string, data interfaces.SaveUnitsDTO) error // stored procedure (SQL)
	RenameUnit(conn ConnDB, layer, lang, oldName, newName string) error
	SetUnitProperties(conn ConnDB, layer, lang, unitName string, propertiesID []int) error
}

type UsersManager

type UsersManager interface {
	AddUser(conn ConnDB, user interfaces.UserDTO) error
}

type UsersRepository

type UsersRepository interface {
	AddUser(conn ConnDB, user interfaces.UserDTO) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL