encoder

package
v0.0.0-...-20e6235 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const StartDetectingCyclesAfter = 1000

Variables

This section is empty.

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) unsafe.Pointer

func MapIterKey

func MapIterKey(it unsafe.Pointer) unsafe.Pointer

func MapIterNext

func MapIterNext(it unsafe.Pointer)

func MapIterValue

func MapIterValue(it unsafe.Pointer) 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 Store

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

Types

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 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 MapContext

type MapContext struct {
	Pos   []int
	Slice *Mapslice
	Buf   []byte
}

func NewMapContext

func NewMapContext(mapLen int) *MapContext

type MapItem

type MapItem struct {
	Key   []byte
	Value []byte
}

type Mapslice

type Mapslice struct {
	Items []MapItem
}

func (*Mapslice) Len

func (m *Mapslice) Len() int

func (*Mapslice) Less

func (m *Mapslice) Less(i, j int) bool

func (*Mapslice) Swap

func (m *Mapslice) Swap(i, j int)

type OpFlags

type OpFlags uint16
const (
	AnonymousHeadFlags     OpFlags = 1 << 0
	AnonymousKeyFlags      OpFlags = 1 << 1
	IndirectFlags          OpFlags = 1 << 2
	IsTaggedKeyFlags       OpFlags = 1 << 3
	NilCheckFlags          OpFlags = 1 << 4
	AddrForMarshalerFlags  OpFlags = 1 << 5
	IsNextOpPtrTypeFlags   OpFlags = 1 << 6
	IsNilableTypeFlags     OpFlags = 1 << 7
	MarshalerContextFlags  OpFlags = 1 << 8
	NonEmptyInterfaceFlags OpFlags = 1 << 9
)

type OpType

type OpType uint16
const (
	OpEnd                                    OpType = 0
	OpInterface                              OpType = 1
	OpPtr                                    OpType = 2
	OpSliceElem                              OpType = 3
	OpSliceEnd                               OpType = 4
	OpArrayElem                              OpType = 5
	OpArrayEnd                               OpType = 6
	OpMapKey                                 OpType = 7
	OpMapValue                               OpType = 8
	OpMapEnd                                 OpType = 9
	OpRecursive                              OpType = 10
	OpRecursivePtr                           OpType = 11
	OpRecursiveEnd                           OpType = 12
	OpInterfaceEnd                           OpType = 13
	OpStructAnonymousEnd                     OpType = 14
	OpInt                                    OpType = 15
	OpUint                                   OpType = 16
	OpFloat32                                OpType = 17
	OpFloat64                                OpType = 18
	OpBool                                   OpType = 19
	OpString                                 OpType = 20
	OpBytes                                  OpType = 21
	OpNumber                                 OpType = 22
	OpArray                                  OpType = 23
	OpMap                                    OpType = 24
	OpSlice                                  OpType = 25
	OpStruct                                 OpType = 26
	OpMarshalJSON                            OpType = 27
	OpMarshalText                            OpType = 28
	OpIntString                              OpType = 29
	OpUintString                             OpType = 30
	OpFloat32String                          OpType = 31
	OpFloat64String                          OpType = 32
	OpBoolString                             OpType = 33
	OpStringString                           OpType = 34
	OpNumberString                           OpType = 35
	OpIntPtr                                 OpType = 36
	OpUintPtr                                OpType = 37
	OpFloat32Ptr                             OpType = 38
	OpFloat64Ptr                             OpType = 39
	OpBoolPtr                                OpType = 40
	OpStringPtr                              OpType = 41
	OpBytesPtr                               OpType = 42
	OpNumberPtr                              OpType = 43
	OpArrayPtr                               OpType = 44
	OpMapPtr                                 OpType = 45
	OpSlicePtr                               OpType = 46
	OpMarshalJSONPtr                         OpType = 47
	OpMarshalTextPtr                         OpType = 48
	OpInterfacePtr                           OpType = 49
	OpIntPtrString                           OpType = 50
	OpUintPtrString                          OpType = 51
	OpFloat32PtrString                       OpType = 52
	OpFloat64PtrString                       OpType = 53
	OpBoolPtrString                          OpType = 54
	OpStringPtrString                        OpType = 55
	OpNumberPtrString                        OpType = 56
	OpStructHeadInt                          OpType = 57
	OpStructHeadOmitEmptyInt                 OpType = 58
	OpStructPtrHeadInt                       OpType = 59
	OpStructPtrHeadOmitEmptyInt              OpType = 60
	OpStructHeadUint                         OpType = 61
	OpStructHeadOmitEmptyUint                OpType = 62
	OpStructPtrHeadUint                      OpType = 63
	OpStructPtrHeadOmitEmptyUint             OpType = 64
	OpStructHeadFloat32                      OpType = 65
	OpStructHeadOmitEmptyFloat32             OpType = 66
	OpStructPtrHeadFloat32                   OpType = 67
	OpStructPtrHeadOmitEmptyFloat32          OpType = 68
	OpStructHeadFloat64                      OpType = 69
	OpStructHeadOmitEmptyFloat64             OpType = 70
	OpStructPtrHeadFloat64                   OpType = 71
	OpStructPtrHeadOmitEmptyFloat64          OpType = 72
	OpStructHeadBool                         OpType = 73
	OpStructHeadOmitEmptyBool                OpType = 74
	OpStructPtrHeadBool                      OpType = 75
	OpStructPtrHeadOmitEmptyBool             OpType = 76
	OpStructHeadString                       OpType = 77
	OpStructHeadOmitEmptyString              OpType = 78
	OpStructPtrHeadString                    OpType = 79
	OpStructPtrHeadOmitEmptyString           OpType = 80
	OpStructHeadBytes                        OpType = 81
	OpStructHeadOmitEmptyBytes               OpType = 82
	OpStructPtrHeadBytes                     OpType = 83
	OpStructPtrHeadOmitEmptyBytes            OpType = 84
	OpStructHeadNumber                       OpType = 85
	OpStructHeadOmitEmptyNumber              OpType = 86
	OpStructPtrHeadNumber                    OpType = 87
	OpStructPtrHeadOmitEmptyNumber           OpType = 88
	OpStructHeadArray                        OpType = 89
	OpStructHeadOmitEmptyArray               OpType = 90
	OpStructPtrHeadArray                     OpType = 91
	OpStructPtrHeadOmitEmptyArray            OpType = 92
	OpStructHeadMap                          OpType = 93
	OpStructHeadOmitEmptyMap                 OpType = 94
	OpStructPtrHeadMap                       OpType = 95
	OpStructPtrHeadOmitEmptyMap              OpType = 96
	OpStructHeadSlice                        OpType = 97
	OpStructHeadOmitEmptySlice               OpType = 98
	OpStructPtrHeadSlice                     OpType = 99
	OpStructPtrHeadOmitEmptySlice            OpType = 100
	OpStructHeadStruct                       OpType = 101
	OpStructHeadOmitEmptyStruct              OpType = 102
	OpStructPtrHeadStruct                    OpType = 103
	OpStructPtrHeadOmitEmptyStruct           OpType = 104
	OpStructHeadMarshalJSON                  OpType = 105
	OpStructHeadOmitEmptyMarshalJSON         OpType = 106
	OpStructPtrHeadMarshalJSON               OpType = 107
	OpStructPtrHeadOmitEmptyMarshalJSON      OpType = 108
	OpStructHeadMarshalText                  OpType = 109
	OpStructHeadOmitEmptyMarshalText         OpType = 110
	OpStructPtrHeadMarshalText               OpType = 111
	OpStructPtrHeadOmitEmptyMarshalText      OpType = 112
	OpStructHeadIntString                    OpType = 113
	OpStructHeadOmitEmptyIntString           OpType = 114
	OpStructPtrHeadIntString                 OpType = 115
	OpStructPtrHeadOmitEmptyIntString        OpType = 116
	OpStructHeadUintString                   OpType = 117
	OpStructHeadOmitEmptyUintString          OpType = 118
	OpStructPtrHeadUintString                OpType = 119
	OpStructPtrHeadOmitEmptyUintString       OpType = 120
	OpStructHeadFloat32String                OpType = 121
	OpStructHeadOmitEmptyFloat32String       OpType = 122
	OpStructPtrHeadFloat32String             OpType = 123
	OpStructPtrHeadOmitEmptyFloat32String    OpType = 124
	OpStructHeadFloat64String                OpType = 125
	OpStructHeadOmitEmptyFloat64String       OpType = 126
	OpStructPtrHeadFloat64String             OpType = 127
	OpStructPtrHeadOmitEmptyFloat64String    OpType = 128
	OpStructHeadBoolString                   OpType = 129
	OpStructHeadOmitEmptyBoolString          OpType = 130
	OpStructPtrHeadBoolString                OpType = 131
	OpStructPtrHeadOmitEmptyBoolString       OpType = 132
	OpStructHeadStringString                 OpType = 133
	OpStructHeadOmitEmptyStringString        OpType = 134
	OpStructPtrHeadStringString              OpType = 135
	OpStructPtrHeadOmitEmptyStringString     OpType = 136
	OpStructHeadNumberString                 OpType = 137
	OpStructHeadOmitEmptyNumberString        OpType = 138
	OpStructPtrHeadNumberString              OpType = 139
	OpStructPtrHeadOmitEmptyNumberString     OpType = 140
	OpStructHeadIntPtr                       OpType = 141
	OpStructHeadOmitEmptyIntPtr              OpType = 142
	OpStructPtrHeadIntPtr                    OpType = 143
	OpStructPtrHeadOmitEmptyIntPtr           OpType = 144
	OpStructHeadUintPtr                      OpType = 145
	OpStructHeadOmitEmptyUintPtr             OpType = 146
	OpStructPtrHeadUintPtr                   OpType = 147
	OpStructPtrHeadOmitEmptyUintPtr          OpType = 148
	OpStructHeadFloat32Ptr                   OpType = 149
	OpStructHeadOmitEmptyFloat32Ptr          OpType = 150
	OpStructPtrHeadFloat32Ptr                OpType = 151
	OpStructPtrHeadOmitEmptyFloat32Ptr       OpType = 152
	OpStructHeadFloat64Ptr                   OpType = 153
	OpStructHeadOmitEmptyFloat64Ptr          OpType = 154
	OpStructPtrHeadFloat64Ptr                OpType = 155
	OpStructPtrHeadOmitEmptyFloat64Ptr       OpType = 156
	OpStructHeadBoolPtr                      OpType = 157
	OpStructHeadOmitEmptyBoolPtr             OpType = 158
	OpStructPtrHeadBoolPtr                   OpType = 159
	OpStructPtrHeadOmitEmptyBoolPtr          OpType = 160
	OpStructHeadStringPtr                    OpType = 161
	OpStructHeadOmitEmptyStringPtr           OpType = 162
	OpStructPtrHeadStringPtr                 OpType = 163
	OpStructPtrHeadOmitEmptyStringPtr        OpType = 164
	OpStructHeadBytesPtr                     OpType = 165
	OpStructHeadOmitEmptyBytesPtr            OpType = 166
	OpStructPtrHeadBytesPtr                  OpType = 167
	OpStructPtrHeadOmitEmptyBytesPtr         OpType = 168
	OpStructHeadNumberPtr                    OpType = 169
	OpStructHeadOmitEmptyNumberPtr           OpType = 170
	OpStructPtrHeadNumberPtr                 OpType = 171
	OpStructPtrHeadOmitEmptyNumberPtr        OpType = 172
	OpStructHeadArrayPtr                     OpType = 173
	OpStructHeadOmitEmptyArrayPtr            OpType = 174
	OpStructPtrHeadArrayPtr                  OpType = 175
	OpStructPtrHeadOmitEmptyArrayPtr         OpType = 176
	OpStructHeadMapPtr                       OpType = 177
	OpStructHeadOmitEmptyMapPtr              OpType = 178
	OpStructPtrHeadMapPtr                    OpType = 179
	OpStructPtrHeadOmitEmptyMapPtr           OpType = 180
	OpStructHeadSlicePtr                     OpType = 181
	OpStructHeadOmitEmptySlicePtr            OpType = 182
	OpStructPtrHeadSlicePtr                  OpType = 183
	OpStructPtrHeadOmitEmptySlicePtr         OpType = 184
	OpStructHeadMarshalJSONPtr               OpType = 185
	OpStructHeadOmitEmptyMarshalJSONPtr      OpType = 186
	OpStructPtrHeadMarshalJSONPtr            OpType = 187
	OpStructPtrHeadOmitEmptyMarshalJSONPtr   OpType = 188
	OpStructHeadMarshalTextPtr               OpType = 189
	OpStructHeadOmitEmptyMarshalTextPtr      OpType = 190
	OpStructPtrHeadMarshalTextPtr            OpType = 191
	OpStructPtrHeadOmitEmptyMarshalTextPtr   OpType = 192
	OpStructHeadInterfacePtr                 OpType = 193
	OpStructHeadOmitEmptyInterfacePtr        OpType = 194
	OpStructPtrHeadInterfacePtr              OpType = 195
	OpStructPtrHeadOmitEmptyInterfacePtr     OpType = 196
	OpStructHeadIntPtrString                 OpType = 197
	OpStructHeadOmitEmptyIntPtrString        OpType = 198
	OpStructPtrHeadIntPtrString              OpType = 199
	OpStructPtrHeadOmitEmptyIntPtrString     OpType = 200
	OpStructHeadUintPtrString                OpType = 201
	OpStructHeadOmitEmptyUintPtrString       OpType = 202
	OpStructPtrHeadUintPtrString             OpType = 203
	OpStructPtrHeadOmitEmptyUintPtrString    OpType = 204
	OpStructHeadFloat32PtrString             OpType = 205
	OpStructHeadOmitEmptyFloat32PtrString    OpType = 206
	OpStructPtrHeadFloat32PtrString          OpType = 207
	OpStructPtrHeadOmitEmptyFloat32PtrString OpType = 208
	OpStructHeadFloat64PtrString             OpType = 209
	OpStructHeadOmitEmptyFloat64PtrString    OpType = 210
	OpStructPtrHeadFloat64PtrString          OpType = 211
	OpStructPtrHeadOmitEmptyFloat64PtrString OpType = 212
	OpStructHeadBoolPtrString                OpType = 213
	OpStructHeadOmitEmptyBoolPtrString       OpType = 214
	OpStructPtrHeadBoolPtrString             OpType = 215
	OpStructPtrHeadOmitEmptyBoolPtrString    OpType = 216
	OpStructHeadStringPtrString              OpType = 217
	OpStructHeadOmitEmptyStringPtrString     OpType = 218
	OpStructPtrHeadStringPtrString           OpType = 219
	OpStructPtrHeadOmitEmptyStringPtrString  OpType = 220
	OpStructHeadNumberPtrString              OpType = 221
	OpStructHeadOmitEmptyNumberPtrString     OpType = 222
	OpStructPtrHeadNumberPtrString           OpType = 223
	OpStructPtrHeadOmitEmptyNumberPtrString  OpType = 224
	OpStructHead                             OpType = 225
	OpStructHeadOmitEmpty                    OpType = 226
	OpStructPtrHead                          OpType = 227
	OpStructPtrHeadOmitEmpty                 OpType = 228
	OpStructFieldInt                         OpType = 229
	OpStructFieldOmitEmptyInt                OpType = 230
	OpStructEndInt                           OpType = 231
	OpStructEndOmitEmptyInt                  OpType = 232
	OpStructFieldUint                        OpType = 233
	OpStructFieldOmitEmptyUint               OpType = 234
	OpStructEndUint                          OpType = 235
	OpStructEndOmitEmptyUint                 OpType = 236
	OpStructFieldFloat32                     OpType = 237
	OpStructFieldOmitEmptyFloat32            OpType = 238
	OpStructEndFloat32                       OpType = 239
	OpStructEndOmitEmptyFloat32              OpType = 240
	OpStructFieldFloat64                     OpType = 241
	OpStructFieldOmitEmptyFloat64            OpType = 242
	OpStructEndFloat64                       OpType = 243
	OpStructEndOmitEmptyFloat64              OpType = 244
	OpStructFieldBool                        OpType = 245
	OpStructFieldOmitEmptyBool               OpType = 246
	OpStructEndBool                          OpType = 247
	OpStructEndOmitEmptyBool                 OpType = 248
	OpStructFieldString                      OpType = 249
	OpStructFieldOmitEmptyString             OpType = 250
	OpStructEndString                        OpType = 251
	OpStructEndOmitEmptyString               OpType = 252
	OpStructFieldBytes                       OpType = 253
	OpStructFieldOmitEmptyBytes              OpType = 254
	OpStructEndBytes                         OpType = 255
	OpStructEndOmitEmptyBytes                OpType = 256
	OpStructFieldNumber                      OpType = 257
	OpStructFieldOmitEmptyNumber             OpType = 258
	OpStructEndNumber                        OpType = 259
	OpStructEndOmitEmptyNumber               OpType = 260
	OpStructFieldArray                       OpType = 261
	OpStructFieldOmitEmptyArray              OpType = 262
	OpStructEndArray                         OpType = 263
	OpStructEndOmitEmptyArray                OpType = 264
	OpStructFieldMap                         OpType = 265
	OpStructFieldOmitEmptyMap                OpType = 266
	OpStructEndMap                           OpType = 267
	OpStructEndOmitEmptyMap                  OpType = 268
	OpStructFieldSlice                       OpType = 269
	OpStructFieldOmitEmptySlice              OpType = 270
	OpStructEndSlice                         OpType = 271
	OpStructEndOmitEmptySlice                OpType = 272
	OpStructFieldStruct                      OpType = 273
	OpStructFieldOmitEmptyStruct             OpType = 274
	OpStructEndStruct                        OpType = 275
	OpStructEndOmitEmptyStruct               OpType = 276
	OpStructFieldMarshalJSON                 OpType = 277
	OpStructFieldOmitEmptyMarshalJSON        OpType = 278
	OpStructEndMarshalJSON                   OpType = 279
	OpStructEndOmitEmptyMarshalJSON          OpType = 280
	OpStructFieldMarshalText                 OpType = 281
	OpStructFieldOmitEmptyMarshalText        OpType = 282
	OpStructEndMarshalText                   OpType = 283
	OpStructEndOmitEmptyMarshalText          OpType = 284
	OpStructFieldIntString                   OpType = 285
	OpStructFieldOmitEmptyIntString          OpType = 286
	OpStructEndIntString                     OpType = 287
	OpStructEndOmitEmptyIntString            OpType = 288
	OpStructFieldUintString                  OpType = 289
	OpStructFieldOmitEmptyUintString         OpType = 290
	OpStructEndUintString                    OpType = 291
	OpStructEndOmitEmptyUintString           OpType = 292
	OpStructFieldFloat32String               OpType = 293
	OpStructFieldOmitEmptyFloat32String      OpType = 294
	OpStructEndFloat32String                 OpType = 295
	OpStructEndOmitEmptyFloat32String        OpType = 296
	OpStructFieldFloat64String               OpType = 297
	OpStructFieldOmitEmptyFloat64String      OpType = 298
	OpStructEndFloat64String                 OpType = 299
	OpStructEndOmitEmptyFloat64String        OpType = 300
	OpStructFieldBoolString                  OpType = 301
	OpStructFieldOmitEmptyBoolString         OpType = 302
	OpStructEndBoolString                    OpType = 303
	OpStructEndOmitEmptyBoolString           OpType = 304
	OpStructFieldStringString                OpType = 305
	OpStructFieldOmitEmptyStringString       OpType = 306
	OpStructEndStringString                  OpType = 307
	OpStructEndOmitEmptyStringString         OpType = 308
	OpStructFieldNumberString                OpType = 309
	OpStructFieldOmitEmptyNumberString       OpType = 310
	OpStructEndNumberString                  OpType = 311
	OpStructEndOmitEmptyNumberString         OpType = 312
	OpStructFieldIntPtr                      OpType = 313
	OpStructFieldOmitEmptyIntPtr             OpType = 314
	OpStructEndIntPtr                        OpType = 315
	OpStructEndOmitEmptyIntPtr               OpType = 316
	OpStructFieldUintPtr                     OpType = 317
	OpStructFieldOmitEmptyUintPtr            OpType = 318
	OpStructEndUintPtr                       OpType = 319
	OpStructEndOmitEmptyUintPtr              OpType = 320
	OpStructFieldFloat32Ptr                  OpType = 321
	OpStructFieldOmitEmptyFloat32Ptr         OpType = 322
	OpStructEndFloat32Ptr                    OpType = 323
	OpStructEndOmitEmptyFloat32Ptr           OpType = 324
	OpStructFieldFloat64Ptr                  OpType = 325
	OpStructFieldOmitEmptyFloat64Ptr         OpType = 326
	OpStructEndFloat64Ptr                    OpType = 327
	OpStructEndOmitEmptyFloat64Ptr           OpType = 328
	OpStructFieldBoolPtr                     OpType = 329
	OpStructFieldOmitEmptyBoolPtr            OpType = 330
	OpStructEndBoolPtr                       OpType = 331
	OpStructEndOmitEmptyBoolPtr              OpType = 332
	OpStructFieldStringPtr                   OpType = 333
	OpStructFieldOmitEmptyStringPtr          OpType = 334
	OpStructEndStringPtr                     OpType = 335
	OpStructEndOmitEmptyStringPtr            OpType = 336
	OpStructFieldBytesPtr                    OpType = 337
	OpStructFieldOmitEmptyBytesPtr           OpType = 338
	OpStructEndBytesPtr                      OpType = 339
	OpStructEndOmitEmptyBytesPtr             OpType = 340
	OpStructFieldNumberPtr                   OpType = 341
	OpStructFieldOmitEmptyNumberPtr          OpType = 342
	OpStructEndNumberPtr                     OpType = 343
	OpStructEndOmitEmptyNumberPtr            OpType = 344
	OpStructFieldArrayPtr                    OpType = 345
	OpStructFieldOmitEmptyArrayPtr           OpType = 346
	OpStructEndArrayPtr                      OpType = 347
	OpStructEndOmitEmptyArrayPtr             OpType = 348
	OpStructFieldMapPtr                      OpType = 349
	OpStructFieldOmitEmptyMapPtr             OpType = 350
	OpStructEndMapPtr                        OpType = 351
	OpStructEndOmitEmptyMapPtr               OpType = 352
	OpStructFieldSlicePtr                    OpType = 353
	OpStructFieldOmitEmptySlicePtr           OpType = 354
	OpStructEndSlicePtr                      OpType = 355
	OpStructEndOmitEmptySlicePtr             OpType = 356
	OpStructFieldMarshalJSONPtr              OpType = 357
	OpStructFieldOmitEmptyMarshalJSONPtr     OpType = 358
	OpStructEndMarshalJSONPtr                OpType = 359
	OpStructEndOmitEmptyMarshalJSONPtr       OpType = 360
	OpStructFieldMarshalTextPtr              OpType = 361
	OpStructFieldOmitEmptyMarshalTextPtr     OpType = 362
	OpStructEndMarshalTextPtr                OpType = 363
	OpStructEndOmitEmptyMarshalTextPtr       OpType = 364
	OpStructFieldInterfacePtr                OpType = 365
	OpStructFieldOmitEmptyInterfacePtr       OpType = 366
	OpStructEndInterfacePtr                  OpType = 367
	OpStructEndOmitEmptyInterfacePtr         OpType = 368
	OpStructFieldIntPtrString                OpType = 369
	OpStructFieldOmitEmptyIntPtrString       OpType = 370
	OpStructEndIntPtrString                  OpType = 371
	OpStructEndOmitEmptyIntPtrString         OpType = 372
	OpStructFieldUintPtrString               OpType = 373
	OpStructFieldOmitEmptyUintPtrString      OpType = 374
	OpStructEndUintPtrString                 OpType = 375
	OpStructEndOmitEmptyUintPtrString        OpType = 376
	OpStructFieldFloat32PtrString            OpType = 377
	OpStructFieldOmitEmptyFloat32PtrString   OpType = 378
	OpStructEndFloat32PtrString              OpType = 379
	OpStructEndOmitEmptyFloat32PtrString     OpType = 380
	OpStructFieldFloat64PtrString            OpType = 381
	OpStructFieldOmitEmptyFloat64PtrString   OpType = 382
	OpStructEndFloat64PtrString              OpType = 383
	OpStructEndOmitEmptyFloat64PtrString     OpType = 384
	OpStructFieldBoolPtrString               OpType = 385
	OpStructFieldOmitEmptyBoolPtrString      OpType = 386
	OpStructEndBoolPtrString                 OpType = 387
	OpStructEndOmitEmptyBoolPtrString        OpType = 388
	OpStructFieldStringPtrString             OpType = 389
	OpStructFieldOmitEmptyStringPtrString    OpType = 390
	OpStructEndStringPtrString               OpType = 391
	OpStructEndOmitEmptyStringPtrString      OpType = 392
	OpStructFieldNumberPtrString             OpType = 393
	OpStructFieldOmitEmptyNumberPtrString    OpType = 394
	OpStructEndNumberPtrString               OpType = 395
	OpStructEndOmitEmptyNumberPtrString      OpType = 396
	OpStructField                            OpType = 397
	OpStructFieldOmitEmpty                   OpType = 398
	OpStructEnd                              OpType = 399
	OpStructEndOmitEmpty                     OpType = 400
)

func (OpType) CodeType

func (t OpType) CodeType() CodeType

func (OpType) FieldToEnd

func (t OpType) FieldToEnd() OpType

func (OpType) FieldToOmitEmptyField

func (t OpType) FieldToOmitEmptyField() OpType

func (OpType) HeadToOmitEmptyHead

func (t OpType) HeadToOmitEmptyHead() OpType

func (OpType) HeadToPtrHead

func (t OpType) HeadToPtrHead() OpType

func (OpType) IsMultipleOpField

func (t OpType) IsMultipleOpField() bool

func (OpType) IsMultipleOpHead

func (t OpType) IsMultipleOpHead() bool

func (OpType) PtrHeadToHead

func (t OpType) PtrHeadToHead() OpType

func (OpType) String

func (t OpType) String() string

type Opcode

type Opcode struct {
	Op         OpType  // operation type
	Idx        uint32  // offset to access ptr
	Next       *Opcode // next opcode
	End        *Opcode // array/slice/struct/map end
	NextField  *Opcode // next struct field
	Key        string  // struct field key
	Offset     uint32  // offset size from struct header
	PtrNum     uint8   // pointer number: e.g. double pointer is 2.
	NumBitSize uint8
	Flags      OpFlags

	Type       *runtime.Type // go type
	PrevField  *Opcode       // prev struct field
	Jmp        *CompiledCode // for recursive call
	ElemIdx    uint32        // offset to access array/slice/map elem
	Length     uint32        // offset to access slice/map length or array length
	MapIter    uint32        // offset to access map iterator
	MapPos     uint32        // offset to access position list for sorted map
	Indent     uint32        // indent number
	Size       uint32        // array/slice elem size
	DisplayIdx uint32        // opcode index
	DisplayKey string        // key text to display
}

func ToEndCode

func ToEndCode(code *Opcode) *Opcode

func (*Opcode) BeforeLastCode

func (c *Opcode) BeforeLastCode() *Opcode

func (*Opcode) Dump

func (c *Opcode) Dump() string

func (*Opcode) MaxIdx

func (c *Opcode) MaxIdx() uint32

func (*Opcode) ToFieldType

func (c *Opcode) ToFieldType(isString bool) OpType

func (*Opcode) ToHeaderType

func (c *Opcode) ToHeaderType(isString bool) OpType

func (*Opcode) TotalLength

func (c *Opcode) TotalLength() int

type OpcodeSet

type OpcodeSet struct {
	Type                     *runtime.Type
	NoescapeKeyCode          *Opcode
	EscapeKeyCode            *Opcode
	InterfaceNoescapeKeyCode *Opcode
	InterfaceEscapeKeyCode   *Opcode
	CodeLength               int
	EndCode                  *Opcode
}

func CompileToGetCodeSet

func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error)

type Option

type Option struct {
	Flag        OptionFlag
	ColorScheme *ColorScheme
	Context     context.Context
}

type OptionFlag

type OptionFlag uint8
const (
	HTMLEscapeOption OptionFlag = 1 << iota
	IndentOption
	UnorderedMapOption
	DebugOption
	ColorizeOption
	ContextOption
)

type RuntimeContext

type RuntimeContext struct {
	Context    context.Context
	Buf        []byte
	MarshalBuf []byte
	Ptrs       []uintptr
	KeepRefs   []unsafe.Pointer
	SeenPtr    []uintptr
	BaseIndent uint32
	Prefix     []byte
	IndentStr  []byte
	Option     *Option
}

func TakeRuntimeContext

func TakeRuntimeContext() *RuntimeContext

func (*RuntimeContext) Init

func (c *RuntimeContext) Init(p uintptr, codelen int)

func (*RuntimeContext) Ptr

func (c *RuntimeContext) Ptr() uintptr

Directories

Path Synopsis
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.
Code generated by internal/cmd/generator.

Jump to

Keyboard shortcuts

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