iterator

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsStreamTransformer

func AsStreamTransformer(transformer ValueTransformer) token.StreamTransformer

AsStreamTransformer turns a ValueTransformer into a StreamTransformer, so it can be applied to a json stream.

func SafeValuesEqual

func SafeValuesEqual(v1, v2 Value) bool

SafeValuesEqual returns true if v1 and v2 are equal, without advancing either of them.

func ValuesEqual

func ValuesEqual(v1, v2 Value) bool

ValuesEqual returns true if v1 and v2 are equal. It may advance v1 and / or v2.

Types

type Array

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

func (*Array) Advance

func (a *Array) Advance() bool

func (*Array) AsArray

func (a *Array) AsArray() (*Array, bool)

func (*Array) AsObject

func (c *Array) AsObject() (*Object, bool)

func (*Array) AsScalar

func (c *Array) AsScalar() (*token.Scalar, bool)

func (*Array) Clone

func (a *Array) Clone() (Value, func())

func (*Array) CloneArray

func (a *Array) CloneArray() (*Array, func())

func (*Array) Copy

func (c *Array) Copy(w token.WriteStream)

func (*Array) CurrentValue

func (c *Array) CurrentValue() Value

func (*Array) Discard

func (c *Array) Discard()

func (*Array) Elided

func (c *Array) Elided() bool

func (*Array) Equal

func (a *Array) Equal(v Value) bool

type Collection

type Collection interface {
	Value
	Advance() bool
	Done() bool
	Elided() bool
	CurrentValue() Value
}

type Iterator

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

func New

func New(stream token.ReadStream) *Iterator

func (*Iterator) Advance

func (i *Iterator) Advance() (ok bool)

func (*Iterator) Clone

func (i *Iterator) Clone() (*Iterator, func())

func (*Iterator) CurrentValue

func (i *Iterator) CurrentValue() Value

type Object

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

func (*Object) Advance

func (o *Object) Advance() bool

func (*Object) AsArray

func (c *Object) AsArray() (*Array, bool)

func (*Object) AsObject

func (o *Object) AsObject() (*Object, bool)

func (*Object) AsScalar

func (c *Object) AsScalar() (*token.Scalar, bool)

func (*Object) Clone

func (o *Object) Clone() (Value, func())

func (*Object) CloneObject

func (o *Object) CloneObject() (*Object, func())

func (*Object) Copy

func (c *Object) Copy(w token.WriteStream)

func (*Object) CurrentKeyVal

func (o *Object) CurrentKeyVal() (*token.Scalar, Value)

func (*Object) CurrentValue

func (c *Object) CurrentValue() Value

func (*Object) Discard

func (c *Object) Discard()

func (*Object) Elided

func (c *Object) Elided() bool

func (*Object) Equal

func (o *Object) Equal(v Value) bool

type Scalar

type Scalar token.Scalar

func (*Scalar) AsArray

func (s *Scalar) AsArray() (*Array, bool)

func (*Scalar) AsObject

func (s *Scalar) AsObject() (*Object, bool)

func (*Scalar) AsScalar

func (s *Scalar) AsScalar() (*token.Scalar, bool)

func (*Scalar) Clone

func (s *Scalar) Clone() (Value, func())

func (*Scalar) Copy

func (s *Scalar) Copy(w token.WriteStream)

func (*Scalar) Discard

func (s *Scalar) Discard()

func (*Scalar) Equal

func (s *Scalar) Equal(v Value) bool

func (*Scalar) Scalar

func (s *Scalar) Scalar() *token.Scalar

type Value

type Value interface {
	Clone() (Value, func())
	Discard()
	Copy(token.WriteStream)
	AsScalar() (*token.Scalar, bool)
	AsArray() (*Array, bool)
	AsObject() (*Object, bool)
	Equal(Value) bool
}

type ValueTransformer

type ValueTransformer interface {
	TransformValue(value Value, out token.WriteStream)
}

A ValueTransformer can transform a StreamedValue into a json stream. Use the AsStreamTransformer function to turn it into a StreamTransformer which can then be applied.

Jump to

Keyboard shortcuts

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