Documentation
¶
Overview ¶
Package command hosts go-command adapters for go-export.
Index ¶
- type BatchCommand
- type BatchExecutor
- type BatchExecutorFunc
- type BatchLimits
- type BatchLoader
- type BatchOption
- type BatchRequest
- type BatchRequester
- type CancelExport
- type CancelExportHandler
- type CleanupExports
- type CleanupExportsHandler
- func (h *CleanupExportsHandler) CLIHandler() any
- func (h *CleanupExportsHandler) CLIOptions() gcmd.CLIConfig
- func (h *CleanupExportsHandler) CronHandler() func() error
- func (h *CleanupExportsHandler) CronOptions() gcmd.HandlerConfig
- func (h *CleanupExportsHandler) Execute(ctx context.Context, msg CleanupExports) error
- type DefinitionBatch
- type DeleteExport
- type DeleteExportHandler
- type GenerateExport
- type GenerateExportHandler
- type RequestExport
- type RequestExportHandler
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
func (f BatchExecutorFunc) ExecuteExport(ctx context.Context, actor export.Actor, req export.ExportRequest) (export.ExportRecord, error)
type BatchLimits ¶
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 ¶
CancelExport cancels an existing export.
func (CancelExport) Type ¶
func (CancelExport) Type() string
func (CancelExport) Validate ¶
func (msg CancelExport) Validate() error
type CancelExportHandler ¶
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 ¶
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 ¶
func (h *CleanupExportsHandler) Execute(ctx context.Context, msg CleanupExports) error
type DefinitionBatch ¶
type DefinitionBatch struct {
Actor export.Actor
Definitions []string
Request export.ExportRequest
}
DefinitionBatch builds PDF batch requests for a definition list.
type DeleteExport ¶
DeleteExport deletes an export and its artifacts.
func (DeleteExport) Type ¶
func (DeleteExport) Type() string
func (DeleteExport) Validate ¶
func (msg DeleteExport) Validate() error
type DeleteExportHandler ¶
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 ¶
GenerateExportHandler runs export generation jobs.
func NewGenerateExportHandler ¶
func NewGenerateExportHandler(svc export.Service) *GenerateExportHandler
func (*GenerateExportHandler) Execute ¶
func (h *GenerateExportHandler) Execute(ctx context.Context, msg GenerateExport) error
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 ¶
RequestExportHandler handles export requests.
func NewRequestExportHandler ¶
func NewRequestExportHandler(svc export.Service) *RequestExportHandler
func (*RequestExportHandler) Execute ¶
func (h *RequestExportHandler) Execute(ctx context.Context, msg RequestExport) error