command

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package command hosts go-command adapters for go-export.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCommand

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

BatchCommand wires CLI/Cron execution for batch exports.

func NewBackfillCommand

func NewBackfillCommand(requester BatchRequester, loader BatchLoader, opts ...BatchOption) *BatchCommand

NewBackfillCommand creates a backfill CLI/Cron command.

func NewScheduledExportsCommand

func NewScheduledExportsCommand(requester BatchRequester, loader BatchLoader, opts ...BatchOption) *BatchCommand

NewScheduledExportsCommand creates a scheduled exports CLI/Cron command.

func (*BatchCommand) CLIHandler

func (c *BatchCommand) CLIHandler() any

CLIHandler exposes the CLI handler.

func (*BatchCommand) CLIOptions

func (c *BatchCommand) CLIOptions() gcmd.CLIConfig

CLIOptions returns CLI configuration.

func (*BatchCommand) CronHandler

func (c *BatchCommand) CronHandler() func() error

CronHandler executes scheduled batch exports.

func (*BatchCommand) CronOptions

func (c *BatchCommand) CronOptions() gcmd.HandlerConfig

CronOptions returns cron configuration.

type BatchExecutor added in v0.3.0

type BatchExecutor interface {
	ExecuteExport(ctx context.Context, actor export.Actor, req export.ExportRequest) (export.ExportRecord, error)
}

BatchExecutor runs batch exports synchronously.

type BatchExecutorFunc added in v0.3.0

type BatchExecutorFunc func(ctx context.Context, actor export.Actor, req export.ExportRequest) (export.ExportRecord, error)

BatchExecutorFunc adapts a function to a BatchExecutor.

func (BatchExecutorFunc) ExecuteExport added in v0.3.0

type BatchLimits

type BatchLimits struct {
	MaxRequests int
	MinInterval time.Duration
}

BatchLimits bounds batch execution throughput.

type BatchLoader

type BatchLoader func(ctx context.Context) ([]BatchRequest, error)

BatchLoader loads batch requests from a source.

type BatchOption

type BatchOption func(*BatchCommand)

BatchOption customizes batch commands.

func WithBatchCLIConfig

func WithBatchCLIConfig(cfg gcmd.CLIConfig) BatchOption

WithBatchCLIConfig overrides CLI configuration.

func WithBatchCronConfig

func WithBatchCronConfig(cfg gcmd.HandlerConfig) BatchOption

WithBatchCronConfig overrides cron configuration.

func WithBatchExecutor added in v0.3.0

func WithBatchExecutor(executor BatchExecutor) BatchOption

WithBatchExecutor sets the synchronous executor for batch exports.

func WithBatchLimits

func WithBatchLimits(limits BatchLimits) BatchOption

WithBatchLimits overrides batch execution limits.

type BatchRequest

type BatchRequest struct {
	Actor   export.Actor         `json:"actor"`
	Request export.ExportRequest `json:"request"`
}

BatchRequest describes a request for backfill/scheduled exports.

func BuildPDFBatchRequests

func BuildPDFBatchRequests(batch DefinitionBatch) []BatchRequest

BuildPDFBatchRequests returns async PDF export requests for each definition.

type BatchRequester

type BatchRequester interface {
	RequestExport(ctx context.Context, actor export.Actor, req export.ExportRequest) (export.ExportRecord, error)
}

BatchRequester schedules export requests.

type CancelExport

type CancelExport struct {
	Actor    export.Actor
	ExportID string
}

CancelExport cancels an existing export.

func (CancelExport) Type

func (CancelExport) Type() string

func (CancelExport) Validate

func (msg CancelExport) Validate() error

type CancelExportHandler

type CancelExportHandler struct {
	Service export.Service
}

CancelExportHandler cancels an export.

func NewCancelExportHandler

func NewCancelExportHandler(svc export.Service) *CancelExportHandler

func (*CancelExportHandler) Execute

func (h *CancelExportHandler) Execute(ctx context.Context, msg CancelExport) error

type CleanupExports

type CleanupExports struct {
	Now    time.Time
	Result *int
}

CleanupExports removes expired exports.

func (CleanupExports) Type

func (CleanupExports) Type() string

func (CleanupExports) Validate

func (CleanupExports) Validate() error

type CleanupExportsHandler

type CleanupExportsHandler struct {
	Service export.Service
	Config  gcmd.HandlerConfig
	Clock   func() time.Time
}

CleanupExportsHandler removes expired exports.

func NewCleanupExportsHandler

func NewCleanupExportsHandler(svc export.Service) *CleanupExportsHandler

func (*CleanupExportsHandler) CLIHandler

func (h *CleanupExportsHandler) CLIHandler() any

CLIHandler exposes cleanup via CLI.

func (*CleanupExportsHandler) CLIOptions

func (h *CleanupExportsHandler) CLIOptions() gcmd.CLIConfig

CLIOptions describes cleanup CLI metadata.

func (*CleanupExportsHandler) CronHandler

func (h *CleanupExportsHandler) CronHandler() func() error

func (*CleanupExportsHandler) CronOptions

func (h *CleanupExportsHandler) CronOptions() gcmd.HandlerConfig

func (*CleanupExportsHandler) Execute

type DefinitionBatch

type DefinitionBatch struct {
	Actor       export.Actor
	Definitions []string
	Request     export.ExportRequest
}

DefinitionBatch builds PDF batch requests for a definition list.

type DeleteExport

type DeleteExport struct {
	Actor    export.Actor
	ExportID string
}

DeleteExport deletes an export and its artifacts.

func (DeleteExport) Type

func (DeleteExport) Type() string

func (DeleteExport) Validate

func (msg DeleteExport) Validate() error

type DeleteExportHandler

type DeleteExportHandler struct {
	Service export.Service
}

DeleteExportHandler deletes an export.

func NewDeleteExportHandler

func NewDeleteExportHandler(svc export.Service) *DeleteExportHandler

func (*DeleteExportHandler) Execute

func (h *DeleteExportHandler) Execute(ctx context.Context, msg DeleteExport) error

type GenerateExport

type GenerateExport struct {
	Actor    export.Actor
	ExportID string
	Request  export.ExportRequest
	Result   *export.ExportResult
}

GenerateExport runs an export generation job.

func (GenerateExport) Type

func (GenerateExport) Type() string

func (GenerateExport) Validate

func (msg GenerateExport) Validate() error

type GenerateExportHandler

type GenerateExportHandler struct {
	Service export.Service
}

GenerateExportHandler runs export generation jobs.

func NewGenerateExportHandler

func NewGenerateExportHandler(svc export.Service) *GenerateExportHandler

func (*GenerateExportHandler) Execute

type RequestExport

type RequestExport struct {
	Actor   export.Actor
	Request export.ExportRequest
	Result  *export.ExportRecord
}

RequestExport requests a sync or async export.

func (RequestExport) Type

func (RequestExport) Type() string

func (RequestExport) Validate

func (msg RequestExport) Validate() error

type RequestExportHandler

type RequestExportHandler struct {
	Service export.Service
}

RequestExportHandler handles export requests.

func NewRequestExportHandler

func NewRequestExportHandler(svc export.Service) *RequestExportHandler

func (*RequestExportHandler) Execute

Jump to

Keyboard shortcuts

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