encoder

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 16 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(b []byte, v bool) []byte

func AppendByteSlice

func AppendByteSlice(b []byte, src []byte) []byte

func AppendComma

func AppendComma(b []byte) []byte

func AppendCommaIndent

func AppendCommaIndent(b []byte) []byte

func AppendEscapedString

func AppendEscapedString(buf []byte, s string) []byte

func AppendFloat32

func AppendFloat32(b []byte, v float32) []byte

func AppendFloat64

func AppendFloat64(b []byte, v float64) []byte

func AppendIndent

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

func AppendInt

func AppendInt(out []byte, u64 uint64, code *Opcode) []byte

func AppendMarshalJSON

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

func AppendMarshalJSONIndent

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

func AppendMarshalText

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

func AppendMarshalTextIndent

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

func AppendNull

func AppendNull(b []byte) []byte

func AppendNumber

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

func AppendString

func AppendString(buf []byte, s string) []byte

func AppendStructEnd

func AppendStructEnd(b []byte) []byte

func AppendStructEndIndent

func AppendStructEndIndent(ctx *RuntimeContext, b []byte, indent int) []byte

func AppendUint

func AppendUint(out []byte, u64 uint64, code *Opcode) []byte

func Compact

func Compact(dst *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(dst *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 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 CompiledCode

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

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 OpType

type OpType int
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
	OpStructAnonymousEnd                   OpType = 13
	OpInt                                  OpType = 14
	OpUint                                 OpType = 15
	OpFloat32                              OpType = 16
	OpFloat64                              OpType = 17
	OpBool                                 OpType = 18
	OpString                               OpType = 19
	OpBytes                                OpType = 20
	OpNumber                               OpType = 21
	OpArray                                OpType = 22
	OpMap                                  OpType = 23
	OpSlice                                OpType = 24
	OpStruct                               OpType = 25
	OpMarshalJSON                          OpType = 26
	OpMarshalText                          OpType = 27
	OpIntString                            OpType = 28
	OpUintString                           OpType = 29
	OpIntPtr                               OpType = 30
	OpUintPtr                              OpType = 31
	OpFloat32Ptr                           OpType = 32
	OpFloat64Ptr                           OpType = 33
	OpBoolPtr                              OpType = 34
	OpStringPtr                            OpType = 35
	OpBytesPtr                             OpType = 36
	OpNumberPtr                            OpType = 37
	OpArrayPtr                             OpType = 38
	OpMapPtr                               OpType = 39
	OpSlicePtr                             OpType = 40
	OpMarshalJSONPtr                       OpType = 41
	OpMarshalTextPtr                       OpType = 42
	OpInterfacePtr                         OpType = 43
	OpStructHeadInt                        OpType = 44
	OpStructHeadOmitEmptyInt               OpType = 45
	OpStructHeadStringTagInt               OpType = 46
	OpStructPtrHeadInt                     OpType = 47
	OpStructPtrHeadOmitEmptyInt            OpType = 48
	OpStructPtrHeadStringTagInt            OpType = 49
	OpStructHeadUint                       OpType = 50
	OpStructHeadOmitEmptyUint              OpType = 51
	OpStructHeadStringTagUint              OpType = 52
	OpStructPtrHeadUint                    OpType = 53
	OpStructPtrHeadOmitEmptyUint           OpType = 54
	OpStructPtrHeadStringTagUint           OpType = 55
	OpStructHeadFloat32                    OpType = 56
	OpStructHeadOmitEmptyFloat32           OpType = 57
	OpStructHeadStringTagFloat32           OpType = 58
	OpStructPtrHeadFloat32                 OpType = 59
	OpStructPtrHeadOmitEmptyFloat32        OpType = 60
	OpStructPtrHeadStringTagFloat32        OpType = 61
	OpStructHeadFloat64                    OpType = 62
	OpStructHeadOmitEmptyFloat64           OpType = 63
	OpStructHeadStringTagFloat64           OpType = 64
	OpStructPtrHeadFloat64                 OpType = 65
	OpStructPtrHeadOmitEmptyFloat64        OpType = 66
	OpStructPtrHeadStringTagFloat64        OpType = 67
	OpStructHeadBool                       OpType = 68
	OpStructHeadOmitEmptyBool              OpType = 69
	OpStructHeadStringTagBool              OpType = 70
	OpStructPtrHeadBool                    OpType = 71
	OpStructPtrHeadOmitEmptyBool           OpType = 72
	OpStructPtrHeadStringTagBool           OpType = 73
	OpStructHeadString                     OpType = 74
	OpStructHeadOmitEmptyString            OpType = 75
	OpStructHeadStringTagString            OpType = 76
	OpStructPtrHeadString                  OpType = 77
	OpStructPtrHeadOmitEmptyString         OpType = 78
	OpStructPtrHeadStringTagString         OpType = 79
	OpStructHeadBytes                      OpType = 80
	OpStructHeadOmitEmptyBytes             OpType = 81
	OpStructHeadStringTagBytes             OpType = 82
	OpStructPtrHeadBytes                   OpType = 83
	OpStructPtrHeadOmitEmptyBytes          OpType = 84
	OpStructPtrHeadStringTagBytes          OpType = 85
	OpStructHeadNumber                     OpType = 86
	OpStructHeadOmitEmptyNumber            OpType = 87
	OpStructHeadStringTagNumber            OpType = 88
	OpStructPtrHeadNumber                  OpType = 89
	OpStructPtrHeadOmitEmptyNumber         OpType = 90
	OpStructPtrHeadStringTagNumber         OpType = 91
	OpStructHeadArray                      OpType = 92
	OpStructHeadOmitEmptyArray             OpType = 93
	OpStructHeadStringTagArray             OpType = 94
	OpStructPtrHeadArray                   OpType = 95
	OpStructPtrHeadOmitEmptyArray          OpType = 96
	OpStructPtrHeadStringTagArray          OpType = 97
	OpStructHeadMap                        OpType = 98
	OpStructHeadOmitEmptyMap               OpType = 99
	OpStructHeadStringTagMap               OpType = 100
	OpStructPtrHeadMap                     OpType = 101
	OpStructPtrHeadOmitEmptyMap            OpType = 102
	OpStructPtrHeadStringTagMap            OpType = 103
	OpStructHeadSlice                      OpType = 104
	OpStructHeadOmitEmptySlice             OpType = 105
	OpStructHeadStringTagSlice             OpType = 106
	OpStructPtrHeadSlice                   OpType = 107
	OpStructPtrHeadOmitEmptySlice          OpType = 108
	OpStructPtrHeadStringTagSlice          OpType = 109
	OpStructHeadStruct                     OpType = 110
	OpStructHeadOmitEmptyStruct            OpType = 111
	OpStructHeadStringTagStruct            OpType = 112
	OpStructPtrHeadStruct                  OpType = 113
	OpStructPtrHeadOmitEmptyStruct         OpType = 114
	OpStructPtrHeadStringTagStruct         OpType = 115
	OpStructHeadMarshalJSON                OpType = 116
	OpStructHeadOmitEmptyMarshalJSON       OpType = 117
	OpStructHeadStringTagMarshalJSON       OpType = 118
	OpStructPtrHeadMarshalJSON             OpType = 119
	OpStructPtrHeadOmitEmptyMarshalJSON    OpType = 120
	OpStructPtrHeadStringTagMarshalJSON    OpType = 121
	OpStructHeadMarshalText                OpType = 122
	OpStructHeadOmitEmptyMarshalText       OpType = 123
	OpStructHeadStringTagMarshalText       OpType = 124
	OpStructPtrHeadMarshalText             OpType = 125
	OpStructPtrHeadOmitEmptyMarshalText    OpType = 126
	OpStructPtrHeadStringTagMarshalText    OpType = 127
	OpStructHeadIntString                  OpType = 128
	OpStructHeadOmitEmptyIntString         OpType = 129
	OpStructHeadStringTagIntString         OpType = 130
	OpStructPtrHeadIntString               OpType = 131
	OpStructPtrHeadOmitEmptyIntString      OpType = 132
	OpStructPtrHeadStringTagIntString      OpType = 133
	OpStructHeadUintString                 OpType = 134
	OpStructHeadOmitEmptyUintString        OpType = 135
	OpStructHeadStringTagUintString        OpType = 136
	OpStructPtrHeadUintString              OpType = 137
	OpStructPtrHeadOmitEmptyUintString     OpType = 138
	OpStructPtrHeadStringTagUintString     OpType = 139
	OpStructHeadIntPtr                     OpType = 140
	OpStructHeadOmitEmptyIntPtr            OpType = 141
	OpStructHeadStringTagIntPtr            OpType = 142
	OpStructPtrHeadIntPtr                  OpType = 143
	OpStructPtrHeadOmitEmptyIntPtr         OpType = 144
	OpStructPtrHeadStringTagIntPtr         OpType = 145
	OpStructHeadUintPtr                    OpType = 146
	OpStructHeadOmitEmptyUintPtr           OpType = 147
	OpStructHeadStringTagUintPtr           OpType = 148
	OpStructPtrHeadUintPtr                 OpType = 149
	OpStructPtrHeadOmitEmptyUintPtr        OpType = 150
	OpStructPtrHeadStringTagUintPtr        OpType = 151
	OpStructHeadFloat32Ptr                 OpType = 152
	OpStructHeadOmitEmptyFloat32Ptr        OpType = 153
	OpStructHeadStringTagFloat32Ptr        OpType = 154
	OpStructPtrHeadFloat32Ptr              OpType = 155
	OpStructPtrHeadOmitEmptyFloat32Ptr     OpType = 156
	OpStructPtrHeadStringTagFloat32Ptr     OpType = 157
	OpStructHeadFloat64Ptr                 OpType = 158
	OpStructHeadOmitEmptyFloat64Ptr        OpType = 159
	OpStructHeadStringTagFloat64Ptr        OpType = 160
	OpStructPtrHeadFloat64Ptr              OpType = 161
	OpStructPtrHeadOmitEmptyFloat64Ptr     OpType = 162
	OpStructPtrHeadStringTagFloat64Ptr     OpType = 163
	OpStructHeadBoolPtr                    OpType = 164
	OpStructHeadOmitEmptyBoolPtr           OpType = 165
	OpStructHeadStringTagBoolPtr           OpType = 166
	OpStructPtrHeadBoolPtr                 OpType = 167
	OpStructPtrHeadOmitEmptyBoolPtr        OpType = 168
	OpStructPtrHeadStringTagBoolPtr        OpType = 169
	OpStructHeadStringPtr                  OpType = 170
	OpStructHeadOmitEmptyStringPtr         OpType = 171
	OpStructHeadStringTagStringPtr         OpType = 172
	OpStructPtrHeadStringPtr               OpType = 173
	OpStructPtrHeadOmitEmptyStringPtr      OpType = 174
	OpStructPtrHeadStringTagStringPtr      OpType = 175
	OpStructHeadBytesPtr                   OpType = 176
	OpStructHeadOmitEmptyBytesPtr          OpType = 177
	OpStructHeadStringTagBytesPtr          OpType = 178
	OpStructPtrHeadBytesPtr                OpType = 179
	OpStructPtrHeadOmitEmptyBytesPtr       OpType = 180
	OpStructPtrHeadStringTagBytesPtr       OpType = 181
	OpStructHeadNumberPtr                  OpType = 182
	OpStructHeadOmitEmptyNumberPtr         OpType = 183
	OpStructHeadStringTagNumberPtr         OpType = 184
	OpStructPtrHeadNumberPtr               OpType = 185
	OpStructPtrHeadOmitEmptyNumberPtr      OpType = 186
	OpStructPtrHeadStringTagNumberPtr      OpType = 187
	OpStructHeadArrayPtr                   OpType = 188
	OpStructHeadOmitEmptyArrayPtr          OpType = 189
	OpStructHeadStringTagArrayPtr          OpType = 190
	OpStructPtrHeadArrayPtr                OpType = 191
	OpStructPtrHeadOmitEmptyArrayPtr       OpType = 192
	OpStructPtrHeadStringTagArrayPtr       OpType = 193
	OpStructHeadMapPtr                     OpType = 194
	OpStructHeadOmitEmptyMapPtr            OpType = 195
	OpStructHeadStringTagMapPtr            OpType = 196
	OpStructPtrHeadMapPtr                  OpType = 197
	OpStructPtrHeadOmitEmptyMapPtr         OpType = 198
	OpStructPtrHeadStringTagMapPtr         OpType = 199
	OpStructHeadSlicePtr                   OpType = 200
	OpStructHeadOmitEmptySlicePtr          OpType = 201
	OpStructHeadStringTagSlicePtr          OpType = 202
	OpStructPtrHeadSlicePtr                OpType = 203
	OpStructPtrHeadOmitEmptySlicePtr       OpType = 204
	OpStructPtrHeadStringTagSlicePtr       OpType = 205
	OpStructHeadMarshalJSONPtr             OpType = 206
	OpStructHeadOmitEmptyMarshalJSONPtr    OpType = 207
	OpStructHeadStringTagMarshalJSONPtr    OpType = 208
	OpStructPtrHeadMarshalJSONPtr          OpType = 209
	OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 210
	OpStructPtrHeadStringTagMarshalJSONPtr OpType = 211
	OpStructHeadMarshalTextPtr             OpType = 212
	OpStructHeadOmitEmptyMarshalTextPtr    OpType = 213
	OpStructHeadStringTagMarshalTextPtr    OpType = 214
	OpStructPtrHeadMarshalTextPtr          OpType = 215
	OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 216
	OpStructPtrHeadStringTagMarshalTextPtr OpType = 217
	OpStructHeadInterfacePtr               OpType = 218
	OpStructHeadOmitEmptyInterfacePtr      OpType = 219
	OpStructHeadStringTagInterfacePtr      OpType = 220
	OpStructPtrHeadInterfacePtr            OpType = 221
	OpStructPtrHeadOmitEmptyInterfacePtr   OpType = 222
	OpStructPtrHeadStringTagInterfacePtr   OpType = 223
	OpStructHead                           OpType = 224
	OpStructHeadOmitEmpty                  OpType = 225
	OpStructHeadStringTag                  OpType = 226
	OpStructPtrHead                        OpType = 227
	OpStructPtrHeadOmitEmpty               OpType = 228
	OpStructPtrHeadStringTag               OpType = 229
	OpStructFieldInt                       OpType = 230
	OpStructFieldOmitEmptyInt              OpType = 231
	OpStructFieldStringTagInt              OpType = 232
	OpStructEndInt                         OpType = 233
	OpStructEndOmitEmptyInt                OpType = 234
	OpStructEndStringTagInt                OpType = 235
	OpStructFieldUint                      OpType = 236
	OpStructFieldOmitEmptyUint             OpType = 237
	OpStructFieldStringTagUint             OpType = 238
	OpStructEndUint                        OpType = 239
	OpStructEndOmitEmptyUint               OpType = 240
	OpStructEndStringTagUint               OpType = 241
	OpStructFieldFloat32                   OpType = 242
	OpStructFieldOmitEmptyFloat32          OpType = 243
	OpStructFieldStringTagFloat32          OpType = 244
	OpStructEndFloat32                     OpType = 245
	OpStructEndOmitEmptyFloat32            OpType = 246
	OpStructEndStringTagFloat32            OpType = 247
	OpStructFieldFloat64                   OpType = 248
	OpStructFieldOmitEmptyFloat64          OpType = 249
	OpStructFieldStringTagFloat64          OpType = 250
	OpStructEndFloat64                     OpType = 251
	OpStructEndOmitEmptyFloat64            OpType = 252
	OpStructEndStringTagFloat64            OpType = 253
	OpStructFieldBool                      OpType = 254
	OpStructFieldOmitEmptyBool             OpType = 255
	OpStructFieldStringTagBool             OpType = 256
	OpStructEndBool                        OpType = 257
	OpStructEndOmitEmptyBool               OpType = 258
	OpStructEndStringTagBool               OpType = 259
	OpStructFieldString                    OpType = 260
	OpStructFieldOmitEmptyString           OpType = 261
	OpStructFieldStringTagString           OpType = 262
	OpStructEndString                      OpType = 263
	OpStructEndOmitEmptyString             OpType = 264
	OpStructEndStringTagString             OpType = 265
	OpStructFieldBytes                     OpType = 266
	OpStructFieldOmitEmptyBytes            OpType = 267
	OpStructFieldStringTagBytes            OpType = 268
	OpStructEndBytes                       OpType = 269
	OpStructEndOmitEmptyBytes              OpType = 270
	OpStructEndStringTagBytes              OpType = 271
	OpStructFieldNumber                    OpType = 272
	OpStructFieldOmitEmptyNumber           OpType = 273
	OpStructFieldStringTagNumber           OpType = 274
	OpStructEndNumber                      OpType = 275
	OpStructEndOmitEmptyNumber             OpType = 276
	OpStructEndStringTagNumber             OpType = 277
	OpStructFieldArray                     OpType = 278
	OpStructFieldOmitEmptyArray            OpType = 279
	OpStructFieldStringTagArray            OpType = 280
	OpStructEndArray                       OpType = 281
	OpStructEndOmitEmptyArray              OpType = 282
	OpStructEndStringTagArray              OpType = 283
	OpStructFieldMap                       OpType = 284
	OpStructFieldOmitEmptyMap              OpType = 285
	OpStructFieldStringTagMap              OpType = 286
	OpStructEndMap                         OpType = 287
	OpStructEndOmitEmptyMap                OpType = 288
	OpStructEndStringTagMap                OpType = 289
	OpStructFieldSlice                     OpType = 290
	OpStructFieldOmitEmptySlice            OpType = 291
	OpStructFieldStringTagSlice            OpType = 292
	OpStructEndSlice                       OpType = 293
	OpStructEndOmitEmptySlice              OpType = 294
	OpStructEndStringTagSlice              OpType = 295
	OpStructFieldStruct                    OpType = 296
	OpStructFieldOmitEmptyStruct           OpType = 297
	OpStructFieldStringTagStruct           OpType = 298
	OpStructEndStruct                      OpType = 299
	OpStructEndOmitEmptyStruct             OpType = 300
	OpStructEndStringTagStruct             OpType = 301
	OpStructFieldMarshalJSON               OpType = 302
	OpStructFieldOmitEmptyMarshalJSON      OpType = 303
	OpStructFieldStringTagMarshalJSON      OpType = 304
	OpStructEndMarshalJSON                 OpType = 305
	OpStructEndOmitEmptyMarshalJSON        OpType = 306
	OpStructEndStringTagMarshalJSON        OpType = 307
	OpStructFieldMarshalText               OpType = 308
	OpStructFieldOmitEmptyMarshalText      OpType = 309
	OpStructFieldStringTagMarshalText      OpType = 310
	OpStructEndMarshalText                 OpType = 311
	OpStructEndOmitEmptyMarshalText        OpType = 312
	OpStructEndStringTagMarshalText        OpType = 313
	OpStructFieldIntString                 OpType = 314
	OpStructFieldOmitEmptyIntString        OpType = 315
	OpStructFieldStringTagIntString        OpType = 316
	OpStructEndIntString                   OpType = 317
	OpStructEndOmitEmptyIntString          OpType = 318
	OpStructEndStringTagIntString          OpType = 319
	OpStructFieldUintString                OpType = 320
	OpStructFieldOmitEmptyUintString       OpType = 321
	OpStructFieldStringTagUintString       OpType = 322
	OpStructEndUintString                  OpType = 323
	OpStructEndOmitEmptyUintString         OpType = 324
	OpStructEndStringTagUintString         OpType = 325
	OpStructFieldIntPtr                    OpType = 326
	OpStructFieldOmitEmptyIntPtr           OpType = 327
	OpStructFieldStringTagIntPtr           OpType = 328
	OpStructEndIntPtr                      OpType = 329
	OpStructEndOmitEmptyIntPtr             OpType = 330
	OpStructEndStringTagIntPtr             OpType = 331
	OpStructFieldUintPtr                   OpType = 332
	OpStructFieldOmitEmptyUintPtr          OpType = 333
	OpStructFieldStringTagUintPtr          OpType = 334
	OpStructEndUintPtr                     OpType = 335
	OpStructEndOmitEmptyUintPtr            OpType = 336
	OpStructEndStringTagUintPtr            OpType = 337
	OpStructFieldFloat32Ptr                OpType = 338
	OpStructFieldOmitEmptyFloat32Ptr       OpType = 339
	OpStructFieldStringTagFloat32Ptr       OpType = 340
	OpStructEndFloat32Ptr                  OpType = 341
	OpStructEndOmitEmptyFloat32Ptr         OpType = 342
	OpStructEndStringTagFloat32Ptr         OpType = 343
	OpStructFieldFloat64Ptr                OpType = 344
	OpStructFieldOmitEmptyFloat64Ptr       OpType = 345
	OpStructFieldStringTagFloat64Ptr       OpType = 346
	OpStructEndFloat64Ptr                  OpType = 347
	OpStructEndOmitEmptyFloat64Ptr         OpType = 348
	OpStructEndStringTagFloat64Ptr         OpType = 349
	OpStructFieldBoolPtr                   OpType = 350
	OpStructFieldOmitEmptyBoolPtr          OpType = 351
	OpStructFieldStringTagBoolPtr          OpType = 352
	OpStructEndBoolPtr                     OpType = 353
	OpStructEndOmitEmptyBoolPtr            OpType = 354
	OpStructEndStringTagBoolPtr            OpType = 355
	OpStructFieldStringPtr                 OpType = 356
	OpStructFieldOmitEmptyStringPtr        OpType = 357
	OpStructFieldStringTagStringPtr        OpType = 358
	OpStructEndStringPtr                   OpType = 359
	OpStructEndOmitEmptyStringPtr          OpType = 360
	OpStructEndStringTagStringPtr          OpType = 361
	OpStructFieldBytesPtr                  OpType = 362
	OpStructFieldOmitEmptyBytesPtr         OpType = 363
	OpStructFieldStringTagBytesPtr         OpType = 364
	OpStructEndBytesPtr                    OpType = 365
	OpStructEndOmitEmptyBytesPtr           OpType = 366
	OpStructEndStringTagBytesPtr           OpType = 367
	OpStructFieldNumberPtr                 OpType = 368
	OpStructFieldOmitEmptyNumberPtr        OpType = 369
	OpStructFieldStringTagNumberPtr        OpType = 370
	OpStructEndNumberPtr                   OpType = 371
	OpStructEndOmitEmptyNumberPtr          OpType = 372
	OpStructEndStringTagNumberPtr          OpType = 373
	OpStructFieldArrayPtr                  OpType = 374
	OpStructFieldOmitEmptyArrayPtr         OpType = 375
	OpStructFieldStringTagArrayPtr         OpType = 376
	OpStructEndArrayPtr                    OpType = 377
	OpStructEndOmitEmptyArrayPtr           OpType = 378
	OpStructEndStringTagArrayPtr           OpType = 379
	OpStructFieldMapPtr                    OpType = 380
	OpStructFieldOmitEmptyMapPtr           OpType = 381
	OpStructFieldStringTagMapPtr           OpType = 382
	OpStructEndMapPtr                      OpType = 383
	OpStructEndOmitEmptyMapPtr             OpType = 384
	OpStructEndStringTagMapPtr             OpType = 385
	OpStructFieldSlicePtr                  OpType = 386
	OpStructFieldOmitEmptySlicePtr         OpType = 387
	OpStructFieldStringTagSlicePtr         OpType = 388
	OpStructEndSlicePtr                    OpType = 389
	OpStructEndOmitEmptySlicePtr           OpType = 390
	OpStructEndStringTagSlicePtr           OpType = 391
	OpStructFieldMarshalJSONPtr            OpType = 392
	OpStructFieldOmitEmptyMarshalJSONPtr   OpType = 393
	OpStructFieldStringTagMarshalJSONPtr   OpType = 394
	OpStructEndMarshalJSONPtr              OpType = 395
	OpStructEndOmitEmptyMarshalJSONPtr     OpType = 396
	OpStructEndStringTagMarshalJSONPtr     OpType = 397
	OpStructFieldMarshalTextPtr            OpType = 398
	OpStructFieldOmitEmptyMarshalTextPtr   OpType = 399
	OpStructFieldStringTagMarshalTextPtr   OpType = 400
	OpStructEndMarshalTextPtr              OpType = 401
	OpStructEndOmitEmptyMarshalTextPtr     OpType = 402
	OpStructEndStringTagMarshalTextPtr     OpType = 403
	OpStructFieldInterfacePtr              OpType = 404
	OpStructFieldOmitEmptyInterfacePtr     OpType = 405
	OpStructFieldStringTagInterfacePtr     OpType = 406
	OpStructEndInterfacePtr                OpType = 407
	OpStructEndOmitEmptyInterfacePtr       OpType = 408
	OpStructEndStringTagInterfacePtr       OpType = 409
	OpStructField                          OpType = 410
	OpStructFieldOmitEmpty                 OpType = 411
	OpStructFieldStringTag                 OpType = 412
	OpStructEnd                            OpType = 413
	OpStructEndOmitEmpty                   OpType = 414
	OpStructEndStringTag                   OpType = 415
)

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) FieldToStringTagField

func (t OpType) FieldToStringTagField() OpType

func (OpType) HeadToOmitEmptyHead

func (t OpType) HeadToOmitEmptyHead() OpType

func (OpType) HeadToPtrHead

func (t OpType) HeadToPtrHead() OpType

func (OpType) HeadToStringTagHead

func (t OpType) HeadToStringTagHead() 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
	Type             *runtime.Type // go type
	DisplayIdx       int           // opcode index
	Key              []byte        // struct field key
	EscapedKey       []byte        // struct field key ( HTML escaped )
	PtrNum           int           // pointer number: e.g. double pointer is 2.
	DisplayKey       string        // key text to display
	IsTaggedKey      bool          // whether tagged key
	AnonymousKey     bool          // whether anonymous key
	AnonymousHead    bool          // whether anonymous head or not
	Indirect         bool          // whether indirect or not
	Nilcheck         bool          // whether needs to nilcheck or not
	AddrForMarshaler bool          // whether needs to addr for marshaler or not
	IsNextOpPtrType  bool          // whether next operation is ptr type or not
	IsNilableType    bool          // whether type is nilable or not
	RshiftNum        uint8         // use to take bit for judging whether negative integer or not
	Mask             uint64        // mask for number
	Indent           int           // indent number

	Idx     uintptr // offset to access ptr
	HeadIdx uintptr // offset to access slice/struct head
	ElemIdx uintptr // offset to access array/slice/map elem
	Length  uintptr // offset to access slice/map length or array length
	MapIter uintptr // offset to access map iterator
	MapPos  uintptr // offset to access position list for sorted map
	Offset  uintptr // offset size from struct header
	Size    uintptr // array/slice elem size

	MapKey    *Opcode       // map key
	MapValue  *Opcode       // map value
	Elem      *Opcode       // array/slice elem
	End       *Opcode       // array/slice/struct/map end
	PrevField *Opcode       // prev struct field
	NextField *Opcode       // next struct field
	Next      *Opcode       // next opcode
	Jmp       *CompiledCode // for recursive call
}

func (*Opcode) BeforeLastCode

func (c *Opcode) BeforeLastCode() *Opcode

func (*Opcode) Dump

func (c *Opcode) Dump() string

func (*Opcode) ToFieldType

func (c *Opcode) ToFieldType() OpType

func (*Opcode) ToHeaderType

func (c *Opcode) ToHeaderType() OpType

func (*Opcode) TotalLength

func (c *Opcode) TotalLength() int

type OpcodeSet

type OpcodeSet struct {
	Type       *runtime.Type
	Code       *Opcode
	CodeLength int
}

func CompileToGetCodeSet

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

type Option

type Option int
const (
	HTMLEscapeOption Option = 1 << iota
	IndentOption
	UnorderedMapOption
)

type RuntimeContext

type RuntimeContext struct {
	Buf        []byte
	Ptrs       []uintptr
	KeepRefs   []unsafe.Pointer
	SeenPtr    []uintptr
	BaseIndent int
	Prefix     []byte
	IndentStr  []byte
}

func (*RuntimeContext) Init

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

func (*RuntimeContext) Ptr

func (c *RuntimeContext) Ptr() uintptr

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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