service

package
v0.0.0-...-fce1e31 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HealthCheckError = errors.New("health check failed")
)

Functions

This section is empty.

Types

type CreateLayerRequest

type CreateLayerRequest struct {
	LayerName    string
	GeomType     string
	DefaultStyle types.ID
}

==========================================================

type CreateLayerResponse

type CreateLayerResponse struct {
	ID types.ID
}

type CreateStyleRequest

type CreateStyleRequest struct {
	FilePath string
}

==========================================================

type CreateStyleResponse

type CreateStyleResponse struct {
	ID types.ID
}

type DropLayerRequest

type DropLayerRequest struct {
	TableName string
}

==========================================================

type DropLayerResponse

type DropLayerResponse struct {
	Success bool
}

type FilerClient

type FilerClient interface {
	DownloadShapeFile(fileKey string) ([]byte, error)
}

type ImportLayerRequest

type ImportLayerRequest struct {
	FileKey string
}

==========================================================

type ImportLayerResponse

type ImportLayerResponse struct {
	Status      bool
	LayerName   string
	StyleFileID types.ID
}

type JobEntity

type JobEntity struct {
	ID        types.ID  `json:"id"`
	Token     string    `json:"token"`
	Status    JobStatus `json:"Status"`
	Error     *string   `json:"Error"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type JobStatus

type JobStatus string
const (
	JobStatusPending    JobStatus = "pending"
	JobStatusProcessing JobStatus = "processing"
	JobStatusComplete   JobStatus = "completed"
	JobStatusFailed     JobStatus = "failed"
)

type LayerEntity

type LayerEntity struct {
	ID           types.ID  `json:"id"`
	Name         string    `json:"name"`
	GeomType     string    `json:"geom_type"`
	DefaultStyle types.ID  `json:"default_style"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

TODO add new column system_cordiante

type LayerStylesEntity

type LayerStylesEntity struct {
	ID        types.ID  `json:"id"`
	LayerID   types.ID  `json:"layer_id"`
	StyleID   types.ID  `json:"style_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Repository

type Repository interface {
	HealthCheck(ctx context.Context) (string, error)
	AddJob(ctx context.Context, job JobEntity) (types.ID, error)
	GetJobByToken(ctx context.Context, token string) (JobEntity, error)
	UpdateJob(ctx context.Context, job JobEntity) (bool, error)
	CreateLayer(ctx context.Context, layer LayerEntity) (types.ID, error)
	DropTable(ctx context.Context, tableName string) (bool, error)
	GetLayerByName(ctx context.Context, name string) (LayerEntity, error)
	CreateStyle(ctx context.Context, style StyleEntity) (types.ID, error)
}

type ScheduleImportLayerRequest

type ScheduleImportLayerRequest struct{}

type ScheduleImportLayerResponse

type ScheduleImportLayerResponse struct {
	WorkflowId string
}

type Scheduler

type Scheduler interface {
	Add(ctx context.Context, event job.Event) (string, error)
}

type SendNotificationRequest

type SendNotificationRequest struct {
	WorkflowId string
	Status     string
}

type SendNotificationResponse

type SendNotificationResponse struct{}

type Service

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

func NewService

func NewService(repo Repository, validator Validator, scheduler Scheduler, queryClient FilerClient) Service

func (Service) CreateLayer

func (Service) CreateStyle

func (Service) DropLayerTable

func (s Service) DropLayerTable(ctx context.Context, req DropLayerRequest) (DropLayerResponse, error)

func (Service) HealthCheckSrv

func (s Service) HealthCheckSrv(ctx context.Context) (string, error)

func (Service) ImportLayer

func (Service) ScheduleImportLayer

func (s Service) ScheduleImportLayer(ctx context.Context, fileKey string) (ScheduleImportLayerResponse, error)

func (Service) SendNotification

func (s Service) SendNotification(ctx context.Context, req SendNotificationRequest) error

TODO: implement real notification

func (Service) UpdateJob

func (s Service) UpdateJob(ctx context.Context, req UpdateJobStatusRequest) error

type StyleEntity

type StyleEntity struct {
	ID        types.ID  `json:"id"`
	FilePath  string    `json:"file_path"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type UpdateJobStatusRequest

type UpdateJobStatusRequest struct {
	WorkflowId string
	Status     JobStatus
	ErrorMsg   *string
}

==========================================================

type UpdateJobStatusResponse

type UpdateJobStatusResponse struct{}

type Validator

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

func NewValidator

func NewValidator(repo ValidatorRepository) Validator

type ValidatorRepository

type ValidatorRepository interface {
}

type Workflow

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

func New

func New(service Service) Workflow

func (Workflow) ImportLayerWorkflow

func (w Workflow) ImportLayerWorkflow(ctx workflow.Context, event job.Event) error

Jump to

Keyboard shortcuts

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