Documentation
¶
Overview ¶
Package usecase provides business logic.
Package usecase provides business logic.
Package usecase provides business logic.
Package usecase provides business logic.
Package usecase provides business logic.
Package usecase provides business logic.
Package usecase provides business logic.
Index ¶
- func SetWorkspaceUseCase(uc *WorkspaceUseCase)
- type GrpcClient
- type GrpcUseCase
- type SettingsRepo
- type SettingsUseCase
- type WorkspaceRepo
- type WorkspaceUseCase
- func (uc *WorkspaceUseCase) CreateFolder(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) CreateServer(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) Delete(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) DeleteFolder(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) Expand(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) Get(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) GetBreadcrumb(id int64) ([]string, error)
- func (uc *WorkspaceUseCase) GetState() (*entity.WorkspaceState, error)
- func (uc *WorkspaceUseCase) Sorting(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) UpdateFolder(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) UpdateQuery(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) UpdateServer(payload map[string]interface{}) *entity.GUIResponse
- func (uc *WorkspaceUseCase) UpdateServerRequest(payload map[string]interface{}) *entity.GUIResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetWorkspaceUseCase ¶
func SetWorkspaceUseCase(uc *WorkspaceUseCase)
SetWorkspaceUseCase sets WorkspaceUseCase instance
Types ¶
type GrpcClient ¶
type GrpcClient interface {
SetSettings(cfg *entity.Settings)
Connect(addr string, auth *entity.Auth, opts ...grpc.ClientOpt) error
AddProtobuf(path ...string)
AddImport(path ...string)
LoadFromProtobuf() ([]*entity.Service, []*entity.ProtobufError, *entity.ProtobufError)
LoadFromReflection() ([]*entity.Service, error)
GetResponseChannel() chan *entity.QueryResponse
GetSentCounter() uint
Query(method *entity.Method, data map[string]interface{}, metadata []string)
CancelQuery()
CloseStream()
Close()
}
GrpcClient is an interface for working with the gRPC client
type GrpcUseCase ¶
type GrpcUseCase struct {
// contains filtered or unexported fields
}
GrpcUseCase object capable of interacting with GrpcUseCase
func NewGrpcUseCase ¶
func NewGrpcUseCase(ctx context.Context, log *logger.Zerolog, client GrpcClient, workspaceRepo WorkspaceRepo) *GrpcUseCase
NewGrpcUseCase creates a new GrpcUseCase
func (*GrpcUseCase) CancelQuery ¶
func (uc *GrpcUseCase) CancelQuery()
CancelQuery aborting a running request
func (*GrpcUseCase) CloseStream ¶ added in v0.3.14
func (uc *GrpcUseCase) CloseStream()
CloseStream stops a running gRPC stream
func (*GrpcUseCase) LoadServer ¶
func (uc *GrpcUseCase) LoadServer(payload map[string]interface{}) *entity.GUIResponse
LoadServer reads the server description from the database and returns it to the GUI
func (*GrpcUseCase) Query ¶
func (uc *GrpcUseCase) Query(payload map[string]interface{}) *entity.GUIResponse
type SettingsRepo ¶ added in v0.3.14
type SettingsRepo interface {
Get() (*entity.Settings, error)
Update(in *entity.Settings) (*entity.Settings, error)
}
SettingsRepo is the common interface implemented SettingsRepository methods
type SettingsUseCase ¶ added in v0.3.14
type SettingsUseCase struct {
// contains filtered or unexported fields
}
SettingsUseCase object capable of interacting with SettingsUseCase
func NewSettingsUseCase ¶ added in v0.3.14
func NewSettingsUseCase(ctx context.Context, wg *sync.WaitGroup, log *logger.Zerolog, settingsRepo SettingsRepo, grpcClient GrpcClient) *SettingsUseCase
NewSettingsUseCase creates a new SettingsUseCase
func (*SettingsUseCase) Get ¶ added in v0.3.14
func (uc *SettingsUseCase) Get() (*entity.Settings, error)
Get reads and returns current Settings from database
func (*SettingsUseCase) Set ¶ added in v0.3.14
func (uc *SettingsUseCase) Set(cfg *entity.Settings)
Set delayed writes Settings to database
func (*SettingsUseCase) Stop ¶ added in v0.3.14
func (uc *SettingsUseCase) Stop()
Stop stops SettingsUseCase and writes current Settings to database
func (*SettingsUseCase) Update ¶ added in v0.3.14
func (uc *SettingsUseCase) Update(payload map[string]interface{}) *entity.GUIResponse
Update updates application settings
type WorkspaceRepo ¶
type WorkspaceRepo interface {
Get() ([]*entity.Workspace, error)
GetByID(id int64) (*entity.Workspace, error)
Create(in *entity.Workspace) (*entity.Workspace, error)
Update(in *entity.Workspace) (*entity.Workspace, error)
Delete(id int64) error
}
WorkspaceRepo is the common interface implemented WorkspaceRepository methods
type WorkspaceUseCase ¶
type WorkspaceUseCase struct {
// contains filtered or unexported fields
}
WorkspaceUseCase object capable of interacting with WorkspaceUseCase
func NewWorkspaceUseCase ¶
func NewWorkspaceUseCase(ctx context.Context, log *logger.Zerolog, workspaceRepo WorkspaceRepo, startupWorkspaceID *int64) *WorkspaceUseCase
NewWorkspaceUseCase creates a new WorkspaceUseCase
func (*WorkspaceUseCase) CreateFolder ¶
func (uc *WorkspaceUseCase) CreateFolder(payload map[string]interface{}) *entity.GUIResponse
CreateFolder creates folder on workspace
func (*WorkspaceUseCase) CreateServer ¶
func (uc *WorkspaceUseCase) CreateServer(payload map[string]interface{}) *entity.GUIResponse
CreateServer creates server on workspace
func (*WorkspaceUseCase) Delete ¶
func (uc *WorkspaceUseCase) Delete(payload map[string]interface{}) *entity.GUIResponse
Delete deletes workspace item
func (*WorkspaceUseCase) DeleteFolder ¶
func (uc *WorkspaceUseCase) DeleteFolder(payload map[string]interface{}) *entity.GUIResponse
DeleteFolder deletes folder on workspace
func (*WorkspaceUseCase) Expand ¶
func (uc *WorkspaceUseCase) Expand(payload map[string]interface{}) *entity.GUIResponse
Expand stores expand/collapse status on database
func (*WorkspaceUseCase) Get ¶
func (uc *WorkspaceUseCase) Get(payload map[string]interface{}) *entity.GUIResponse
Get returns workspace tree
func (*WorkspaceUseCase) GetBreadcrumb ¶
func (uc *WorkspaceUseCase) GetBreadcrumb(id int64) ([]string, error)
GetBreadcrumb returns the breadcrumbs
func (*WorkspaceUseCase) GetState ¶
func (uc *WorkspaceUseCase) GetState() (*entity.WorkspaceState, error)
GetState returns count of folders/servers/queries
func (*WorkspaceUseCase) Sorting ¶
func (uc *WorkspaceUseCase) Sorting(payload map[string]interface{}) *entity.GUIResponse
Sorting gets the sorted workspace tree and stores it in the database
func (*WorkspaceUseCase) UpdateFolder ¶
func (uc *WorkspaceUseCase) UpdateFolder(payload map[string]interface{}) *entity.GUIResponse
UpdateFolder updates folder on workspace
func (*WorkspaceUseCase) UpdateQuery ¶
func (uc *WorkspaceUseCase) UpdateQuery(payload map[string]interface{}) *entity.GUIResponse
UpdateQuery updates query on workspace
func (*WorkspaceUseCase) UpdateServer ¶
func (uc *WorkspaceUseCase) UpdateServer(payload map[string]interface{}) *entity.GUIResponse
UpdateServer updates server on workspace
func (*WorkspaceUseCase) UpdateServerRequest ¶
func (uc *WorkspaceUseCase) UpdateServerRequest(payload map[string]interface{}) *entity.GUIResponse
UpdateServerRequest updates current request params