decoder

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyInterfaceType = emptyInterfaceType
)

Functions

func AssignValue

func AssignValue(src, dst reflect.Value) error

func ReleaseRuntimeContext

func ReleaseRuntimeContext(ctx *RuntimeContext)

func UnsafeNew

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

Types

type BasePathNode

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

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

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

func (*Path) Field

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

func (*Path) Get

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

func (*Path) String

func (p *Path) String() string

type PathBuilder

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

func (*PathBuilder) Build

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

type PathIndexAllNode

type PathIndexAllNode struct {
	*BasePathNode
}

func (*PathIndexAllNode) Field

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

func (*PathIndexAllNode) Get

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

func (*PathIndexAllNode) Index

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

func (*PathIndexAllNode) String

func (n *PathIndexAllNode) String() string

type PathIndexNode

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

func (*PathIndexNode) Field

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

func (*PathIndexNode) Get

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

func (*PathIndexNode) Index

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

func (*PathIndexNode) String

func (n *PathIndexNode) String() string

type PathNode

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

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

func (*PathRecursiveNode) Field

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

func (*PathRecursiveNode) Get

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

func (*PathRecursiveNode) Index

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

func (*PathRecursiveNode) String

func (n *PathRecursiveNode) String() string

type PathSelectorNode

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

func (*PathSelectorNode) Field

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

func (*PathSelectorNode) Get

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

func (*PathSelectorNode) Index

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

func (*PathSelectorNode) String

func (n *PathSelectorNode) String() string

type PathString

type PathString string

func (PathString) Build

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

type QuotePathSelector

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