Documentation
¶
Overview ¶
Package yamlstar provides a pure-Go YAML 1.2 loader and dumper.
YAMLStar is implemented in Clojure and compiled to Go by Gloat and Glojure. The generated runtime is included in this module; using this package does not require cgo or the libyamlstar shared library.
Index ¶
- Constants
- Variables
- func Dump(value any, opts ...Option) (string, error)
- func DumpAll(values []any, opts ...Option) (string, error)
- func LibVersion() (string, error)
- func Load(input string, opts ...Option) (any, error)
- func LoadAll(input string, opts ...Option) ([]any, error)
- type AliasDataConfig
- type IndentConfig
- type IndentMode
- type IndentScope
- type IndentStyle
- type Option
- type Plugin
- type YAMLError
Constants ¶
const Version = "0.1.24"
Version is the YAMLStar module version.
Variables ¶
var ErrNotInitialized = errors.New("yamlstar: runtime not initialized")
ErrNotInitialized is retained for compatibility with the former cgo binding. Initialization failures are returned directly.
var ErrNullResponse = errors.New("yamlstar: received null response")
ErrNullResponse is returned when the generated runtime returns no response.
Functions ¶
func LibVersion ¶
LibVersion returns the version reported by the generated YAMLStar runtime.
The name is retained for compatibility with the former shared-library binding.
Types ¶
type AliasDataConfig ¶ added in v0.1.23
AliasDataConfig configures external alias values and stream anchor scope. Env accepts true, a string pattern, or a sequence of exact names.
type IndentConfig ¶ added in v0.1.23
type IndentConfig struct {
Mode IndentMode
LoadStyle IndentStyle
DumpStyle IndentStyle
Scope IndentScope
}
IndentConfig configures the built-in tab-indent plugin.
type IndentMode ¶ added in v0.1.23
type IndentMode string
IndentMode supplies loading and dumping defaults.
const ( IndentModeAuto IndentMode = "auto" IndentModeTabs IndentMode = "tabs" )
type IndentScope ¶ added in v0.1.23
type IndentScope string
IndentScope controls how long an auto-detected style remains active.
const ( IndentScopeDocument IndentScope = "document" IndentScopeStream IndentScope = "stream" )
type IndentStyle ¶ added in v0.1.23
type IndentStyle string
IndentStyle identifies the characters used for structural indentation.
const ( IndentStyleAuto IndentStyle = "auto" IndentStyleSpaces IndentStyle = "spaces" IndentStyleTabs IndentStyle = "tabs" )
type Option ¶ added in v0.1.19
type Option func(*options)
Option configures a YAML load or dump operation.
func WithPlugin ¶ added in v0.1.19
WithPlugin adds a plugin option fragment.
type Plugin ¶ added in v0.1.19
type Plugin func(*options)
Plugin is a YAMLStar plugin option fragment.
func AliasData ¶ added in v0.1.23
func AliasData(config ...AliasDataConfig) Plugin
AliasData enables the built-in Alias-Data policy. With no configuration, it enables stream-scoped anchors.
func TabIndent ¶ added in v0.1.23
func TabIndent(config ...IndentConfig) Plugin
TabIndent enables tab-aware loading and tab-indented dumping.
func YAMLEmitter ¶ added in v0.1.23
YAMLEmitter selects the YAML emitter plugin used for dumping.
func YAMLParser ¶ added in v0.1.23
YAMLParser selects the YAML parser plugin used for loading.
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
go
command
|
|
|
go
module
|
|
|
internal
|
|
|
goyamlparser/pluginloader
Package pluginloader loads YAMLStar text-transform shared libraries.
|
Package pluginloader loads YAMLStar text-transform shared libraries. |