Documentation
¶
Index ¶
- Variables
- func Compare(stream1, stream2 Stream) (int, error)
- func CompareBytes(a, b []byte) (int, error)
- func Copy(stream Stream, sinks ...Sink) error
- func Fuzz(data []byte) int
- func MustCompare(stream1, stream2 Stream) int
- func MustCompareBytes(a, b []byte) int
- func Register(t reflect.Type)
- func TupleTypes(typeSpec any) []reflect.Type
- func TypeName(t reflect.Type) (name string)
- func WithPath(ctx Ctx) e5.WrapFunc
- type Ctx
- type ErrUnmarshalTypeMismatch
- type HasDeprecatedFields
- type Kind
- type MapTuple
- type Offset
- type Path
- type Proc
- func Decode(r io.Reader) *Proc
- func DecodeBuffer(r io.Reader, byteReader io.ByteReader, buf []byte, cont Proc) Proc
- func DecodeBufferForCompare(r io.Reader, byteReader io.ByteReader, buf []byte, cont Proc) Proc
- func DecodeForCompare(r io.Reader) *Proc
- func DecodeJson(r io.Reader, cont Proc) *Proc
- func Deref(stream Stream, getStream func([]byte) (Stream, error)) *Proc
- func FilterProc(stream Stream, predict func(*Token) bool) *Proc
- func IterStream(stream Stream, cont Proc) Proc
- func IterSubTrees(subs []*Tree, index int, cont Proc) Proc
- func IterSubTreesFunc(subs []*Tree, index int, fn func(*Tree) (*Token, error), cont Proc) Proc
- func IterTokens(tokens Tokens, index int, cont Proc) Proc
- func IterTree(tree *Tree, cont Proc) Proc
- func IterTreeFunc(tree *Tree, fn func(*Tree) (*Token, error), cont Proc) Proc
- func Marshal(value any) *Proc
- func MarshalArray(ctx Ctx, value reflect.Value, index int, cont Proc) Proc
- func MarshalAsTuple(ctx Ctx, tuple []any, cont Proc) Proc
- func MarshalCtx(ctx Ctx, value any) *Proc
- func MarshalMap(ctx Ctx, value reflect.Value, cont Proc) Proc
- func MarshalMapIter(ctx Ctx, iter *reflect.MapIter, tuples []*MapTuple, cont Proc) Proc
- func MarshalMapTuples(ctx Ctx, tuples []*MapTuple, cont Proc) Proc
- func MarshalStruct(ctx Ctx, value reflect.Value, cont Proc) Proc
- func MarshalStructFields(ctx Ctx, value reflect.Value, cont Proc) Proc
- func MarshalTuple(ctx Ctx, items []reflect.Value, cont Proc) Proc
- func MarshalValue(ctx Ctx, value reflect.Value, cont Proc) Proc
- func TapMarshal(ctx Ctx, value any, fn func(Ctx, reflect.Value)) *Proc
- func Tee(stream Stream, sinks ...Sink) *Proc
- func TeeProc(stream Stream, sinks []Sink, cont Proc) Proc
- type Ref
- type SBMarshaler
- type SBUnmarshaler
- type Sink
- func AltSink(sinks ...Sink) Sink
- func CollectTokens(tokens *Tokens) Sink
- func CollectValueTokens(tokens *Tokens) Sink
- func ConcatSinks(sinks ...Sink) Sink
- func Discard(token *Token) (Sink, error)
- func Encode(w io.Writer) Sink
- func EncodeBuffer(w io.Writer, buf []byte, cont Sink) Sink
- func EncodedLen(ret *int, cont Sink) Sink
- func ExpectKind(ctx Ctx, kind Kind, cont Sink) Sink
- func FilterSink(sink Sink, fn func(*Token) bool) Sink
- func Hash(newState func() hash.Hash, target *[]byte, cont Sink) Sink
- func HashCompound(newState func() hash.Hash, state hash.Hash, fn func([]byte, *Token) error, ...) Sink
- func HashFunc(newState func() hash.Hash, target *[]byte, fn func([]byte, *Token) error, ...) Sink
- func TapUnmarshal(ctx Ctx, target any, fn func(Ctx, Token, reflect.Value)) Sink
- func Unmarshal(target any) Sink
- func UnmarshalArray(ctx Ctx, target reflect.Value, cont Sink) Sink
- func UnmarshalGenericMap(ctx Ctx, target reflect.Value, cont Sink) Sink
- func UnmarshalGenericSlice(ctx Ctx, target reflect.Value, cont Sink) Sink
- func UnmarshalMap(ctx Ctx, target reflect.Value, valueType reflect.Type, cont Sink) Sink
- func UnmarshalNewStruct(ctx Ctx, target reflect.Value, cont Sink) Sink
- func UnmarshalSlice(ctx Ctx, target reflect.Value, valueType reflect.Type, cont Sink) Sink
- func UnmarshalStruct(ctx Ctx, target reflect.Value, valueType reflect.Type, cont Sink) Sink
- func UnmarshalTuple(ctx Ctx, target reflect.Value, valueType reflect.Type, cont Sink) Sink
- func UnmarshalTupleTyped(ctx Ctx, types []reflect.Type, target *Tuple, cont Sink) Sink
- func UnmarshalValue(ctx Ctx, target reflect.Value, cont Sink) Sink
- type Stream
- type TapTree
- type Token
- type Tokens
- type Tree
- type TreeOption
- type Tuple
- type TypedTuple
- type UnmarshalFunc
- type WithHash
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BadMapKey = fmt.Errorf("bad map key") BadTokenKind = fmt.Errorf("bad token kind") UnexpectedEndToken = fmt.Errorf("unexpected end token") )
View Source
var ( BadFieldName = fmt.Errorf("bad field name") BadTargetType = fmt.Errorf("bad target type") BadTupleType = fmt.Errorf("bad tuple type") DuplicatedFieldName = fmt.Errorf("duplicated field name") TooManyElement = fmt.Errorf("too many element") TooFewElement = fmt.Errorf("too few element") UnknownFieldName = fmt.Errorf("unknown field name") )
View Source
var ( StringTooLong = fmt.Errorf("string too long") BytesTooLong = fmt.Errorf("bytes too long") BadStringLength = fmt.Errorf("bad string length") )
View Source
var (
CyclicPointer = fmt.Errorf("cyclic pointer")
)
View Source
var DecodeError = fmt.Errorf("decode error")
View Source
var DefaultCtx = Ctx{ Marshal: MarshalValue, Unmarshal: UnmarshalValue, }
View Source
var MarshalError = fmt.Errorf("marshal error")
View Source
var Max = Token{ Kind: KindMax, }
View Source
var MaxDecodeStringLength uint64 = 4 * 1024 * 1024 * 1024
View Source
var Min = Token{ Kind: KindMin, }
View Source
var (
MoreThanOneValue = fmt.Errorf("more than one value in stream")
)
View Source
var NaN = Token{ Kind: KindNaN, }
View Source
var Nil = Token{ Kind: KindNil, }
View Source
var (
NotFound = fmt.Errorf("not found")
)
View Source
var UnmarshalError = fmt.Errorf("unmarshal error")
Functions ¶
func CompareBytes ¶
func MustCompare ¶
func MustCompareBytes ¶
func TupleTypes ¶
Types ¶
type Ctx ¶
type Ctx struct { Marshal func(Ctx, reflect.Value, Proc) Proc Unmarshal func(Ctx, reflect.Value, Sink) Sink // array index, slice index, struct field name, map key, tuple index Path Path SkipEmptyStructFields bool DisallowUnknownStructFields bool IgnoreFuncs bool // contains filtered or unexported fields }
type ErrUnmarshalTypeMismatch ¶
func TypeMismatch ¶
func TypeMismatch(kind Kind, target reflect.Kind) ErrUnmarshalTypeMismatch
func (ErrUnmarshalTypeMismatch) Error ¶
func (e ErrUnmarshalTypeMismatch) Error() string
type HasDeprecatedFields ¶
type HasDeprecatedFields interface {
SBDeprecatedFields() []string
}
type Kind ¶
type Kind uint8
const ( KindInvalid Kind = 0 KindMin Kind = 1 KindArrayEnd Kind = 10 KindObjectEnd Kind = 20 KindMapEnd Kind = 25 KindTupleEnd Kind = 27 KindNil Kind = 30 KindBool Kind = 40 KindStringEnd Kind = 49 KindString Kind = 50 KindStringBegin Kind = 51 KindBytesEnd Kind = 54 KindBytes Kind = 55 KindBytesBegin Kind = 56 KindInt Kind = 60 KindInt8 Kind = 70 KindInt16 Kind = 80 KindInt32 Kind = 90 KindInt64 Kind = 100 KindUint Kind = 110 KindUint8 Kind = 120 KindUint16 Kind = 130 KindUint32 Kind = 140 KindUint64 Kind = 150 KindFloat32 Kind = 160 KindFloat64 Kind = 170 KindNaN Kind = 175 KindArray Kind = 180 KindObject Kind = 190 KindMap Kind = 200 KindTuple Kind = 210 KindTypeName Kind = 230 KindLiteral Kind = 240 KindPointer Kind = 245 KindRef Kind = 251 KindMax Kind = 0xFF )
type Proc ¶
func DecodeBuffer ¶
func DecodeBufferForCompare ¶
func DecodeForCompare ¶
func IterStream ¶
func IterSubTreesFunc ¶
func IterTreeFunc ¶
func MarshalAsTuple ¶
func MarshalCtx ¶
func MarshalMapIter ¶
type SBMarshaler ¶
type SBUnmarshaler ¶
type Sink ¶
func CollectTokens ¶
func CollectValueTokens ¶
func ConcatSinks ¶
func EncodedLen ¶
func HashCompound ¶
func UnmarshalGenericMap ¶
func UnmarshalGenericSlice ¶
func UnmarshalMap ¶
func UnmarshalSlice ¶
func UnmarshalStruct ¶
func UnmarshalTuple ¶
func UnmarshalTupleTyped ¶
type TapTree ¶
type TapTree struct {
Func func(*Tree)
}
func (TapTree) IsTreeOption ¶
func (TapTree) IsTreeOption()
type Tree ¶
func MustTreeFromStream ¶
func MustTreeFromStream(stream Stream, options ...TreeOption) *Tree
func TreeFromStream ¶
func TreeFromStream( stream Stream, options ...TreeOption, ) (*Tree, error)
type TreeOption ¶
type TreeOption interface {
IsTreeOption()
}
type TypedTuple ¶
func (*TypedTuple) UnmarshalSB ¶
func (t *TypedTuple) UnmarshalSB(ctx Ctx, cont Sink) Sink
type UnmarshalFunc ¶
func (UnmarshalFunc) UnmarshalSB ¶
func (f UnmarshalFunc) UnmarshalSB(ctx Ctx, cont Sink) Sink
Source Files
¶
- alias.go
- alt_sink.go
- bytes.go
- compare.go
- concat.go
- copy.go
- ctx.go
- decode.go
- decode_json.go
- deprecated_fields.go
- deref.go
- discard.go
- encode.go
- encoded_len.go
- error.go
- filter.go
- find.go
- fuzz.go
- hash.go
- kind.go
- kind_string.go
- marshal.go
- offset.go
- pool.go
- proc.go
- ref.go
- sink.go
- stream_iter.go
- tee.go
- token.go
- tokens.go
- tokens_iter.go
- tree.go
- tree_hash.go
- tree_iter.go
- tuple.go
- type_name.go
- unmarshal.go
- utils.go
Click to show internal directories.
Click to hide internal directories.