encoder

package
v0.0.0-...-0f43857 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Code generated by internal/cmd/generator. DO NOT EDIT!

Index

Constants

View Source
const StartDetectingCyclesAfter = 1000

Variables

View Source
var (
	Marshal   func(interface{}) ([]byte, error)
	Unmarshal func([]byte, interface{}) error
)

Functions

func AppendBool

func AppendBool(_ *RuntimeContext, b []byte, v bool) []byte

func AppendByteSlice

func AppendByteSlice(_ *RuntimeContext, b []byte, src []byte) []byte

func AppendComma

func AppendComma(_ *RuntimeContext, b []byte) []byte

func AppendCommaIndent

func AppendCommaIndent(_ *RuntimeContext, b []byte) []byte

func AppendFloat32

func AppendFloat32(_ *RuntimeContext, b []byte, v float32) []byte

func AppendFloat64

func AppendFloat64(_ *RuntimeContext, b []byte, v float64) []byte

func AppendIndent

func AppendIndent(ctx *RuntimeContext, b []byte, indent uint32) []byte

func AppendInt

func AppendInt(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte

func AppendMarshalJSON

func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error)

func AppendMarshalJSONIndent

func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error)

func AppendMarshalText

func AppendMarshalText(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error)

func AppendMarshalTextIndent

func AppendMarshalTextIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error)

func AppendNull

func AppendNull(_ *RuntimeContext, b []byte) []byte

func AppendNumber

func AppendNumber(_ *RuntimeContext, b []byte, n json.Number) ([]byte, error)

func AppendString

func AppendString(ctx *RuntimeContext, buf []byte, s string) []byte

func AppendStructEnd

func AppendStructEnd(_ *RuntimeContext, b []byte) []byte

func AppendStructEndIndent

func AppendStructEndIndent(ctx *RuntimeContext, code *Opcode, b []byte) []byte

func AppendUint

func AppendUint(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte

func Compact

func Compact(buf *bytes.Buffer, src []byte, escape bool) error

func ErrMarshalerWithCode

func ErrMarshalerWithCode(code *Opcode, err error) *errors.MarshalerError

func ErrUnsupportedFloat

func ErrUnsupportedFloat(v float64) *errors.UnsupportedValueError

func ErrUnsupportedValue

func ErrUnsupportedValue(code *Opcode, ptr uintptr) *errors.UnsupportedValueError

func Indent

func Indent(buf *bytes.Buffer, src []byte, prefix, indentStr string) error

func IsNilForMarshaler

func IsNilForMarshaler(v interface{}) bool

func Load

func Load(base uintptr, idx uintptr) uintptr

func LoadNPtr

func LoadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr

func MapIterInit

func MapIterInit(mapType *runtime.Type, m unsafe.Pointer, it *mapIter)

func MapIterKey

func MapIterKey(it *mapIter) unsafe.Pointer

func MapIterNext

func MapIterNext(it *mapIter)

func MapIterValue

func MapIterValue(it *mapIter) unsafe.Pointer

func MapLen

func MapLen(m unsafe.Pointer) int

func PtrToBool

func PtrToBool(p uintptr) bool

func PtrToBytes

func PtrToBytes(p uintptr) []byte

func PtrToFloat32

func PtrToFloat32(p uintptr) float32

func PtrToFloat64

func PtrToFloat64(p uintptr) float64

func PtrToInterface

func PtrToInterface(code *Opcode, p uintptr) interface{}

func PtrToNPtr

func PtrToNPtr(p uintptr, ptrNum int) uintptr

func PtrToNumber

func PtrToNumber(p uintptr) json.Number

func PtrToPtr

func PtrToPtr(p uintptr) uintptr

func PtrToSlice

func PtrToSlice(p uintptr) *runtime.SliceHeader

func PtrToString

func PtrToString(p uintptr) string

func PtrToUint64

func PtrToUint64(p uintptr) uint64

func PtrToUnsafePtr

func PtrToUnsafePtr(p uintptr) unsafe.Pointer

func ReleaseMapContext

func ReleaseMapContext(c *MapContext)

func ReleaseRuntimeContext

func ReleaseRuntimeContext(ctx *RuntimeContext)

func SetFieldQueryToContext

func SetFieldQueryToContext(ctx context.Context, query *FieldQuery) context.Context

func Store

func Store(base uintptr, idx uintptr, p uintptr)

Types

type AnonymousCode

type AnonymousCode interface {
	ToAnonymousOpcode(*compileContext) Opcodes
}

type ArrayCode

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

func (*ArrayCode) Filter

func (c *ArrayCode) Filter(_ *FieldQuery) Code

func (*ArrayCode) Kind

func (c *ArrayCode) Kind() CodeKind

func (*ArrayCode) ToOpcode

func (c *ArrayCode) ToOpcode(ctx *compileContext) Opcodes

type BoolCode

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

func (*BoolCode) Filter

func (c *BoolCode) Filter(_ *FieldQuery) Code

func (*BoolCode) Kind

func (c *BoolCode) Kind() CodeKind

func (*BoolCode) ToOpcode

func (c *BoolCode) ToOpcode(ctx *compileContext) Opcodes

type BytesCode

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

func (*BytesCode) Filter

func (c *BytesCode) Filter(_ *FieldQuery) Code

func (*BytesCode) Kind

func (c *BytesCode) Kind() CodeKind

func (*BytesCode) ToOpcode

func (c *BytesCode) ToOpcode(ctx *compileContext) Opcodes

type Code

type Code interface {
	Kind() CodeKind
	ToOpcode(*compileContext) Opcodes
	Filter(*FieldQuery) Code
}

type CodeKind

type CodeKind int
const (
	CodeKindInterface CodeKind = iota
	CodeKindPtr
	CodeKindInt
	CodeKindUint
	CodeKindFloat
	CodeKindString
	CodeKindBool
	CodeKindStruct
	CodeKindMap
	CodeKindSlice
	CodeKindArray
	CodeKindBytes
	CodeKindMarshalJSON
	CodeKindMarshalText
	CodeKindRecursive
)

type CodeType

type CodeType int
const (
	CodeOp          CodeType = 0
	CodeArrayHead   CodeType = 1
	CodeArrayElem   CodeType = 2
	CodeSliceHead   CodeType = 3
	CodeSliceElem   CodeType = 4
	CodeMapHead     CodeType = 5
	CodeMapKey      CodeType = 6
	CodeMapValue    CodeType = 7
	CodeMapEnd      CodeType = 8
	CodeRecursive   CodeType = 9
	CodeStructField CodeType = 10
	CodeStructEnd   CodeType = 11
)

type ColorFormat

type ColorFormat = EncodeFormat

type ColorScheme

type ColorScheme = EncodeFormatScheme

type CompiledCode

type CompiledCode struct {
	Code    *Opcode
	Linked  bool // whether recursive code already have linked
	CurLen  uintptr
	NextLen uintptr
}

type Compiler

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

type EncodeFormat

type EncodeFormat struct {
	Header string
	Footer string
}

type EncodeFormatScheme

type EncodeFormatScheme struct {
	Int       EncodeFormat
	Uint      EncodeFormat
	Float     EncodeFormat
	Bool      EncodeFormat
	String    EncodeFormat
	Binary    EncodeFormat
	ObjectKey EncodeFormat
	Null      EncodeFormat
}

type FieldQuery

type FieldQuery struct {
	Name   string
	Fields []*FieldQuery
	// contains filtered or unexported fields
}

func FieldQueryFromContext

func FieldQueryFromContext(ctx context.Context) *FieldQuery

func (*FieldQuery) Hash

func (q *FieldQuery) Hash() string

func (*FieldQuery) MarshalJSON

func (q *FieldQuery) MarshalJSON() ([]