Documentation ¶
Index ¶
- Constants
- func MarshalXML(v any) ([]byte, error)
- func MarshalXMLIndent(v any, indent string) ([]byte, error)
- func UnmarshalBinary(data []byte, v any) error
- func UnmarshalXML(data []byte, v any) error
- type ArrayEnd
- type ArrayStart
- type BinaryMarshaler
- type BinaryScanner
- type BinaryUnmarshaler
- type InvalidLLSDError
- type Key
- type MapEnd
- type MapStart
- type MarshalTypeError
- type Scalar
- type ScalarType
- type TextMarshaler
- type TextUnmarshaler
- type Token
- type TokenReader
- type URL
- type UUID
- type UnmarshalTypeError
- type Unmarshaler
- type XMLEncoder
- type XMLScanner
Constants ¶
const ( Base16 = "base16" Base64 = "base64" Base85 = "base85" )
const BinaryHeader = "<?llsd/binary?>\n"
Variables ¶
This section is empty.
Functions ¶
func MarshalXML ¶
func UnmarshalBinary ¶
UnmarshalBinary attempts to deserialize given LLSD binary data into a given value.
func UnmarshalXML ¶
UnmarshalXML attempts to deserialize given LLSD XML data into a given value.
Types ¶
type ArrayStart ¶
type ArrayStart struct{}
type BinaryMarshaler ¶
type BinaryMarshaler interface {
MarshalBinaryLLSD() (ScalarType, []byte, error)
}
TextMarshaler is the interface implemented by types that want to customize how text (xml, notation) LLSD values are marshaled into text.
type BinaryScanner ¶
type BinaryScanner struct {
// contains filtered or unexported fields
}
func NewBinaryScanner ¶
func NewBinaryScanner(r io.Reader) *BinaryScanner
func (*BinaryScanner) Offset ¶
func (s *BinaryScanner) Offset() int64
func (*BinaryScanner) Token ¶
func (s *BinaryScanner) Token() (Token, error)
type BinaryUnmarshaler ¶
BinaryUnmarshaler is the interface implemented by types that want to customize how binary LLSD values are unmarshaled into themselves.
type InvalidLLSDError ¶
InvalidLLSDError represents a problem with input LLSD.
func (*InvalidLLSDError) Error ¶
func (e *InvalidLLSDError) Error() string
type MarshalTypeError ¶
MarshalTypeError represents an error in the marshaling process.
func (*MarshalTypeError) Error ¶
func (e *MarshalTypeError) Error() string
type ScalarType ¶
type ScalarType int
const ( Undefined ScalarType = iota Boolean Integer Real UUIDType String Binary Date URI )
func (ScalarType) String ¶
func (t ScalarType) String() string
type TextMarshaler ¶
type TextMarshaler interface {
MarshalTextLLSD() (ScalarType, string, error)
}
TextMarshaler is the interface implemented by types that want to customize how text (xml, notation) LLSD values are marshaled into text.
type TextUnmarshaler ¶
TextUnmarshaler is the interface implemented by types that want to customize how text (xml, notation) LLSD values are unmarshaled into themselves.
type TokenReader ¶
type UnmarshalTypeError ¶
type UnmarshalTypeError struct { Value string // Description of LLSD value - "real", "map", "string" Type reflect.Type // Type of Go value that could not be assigned to Offset int64 // Input stream byte offset where error occurred }
UnmarshalTypeError represents an error in the unmarshaling process.
func (*UnmarshalTypeError) Error ¶
func (e *UnmarshalTypeError) Error() string
type Unmarshaler ¶
type Unmarshaler struct { DisallowUnknownFields bool // contains filtered or unexported fields }
Decoder is a generic LLSD unmarshaler that can work with any TokenReader.
func NewBinaryDecoder ¶
func NewBinaryDecoder(r io.Reader) *Unmarshaler
NewBinaryDecoder creates a new instance of an Unmarshaler configured to read binary LLSD.
func NewXMLDecoder ¶
func NewXMLDecoder(r io.Reader) *Unmarshaler
NewXMLDecoder creates a new instance of an Unmarshaler configured to read LLSD XML.
func (*Unmarshaler) Unmarshal ¶
func (u *Unmarshaler) Unmarshal(v any) error
Unmarshal decodes LLSD into a given value.
type XMLEncoder ¶
type XMLEncoder struct {
// contains filtered or unexported fields
}
func NewXMLEncoder ¶
func NewXMLEncoder(w io.Writer) *XMLEncoder
func (*XMLEncoder) Encode ¶
func (e *XMLEncoder) Encode(v any) error
func (*XMLEncoder) Flush ¶
func (e *XMLEncoder) Flush()
Flush flushes any buffered XML to the underlying writer
func (*XMLEncoder) SetIndent ¶
func (e *XMLEncoder) SetIndent(indent string)
type XMLScanner ¶
type XMLScanner struct {
// contains filtered or unexported fields
}
func NewXMLScanner ¶
func NewXMLScanner(r io.Reader) *XMLScanner
func (*XMLScanner) Offset ¶
func (s *XMLScanner) Offset() int64
InputOffset returns the input stream byte offset of the current decoder position.
func (*XMLScanner) Skip ¶
func (s *XMLScanner) Skip() error
Skip element, useful for jumping over large maps and arrays.
func (*XMLScanner) Token ¶
func (s *XMLScanner) Token() (Token, error)