Documentation ¶
Index ¶
- Constants
- Variables
- type JSON
- func (j *JSON) AppendAnyJSONBytes(input []byte) (ref int, err error)
- func (j *JSON) AppendArray(input []byte) (ref int, err error)
- func (j *JSON) AppendArrayValue(arrayNodeRef, newItemRef int)
- func (j *JSON) AppendErrorWithMessage(message string, errorPath []PathElement) int
- func (j *JSON) AppendInt(value int) int
- func (j *JSON) AppendJSON(another *JSON) (nodeRef, storageOffset, nodeOffset int)
- func (j *JSON) AppendNonNullableFieldIsNullErr(fieldPath string, errorPath []PathElement) int
- func (j *JSON) AppendNull() int
- func (j *JSON) AppendObject(input []byte) (ref int, err error)
- func (j *JSON) AppendString(input string) int
- func (j *JSON) AppendStringBytes(input []byte) int
- func (j *JSON) DebugPrintNode(ref int) string
- func (j *JSON) Get(nodeRef int, path []string) int
- func (j *JSON) GetObjectField(nodeRef int, path string) int
- func (j *JSON) GetObjectFieldBytes(nodeRef int, path []byte) int
- func (j *JSON) ImportPrimitiveNode(from *JSON, ref int) (int, error)
- func (j *JSON) InitResolvable(initialData []byte) (dataRoot, errorsRoot int, err error)
- func (j *JSON) MergeArrays(left, right int)
- func (j *JSON) MergeNodes(left, right int) int
- func (j *JSON) MergeNodesWithPath(left, right int, path []string) int
- func (j *JSON) MergeObjects(nodeRefs []int) int
- func (j *JSON) NodeIsDefined(ref int) bool
- func (j *JSON) NodeIsPrimitive(ref int) bool
- func (j *JSON) ObjectFieldKey(objectFieldRef int) []byte
- func (j *JSON) ObjectFieldValue(objectFieldRef int) int
- func (j *JSON) ParseArray(input []byte) (err error)
- func (j *JSON) ParseObject(input []byte) (err error)
- func (j *JSON) PrintNode(node Node, out io.Writer) error
- func (j *JSON) PrintObjectFlat(ref int, out io.Writer) (err error)
- func (j *JSON) PrintRoot(out io.Writer) error
- func (j *JSON) Reset()
- func (j *JSON) SetObjectField(nodeRef, setFieldNodeRef int, key string) bool
- func (j *JSON) SetObjectFieldKeyBytes(nodeRef, setFieldNodeRef int, key []byte) bool
- type Node
- type NodeKind
- type PathElement
Constants ¶
View Source
const InvalidRef = -1
Variables ¶
View Source
var ( Pool = &pool{ p: sync.Pool{ New: func() interface{} { return &JSON{ Nodes: make([]Node, 0, 4096), } }, }, } ErrParseJSONObject = errors.New("failed to parse json object") ErrParseJSONArray = errors.New("failed to parse json array") ErrParseJSONValue = errors.New("failed to parse json value") )
Functions ¶
This section is empty.
Types ¶
type JSON ¶
func (*JSON) AppendAnyJSONBytes ¶
func (*JSON) AppendArrayValue ¶
func (*JSON) AppendErrorWithMessage ¶
func (j *JSON) AppendErrorWithMessage(message string, errorPath []PathElement) int
func (*JSON) AppendJSON ¶
func (*JSON) AppendNonNullableFieldIsNullErr ¶
func (j *JSON) AppendNonNullableFieldIsNullErr(fieldPath string, errorPath []PathElement) int
func (*JSON) AppendNull ¶
func (*JSON) AppendString ¶
func (*JSON) AppendStringBytes ¶
func (*JSON) DebugPrintNode ¶
func (*JSON) ImportPrimitiveNode ¶
func (*JSON) InitResolvable ¶
func (*JSON) MergeArrays ¶
func (*JSON) MergeNodes ¶
func (*JSON) MergeNodesWithPath ¶
func (*JSON) MergeObjects ¶
func (*JSON) NodeIsDefined ¶
func (*JSON) NodeIsPrimitive ¶
func (*JSON) ObjectFieldKey ¶
func (*JSON) ObjectFieldValue ¶
func (*JSON) ParseArray ¶
func (*JSON) ParseObject ¶
func (*JSON) PrintObjectFlat ¶
PrintObjectFlat prints the flat object without nested fields (array, object)
func (*JSON) SetObjectField ¶
type Node ¶
type Node struct { Kind NodeKind ObjectFieldValue int ObjectFields []int ArrayValues []int // contains filtered or unexported fields }
func (*Node) ValueBytes ¶
type NodeKind ¶
type NodeKind int
const ( NodeKindSkip NodeKind = iota NodeKindObject NodeKindObjectField NodeKindArray NodeKindString NodeKindNumber NodeKindBoolean NodeKindNull // NodeKindNullSkipError indicates that the node is null, but no error should be emitted // There's no need to emit an error if the field should be non-nullable, // because an error was already emitted when the field was fetched // or a nested error was emitted, so there's no need to emit another one NodeKindNullSkipError )
type PathElement ¶
Click to show internal directories.
Click to hide internal directories.