decoder

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyInterfaceType = emptyInterfaceType
)

Functions

func AssignValue added in v0.10.0

func AssignValue(src, dst reflect.Value) error

func ReleaseRuntimeContext

func ReleaseRuntimeContext(ctx *RuntimeContext)

func UnsafeNew added in v0.10.0

func UnsafeNew(t *runtime.Type) unsafe.Pointer

Types

type BasePathNode added in v0.10.0

type BasePathNode struct {
	// contains filtered or unexported fields
}

type Decoder

type Decoder interface {
	Decode(*RuntimeContext, int64, int64, unsafe.Pointer) (int64, error)
	DecodePath(*RuntimeContext, int64, int64) ([][]byte, int64, error)
	DecodeStream(*Stream, int64, unsafe.Pointer) error
}

func CompileToGetDecoder

func CompileToGetDecoder(typ *runtime.Type) (Decoder, error)

func NewPathDecoder added in v0.10.0

func NewPathDecoder() Decoder

type Option

type Option struct {
	Flags   OptionFlags
	Context context.Context
	Path    *Path
}

type OptionFlags

type OptionFlags uint8
const (
	FirstWinOption OptionFlags = 1 << iota
	ContextOption
	PathOption
)

type Path added in v0.10.0

type Path struct {
	RootSelectorOnly        bool
	SingleQuotePathSelector bool
	DoubleQuotePathSelector bool
	// contains filtered or unexported fields
}

func (*Path) Field added in v0.10.0

func (p *Path) Field(sel string) (PathNode, bool, error)

func (*Path) Get added in v0.10.0

func (p *Path) Get(src, dst reflect.Value) error

func (*Path) String added in v0.10.0

func (p *Path) String() string

type PathBuilder added in v0.10.0

type PathBuilder struct {
	// contains filtered or unexported fields
}

func (*PathBuilder) Build added in v0.10.0

func (b *PathBuilder) Build(buf []rune) (*Path, error)

type PathIndexAllNode added in v0.10.0

type PathIndexAllNode struct {
	*BasePathNode
}

func (*PathIndexAllNode) Field added in v0.10.0

func (n *PathIndexAllNode) Field(fieldName string) (PathNode, bool, error)

func (*PathIndexAllNode) Get added in v0.10.0

func (n *PathIndexAllNode) Get(src, dst reflect.Value) error

func (*PathIndexAllNode) Index added in v0.10.0

func (n *PathIndexAllNode) Index(idx int) (PathNode, bool, error)

func (*PathIndexAllNode) String added in v0.10.0

func (n *PathIndexAllNode) String() string

type PathIndexNode added in v0.10.0

type PathIndexNode struct {
	*BasePathNode
	// contains filtered or unexported fields
}

func (*PathIndexNode) Field added in v0.10.0

func (n *PathIndexNode) Field(fieldName string) (PathNode, bool, error)

func (*PathIndexNode) Get added in v0.10.0

func (n *PathIndexNode) Get(src, dst reflect.Value) error

func (*PathIndexNode) Index added in v0.10.0

func (n *PathIndexNode) Index(idx int) (PathNode, bool, error)

func (*PathIndexNode) String added in v0.10.0

func (n *PathIndexNode) String() string

type PathNode added in v0.10.0

type PathNode interface {
	fmt.Stringer
	Index(idx int) (PathNode, bool, error)
	Field(fieldName string) (PathNode, bool, error)
	Get(src, dst reflect.Value) error
	// contains filtered or unexported methods
}

type PathRecursiveNode added in v0.10.0

type PathRecursiveNode struct {
	*BasePathNode
	// contains filtered or unexported fields
}

func (*PathRecursiveNode) Field added in v0.10.0

func (n *PathRecursiveNode) Field(fieldName string) (PathNode, bool, error)

func (*PathRecursiveNode) Get added in v0.10.0

func (n *PathRecursiveNode) Get(src, dst reflect.Value) error

func (*PathRecursiveNode) Index added in v0.10.0

func (n *PathRecursiveNode) Index(_ int) (PathNode, bool, error)

func (*PathRecursiveNode) String added in v0.10.0

func (n *PathRecursiveNode) String() string

type PathSelectorNode added in v0.10.0

type PathSelectorNode struct {
	*BasePathNode
	// contains filtered or unexported fields
}

func (*PathSelectorNode) Field added in v0.10.0

func (n *PathSelectorNode) Field(fieldName string) (PathNode, bool, error)

func (*PathSelectorNode) Get added in v0.10.0

func (n *PathSelectorNode) Get(src, dst reflect.Value) error

func (*PathSelectorNode) Index added in v0.10.0

func (n *PathSelectorNode) Index(idx int) (PathNode, bool, error)

func (*PathSelectorNode) String added in v0.10.0

func (n *PathSelectorNode) String() string

type PathString added in v0.10.0

type PathString string

func (PathString) Build added in v0.10.0

func (s PathString) Build() (*Path, error)

type QuotePathSelector added in v0.10.0

type QuotePathSelector int
const (
	SingleQuotePathSelector QuotePathSelector = 1
	DoubleQuotePathSelector QuotePathSelector = 2
)

type RuntimeContext

type RuntimeContext struct {
	Buf    []byte
	Option *Option
}

func TakeRuntimeContext

func TakeRuntimeContext() *RuntimeContext

type Stream

type Stream struct {
	UseNumber             bool
	DisallowUnknownFields bool
	Option                *Option
	// contains filtered or unexported fields
}

func NewStream

func NewStream(r io.Reader) *Stream

func (*Stream) Buffered

func (s *Stream) Buffered() io.Reader

func (*Stream) More

func (s *Stream) More() bool

func (*Stream) PrepareForDecode

func (s *Stream) PrepareForDecode() error

func (*Stream) Reset

func (s *Stream) Reset()

func (*Stream) Token

func (s *Stream) Token() (interface{}, error)

func (*Stream) TotalOffset

func (s *Stream) TotalOffset() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL