Documentation ¶
Index ¶
- func Camel(in string) string
- func CheckForElidedFields(struct_ interface{}) report.Report
- func Snake(in string) string
- func Translate(cfg Config, translateMethod string, options common.TranslateOptions) (interface{}, report.Report, error)
- func TranslateBytes(input []byte, container interface{}, translateMethod string, ...) ([]byte, report.Report, error)
- func TranslateBytesYAML(input []byte, container interface{}, translateMethod string, ...) ([]byte, report.Report, error)
- func TranslateReportPaths(r report.Report, ts translate.TranslationSet) report.Report
- type Config
- type FieldFilters
- type FilterMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForElidedFields ¶
Report an ErrFieldElided warning for any non-zero top-level fields in the specified output struct. The caller will probably want to use translate.PrefixReport() to reparent the report into the right place in the `json` hierarchy, and then TranslateReportPaths() to map back into `yaml` space.
func Translate ¶
func Translate(cfg Config, translateMethod string, options common.TranslateOptions) (interface{}, report.Report, error)
Translate translates cfg to the corresponding Ignition config version using the named translation method on cfg, and returns the marshaled Ignition config. It returns a report of any errors or warnings in the source and resultant config. If the report has fatal errors or it encounters other problems translating, an error is returned.
func TranslateBytes ¶
func TranslateBytes(input []byte, container interface{}, translateMethod string, options common.TranslateBytesOptions) ([]byte, report.Report, error)
TranslateBytes unmarshals the Butane config specified in input into the struct pointed to by container, translates it to the corresponding Ignition config version using the named translation method, and returns the marshaled Ignition config. It returns a report of any errors or warnings in the source and resultant config. If the report has fatal errors or it encounters other problems translating, an error is returned.
func TranslateBytesYAML ¶
func TranslateReportPaths ¶
TranslateReportPaths takes a report with a mix of json (camelCase) and yaml (snake_case) paths, and a set of translation rules. It applies those rules and converts all json paths to snake-cased yaml.
Types ¶
type Config ¶ added in v0.19.0
type Config interface {
FieldFilters() *FieldFilters
}
type FieldFilters ¶ added in v0.19.0
type FieldFilters struct {
// contains filtered or unexported fields
}
func NewFilters ¶ added in v0.19.0
func NewFilters(v any, filters FilterMap) FieldFilters
func NewFiltersIgnoreZero ¶ added in v0.19.0
func NewFiltersIgnoreZero(v any, filters FilterMap, ignoreZero []string) FieldFilters
func (FieldFilters) Lookup ¶ added in v0.19.0
func (ff FieldFilters) Lookup(filter string) error