Documentation
¶
Overview ¶
Package transform defines some useful transformations on TOML documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Applier ¶
An Applier applies one or more transformations to a document. The Transform, Step, and Plan types implement this interface.
type Step ¶
type Step struct { Desc string // human-readable description (for logging) T Transform // the transformation itself ErrorOK bool // if true, ignore errors from evaluating T }
A Step is a single transformation in a plan.
type Transform ¶
A Transform performs an arbitrary transformation on a document and reports whether the transformation was successful.
func MoveKey ¶
MoveKey moves the mapping at oldKey from its current location to be a child of rootKey with the new name newKey. It reports whether the key was moved.
func Remove ¶
Remove removes the section or mapping at key, and reports whether the removal was successful.
func Rename ¶
Rename renames the section or mapping at oldKey to newKey, and reports whether the rename was successful. The mapping is not moved within the document, only its label is changed.
func SnakeToKebab ¶
func SnakeToKebab() Transform
SnakeToKebab transforms all the key names in doc from snake_case to kebab-case. This transformation cannot fail.