Documentation
¶
Index ¶
- Variables
- func AddCustomMarshaler[T any](marshal func(v reflect.Value, node *document.Node) error)
- func AddCustomUnmarshaler[T any](unmarshal func(node *document.Node, v reflect.Value) error)
- func AddCustomValueMarshaler[T any](marshal func(v reflect.Value, value *document.Value, format string) error)
- func AddCustomValueUnmarshaler[T any](unmarshal func(value *document.Value, v reflect.Value, format string) error)
- func Generate(doc *document.Document, w io.Writer) error
- func GenerateWithOptions(doc *document.Document, w io.Writer, opts GenerateOptions) error
- func Marshal(v interface{}) ([]byte, error)
- func MarshalDocument(v interface{}, doc *document.Document) error
- func MarshalDocumentWithOptions(v interface{}, doc *document.Document, opts marshaler.MarshalOptions) error
- func MarshalNode(v interface{}) (*document.Node, error)
- func MarshalNodeWithOptions(v interface{}, opts marshaler.MarshalOptions) (*document.Node, error)
- func MarshalWithOptions(v interface{}, opts MarshalOptions) ([]byte, error)
- func Parse(r io.Reader) (*document.Document, error)
- func ParseWithOptions(r io.Reader, opts ParseOptions) (*document.Document, error)
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalDocument(doc *document.Document, v interface{}) error
- func UnmarshalDocumentWithOptions(doc *document.Document, v interface{}, opts UnmarshalOptions) error
- func UnmarshalNode(node *document.Node, v interface{}) error
- func UnmarshalNodeWithOptions(node *document.Node, v interface{}, opts UnmarshalOptions) error
- func UnmarshalWithOptions(data []byte, v interface{}, opts UnmarshalOptions) error
- type Decoder
- type Encoder
- type GenerateOptions
- type GeneratorOptions
- type MarshalOptions
- type Marshaler
- type MarshalerOptions
- type ParseOptions
- type UnmarshalOptions
- type Unmarshaler
- type ValueMarshaler
- type ValueUnmarshaler
Constants ¶
This section is empty.
Variables ¶
var DefaultGenerateOptions = generator.DefaultOptions
var DefaultParseOptions = parser.ParseContextOptions{}
Functions ¶
func AddCustomMarshaler ¶
func AddCustomUnmarshaler ¶
func AddCustomValueMarshaler ¶
func Generate ¶
Generate writes to w a well-formatted KDL document generated from doc, or a non-nil error on failure
func GenerateWithOptions ¶
GenerateWithOptions writes to w a well-formatted KDL document generated from doc, or a non-nil error on failure
func MarshalDocument ¶
func MarshalDocumentWithOptions ¶
func MarshalDocumentWithOptions(v interface{}, doc *document.Document, opts marshaler.MarshalOptions) error
func MarshalNode ¶
func MarshalNodeWithOptions ¶
func MarshalNodeWithOptions(v interface{}, opts marshaler.MarshalOptions) (*document.Node, error)
func MarshalWithOptions ¶
func MarshalWithOptions(v interface{}, opts MarshalOptions) ([]byte, error)
MarshalWithOptions returns the KDL representation of v using the specified Options, or a non-nil error on failure
func Parse ¶
Parse parses a KDL document from r and returns the parsed Document, or a non-nil error on failure
func ParseWithOptions ¶
func Unmarshal ¶
Unmarshal unmarshals KDL from data into v; v must contain a pointer type. Returns a non-nil error on failure.
func UnmarshalDocument ¶
func UnmarshalDocumentWithOptions ¶
func UnmarshalDocumentWithOptions(doc *document.Document, v interface{}, opts UnmarshalOptions) error
func UnmarshalNode ¶
func UnmarshalNodeWithOptions ¶
func UnmarshalNodeWithOptions(node *document.Node, v interface{}, opts UnmarshalOptions) error
func UnmarshalWithOptions ¶
func UnmarshalWithOptions(data []byte, v interface{}, opts UnmarshalOptions) error
UnmarshalWithOptions unmarshals KDL from data into v with the specified options; v must contain a pointer type. Returns a non-nil error on failure.
Types ¶
type Decoder ¶
type Decoder struct {
Options marshaler.UnmarshalOptions
// contains filtered or unexported fields
}
Decoder implements a decoder for KDL
func NewDecoder ¶
NewDecoder returns a Decoder that reads from r
type Encoder ¶
type Encoder struct {
Options MarshalOptions
// contains filtered or unexported fields
}
Encoder implements an encoder for KDL
func NewEncoder ¶
NewEncoder creates a new Encoder that writes to w
type GenerateOptions ¶
type GeneratorOptions ¶
type MarshalOptions ¶
type MarshalOptions struct {
MarshalerOptions
GeneratorOptions
}
type MarshalerOptions ¶
type MarshalerOptions = marshaler.MarshalOptions
type ParseOptions ¶
type ParseOptions = parser.ParseContextOptions
type UnmarshalOptions ¶
type UnmarshalOptions = marshaler.UnmarshalOptions
type Unmarshaler ¶
Unmarshaler provides an interface for custom unmarshaling of a node into a Go type
type ValueMarshaler ¶
ValueMarshaler provides an interface for custom marshaling of a Go type into a Value (such as a node argument or property)
type ValueUnmarshaler ¶
ValueUnmarshaler provides an interface for custom unmarshaling of a Value (such as a node argument or property) into a Go type