Documentation
¶
Overview ¶
Package encode encodes IR nodes to Tony format text.
Usage ¶
// Encode to Tony format
node := ir.FromMap(map[string]*ir.Node{
"name": ir.FromString("alice"),
"age": ir.FromInt(30),
})
output, err := encode.Encode(node)
// Encode with options
output, err := encode.Encode(node, encode.WithIndent(2))
// Encode to JSON
output, err := encode.EncodeJSON(node)
Related Packages ¶
- github.com/signadot/tony-format/go-tony/ir - IR representation
- github.com/signadot/tony-format/go-tony/parse - Parse text to IR
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrEncoding = errors.New("encode error")
)
Functions ¶
func MustString ¶
Types ¶
type Colors ¶
type EncodeOption ¶
type EncodeOption func(*EncState)
func Depth ¶
func Depth(n int) EncodeOption
func EncodeBrackets ¶
func EncodeBrackets(v bool) EncodeOption
func EncodeColors ¶
func EncodeColors(c *Colors) EncodeOption
func EncodeComments ¶
func EncodeComments(v bool) EncodeOption
func EncodeFormat ¶
func EncodeFormat(f format.Format) EncodeOption
func EncodeWire ¶
func EncodeWire(v bool) EncodeOption
func InjectRaw ¶
func InjectRaw(v bool) EncodeOption
Click to show internal directories.
Click to hide internal directories.