Documentation
¶
Overview ¶
Package interfaces defines contracts for core components involved in the build and execution workflow of the BX system.
These interfaces abstract behaviors such as module building, configuration, user prompting, and execution logging, enabling flexible and testable implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
Build(ctx context.Context) error
Prepare() error
Rollback() error
Collect(ctx context.Context) error
Cleanup()
}
Builder defines the core methods required for building and managing a module lifecycle.
Methods:
- Build: Executes the primary build logic.
- Prepare: Performs any setup required before building.
- Rollback: Reverts changes if the build fails or is canceled.
- Collect: Gathers or stages files/metadata necessary for the build.
- Cleanup: Releases resources or performs cleanup actions after the build.
type Logger ¶ added in v1.5.4
type Logger interface {
Info(message string, args ...interface{})
Error(message string, err error, args ...interface{})
}
Logger provides structured logging during the build process.
Methods:
- Info: Logs informational messages with optional formatting arguments.
- Error: Logs error messages with the associated error and optional context.
type ModuleConfig ¶
type ModuleConfig interface {
GetVariables() map[string]string
GetRun() map[string][]string
GetStages() []types.Stage
GetIgnore() []string
GetChanges() *types.Changes
IsLastVersion() bool
}
ModuleConfig provides access to parsed module configuration data.
Typically sourced from a YAML or similar configuration file.
Methods:
- GetVariables: Returns key-value pairs for variable substitution.
- GetRun: Returns the ordered map of run commands.
- GetStages: Returns the defined execution stages.
- GetIgnore: Returns file paths or patterns to ignore.
- GetChanges: Returns changelog-related metadata.
- IsLastVersion: Indicates whether the module represents the latest version.
type Prompter ¶ added in v1.4.2
type Prompter interface {
GetValue() string
Input(title string, validator func(string) error) error
}
Prompter abstracts user input collection and validation.
Methods:
- Input: Prompts the user with a title and validates input.
- GetValue: Returns the result of the most recent input.