usecase

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

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

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) error
	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, grpcClient GrpcClient, k8sClient K8SClient, 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) GetErrorChannel added in v0.5.0

func (uc *GrpcUseCase) GetErrorChannel() chan *entity.Error

GetErrorChannel returns error channel.

func (*GrpcUseCase) GetInfoChannel added in v0.5.0

func (uc *GrpcUseCase) GetInfoChannel() chan *entity.Info

GetInfoChannel returns info channel.

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 K8SClient added in v0.5.0

type K8SClient interface {
	PortForward(r *entity.K8SPortForward) (entity.PortForwardControl, error)
}

K8SClient is an interface for working with the K8S.

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) CheckUpdates added in v0.5.10

func (uc *SettingsUseCase) CheckUpdates(callback func(*entity.GithubRelease))

CheckUpdates checking the new version of the application.

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) Duplicate added in v0.5.2

func (uc *WorkspaceUseCase) Duplicate(payload map[string]interface{}) *entity.GUIResponse

Duplicate duplicates workspace item.

func (*WorkspaceUseCase) Expand

func (uc *WorkspaceUseCase) Expand(payload map[string]interface{}) *entity.GUIResponse

Expand stores expand/collapse status on database.

func (*WorkspaceUseCase) ExportFile added in v0.5.12

func (uc *WorkspaceUseCase) ExportFile(payload map[string]interface{}) *entity.GUIResponse

ExportFile exports the workspace to a file.

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) ImportFile added in v0.5.12

func (uc *WorkspaceUseCase) ImportFile(payload map[string]interface{}) *entity.GUIResponse

ImportFile imports the workspace from a file.

func (*WorkspaceUseCase) Publish added in v0.5.5

func (uc *WorkspaceUseCase) Publish(e entity.WorkspaceEvent, payload interface{})

Publish sending an event.

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) Subscribe added in v0.5.5

func (uc *WorkspaceUseCase) Subscribe(handler func(e entity.WorkspaceEvent, payload interface{}))

Subscribe event subscription.

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.

Jump to

Keyboard shortcuts

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