Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
31 lines
744 B
Go
31 lines
744 B
Go
package version
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
// Version defines the type for the config version number.
|
|
type Version uint
|
|
|
|
func (v Version) String() string {
|
|
return fmt.Sprintf("v%d", v)
|
|
}
|
|
|
|
// Converter defines the interface required to migrate configurations to newer versions.
|
|
type Converter interface {
|
|
// Clone clones the config by returning a new copy of the current one.
|
|
Clone() (Converter, error)
|
|
|
|
// SetDefaults assigns default values to empty config fields.
|
|
SetDefaults() error
|
|
|
|
// GetVersion returns the config version.
|
|
GetVersion() Version
|
|
|
|
// ConvertNext converts the config to the next version.
|
|
ConvertNext() (Converter, error)
|
|
|
|
// Decode decodes the config file from YAML and updates its values.
|
|
Decode(io.Reader) error
|
|
}
|