Documentation ¶
Overview ¶
Package plan contains the interface about the build plan and the core plan operations.
Package plan is the interface for planners.
Index ¶
- Constants
- func Cast[T any](value optional.Option[any], caster func(any) (T, error)) optional.Option[T]
- func Continue() types.PlanMeta
- func ToWeakBoolE(i interface{}) (bool, error)
- type AWSConfig
- type Identifier
- type ImmutableProjectConfiguration
- type MutableProjectConfiguration
- type NewPlannerOptions
- type Planner
- type ProjectConfiguration
- type ViperProjectConfiguration
Constants ¶
const ( // ConfigInstallCommand is the key for the installation command in the project configuration. ConfigInstallCommand = "install_command" // ConfigBuildCommand is the key for the build command in the project configuration. ConfigBuildCommand = "build_command" // ConfigStartCommand is the key for the start command in the project configuration. ConfigStartCommand = "start_command" // ConfigOutputDir is the key for the output directory in the project configuration. ConfigOutputDir = "output_dir" )
Common configuration keys.
Variables ¶
This section is empty.
Functions ¶
func Cast ¶
Cast casts the value to the given type. If the value is not present or the type assertion fails, it returns None.
func Continue ¶
Continue is a pseudo PlanMeta, indicating the planner executor to find the next matched one.
func ToWeakBoolE ¶
ToWeakBoolE enhances ToBoolE to support more string values like "TRUE", "1", "FALSE", "0".
Types ¶
type Identifier ¶
type Identifier interface { PlanType() types.PlanType Match(afero.Fs) bool PlanMeta(NewPlannerOptions) types.PlanMeta }
Identifier identifies the plan type and how to get the plan meta.
type ImmutableProjectConfiguration ¶
type ImmutableProjectConfiguration interface { // Get returns the value of the given key. If the key is not present, it returns None. Get(key string) optional.Option[any] }
ImmutableProjectConfiguration declares the common interface for getting values in project configuration.
type MutableProjectConfiguration ¶
type MutableProjectConfiguration interface { // Set sets the value of the given key. The value set here has the highest priority. Set(key string, val any) }
MutableProjectConfiguration declares the common interface for setting values in project configuration.
type NewPlannerOptions ¶
type NewPlannerOptions struct { Source afero.Fs Config ImmutableProjectConfiguration SubmoduleName string AWSConfig *AWSConfig }
NewPlannerOptions is the options for NewPlanner.
type Planner ¶
Planner is the interface for planners.
func NewPlanner ¶
func NewPlanner(opt *NewPlannerOptions, identifiers ...Identifier) Planner
NewPlanner creates a new Planner.
type ProjectConfiguration ¶
type ProjectConfiguration interface { ImmutableProjectConfiguration MutableProjectConfiguration }
ProjectConfiguration declares the common interface for project configuration.
func NewProjectConfigurationFromFs ¶
func NewProjectConfigurationFromFs(fs afero.Fs, submoduleName string) ProjectConfiguration
NewProjectConfigurationFromFs creates a new ViperProjectConfiguration from fs.
If the configuration file is not found, it will print a warning and return a default configuration.
type ViperProjectConfiguration ¶
type ViperProjectConfiguration struct {
// contains filtered or unexported fields
}
ViperProjectConfiguration reads the extra configuration from the environment variable "ZBPACK_[CONFIG_KEY]" and "zbpack.toml" in the root directory of a project and turns it to a struct for easy access.
func (*ViperProjectConfiguration) Get ¶
func (vpc *ViperProjectConfiguration) Get(key string) optional.Option[any]
Get returns the value of the given key. If the key is not present, it returns None.
func (*ViperProjectConfiguration) Set ¶
func (vpc *ViperProjectConfiguration) Set(key string, val any)
Set sets the value of the given key. The value set here has the highest priority.