pjn

package module
v0.0.0-...-875b4c5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: MIT Imports: 4 Imported by: 0

README

pjn

Fast zero-allocation JSON producer fo Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilReference = errNilReference{}
	ErrEmptySlice   = errEmptySlice{}
)
View Source
var (
	EmptyArray = produceEmptyArray
)
View Source
var (
	EmptyObject = produceEmptyObject
)

Functions

This section is empty.

Types

type ArrayBuilder

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

func (ArrayBuilder) Build

func (ab ArrayBuilder) Build() Value

func (ArrayBuilder) IsEmpty

func (ab ArrayBuilder) IsEmpty() bool

func (ArrayBuilder) Push

func (ab ArrayBuilder) Push(value Value) ArrayBuilder

type Buffer

type Buffer struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func (*Buffer) AppendByte

func (buf *Buffer) AppendByte(b byte)

func (*Buffer) AppendBytes

func (buf *Buffer) AppendBytes(p []byte)

func (*Buffer) AppendEscapedRune

func (buf *Buffer) AppendEscapedRune(r rune)

func (*Buffer) AppendEscapedString

func (buf *Buffer) AppendEscapedString(s string)

func (*Buffer) AppendFloat32

func (buf *Buffer) AppendFloat32(n float32)

func (*Buffer) AppendFloat64

func (buf *Buffer) AppendFloat64(n float64)

func (*Buffer) AppendInt

func (buf *Buffer) AppendInt(n int)

func (*Buffer) AppendInt16

func (buf *Buffer) AppendInt16(n int16)

func (*Buffer) AppendInt32

func (buf *Buffer) AppendInt32(n int32)

func (*Buffer) AppendInt64

func (buf *Buffer) AppendInt64(n int64)

func (*Buffer) AppendString

func (buf *Buffer) AppendString(s string)

func (*Buffer) AppendUint

func (buf *Buffer) AppendUint(n uint)

func (*Buffer) AppendUint16

func (buf *Buffer) AppendUint16(n uint16)

func (*Buffer) AppendUint32

func (buf *Buffer) AppendUint32(n uint32)

func (*Buffer) AppendUint64

func (buf *Buffer) AppendUint64(n uint64)

func (*Buffer) AppendUnescapedRune

func (buf *Buffer) AppendUnescapedRune(r rune)

func (*Buffer) AppendUnescapedString

func (buf *Buffer) AppendUnescapedString(s string)

type ErrProduceFailed

type ErrProduceFailed struct {
	Where  string
	Reason error
}

func ArrayProduceFailed

func ArrayProduceFailed(reason error) ErrProduceFailed

func MemberProduceFailed

func MemberProduceFailed(reason error) ErrProduceFailed

func ObjectProduceFailed

func ObjectProduceFailed(reason error) ErrProduceFailed

func ValueProduceFailed

func ValueProduceFailed(reason error) ErrProduceFailed

func (ErrProduceFailed) Error

func (e ErrProduceFailed) Error() (s string)

type ObjectBuilder

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

func (ObjectBuilder) Build

func (ob ObjectBuilder) Build() Value

func (ObjectBuilder) IsEmpty

func (ob ObjectBuilder) IsEmpty() bool

func (ObjectBuilder) Member

func (ob ObjectBuilder) Member(name string, value Value) ObjectBuilder

type Producer

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

func (*Producer) Bytes

func (p *Producer) Bytes() []byte

func (*Producer) Produce

func (p *Producer) Produce(value Value) error

func (*Producer) String

func (p *Producer) String() string

func (*Producer) WriteTo

func (p *Producer) WriteTo(writer io.Writer) (n int64, err error)

type Value

type Value func(*Buffer) error
var (
	True  Value = produceBoolTrue
	False Value = produceBoolFalse
)
var (
	EmptyStr Value = produceEmptyString
)
var (
	Null Value = produceNull
)
var (
	Zero Value = produceNumberZero
)

func Array

func Array(producer ...Value) Value

func BindBool

func BindBool(ref *bool) Value

func BindFloat32

func BindFloat32(ref *float32) Value

func BindFloat64

func BindFloat64(ref *float64) Value

func BindInt

func BindInt(ref *int) Value

func BindInt16

func BindInt16(ref *int16) Value

func BindInt32

func BindInt32(ref *int32) Value

func BindInt64

func BindInt64(ref *int64) Value

func BindNullableBool

func BindNullableBool(ref **bool) Value

func BindNullableFloat32

func BindNullableFloat32(ref **float32) Value

func BindNullableFloat64

func BindNullableFloat64(ref **float64) Value

func BindNullableInt

func BindNullableInt(ref **int) Value

func BindNullableInt16

func BindNullableInt16(ref **int16) Value

func BindNullableInt32

func BindNullableInt32(ref **int32) Value

func BindNullableInt64

func BindNullableInt64(ref **int64) Value

func BindNullableRune

func BindNullableRune(ref **rune) Value

func BindNullableRuneNoEscape

func BindNullableRuneNoEscape(ref **rune) Value

func BindNullableStr

func BindNullableStr(ref **string) Value

func BindNullableStrNoEscape

func BindNullableStrNoEscape(ref **string) Value

func BindNullableUint

func BindNullableUint(ref **uint) Value

func BindNullableUint16

func BindNullableUint16(ref **uint16) Value

func BindNullableUint32

func BindNullableUint32(ref **uint32) Value

func BindNullableUint64

func BindNullableUint64(ref **uint64) Value

func BindRune

func BindRune(ref *rune) Value

func BindRuneNoEscape

func BindRuneNoEscape(ref *rune) Value

func BindStr

func BindStr(ref *string) Value

func BindStrNoEscape

func BindStrNoEscape(ref *string) Value

func BindUint

func BindUint(ref *uint) Value

func BindUint16

func BindUint16(ref *uint16) Value

func BindUint32

func BindUint32(ref *uint32) Value

func BindUint64

func BindUint64(ref *uint64) Value

func Bool

func Bool(value bool) Value

func Float32

func Float32(value float32) Value

func Float64

func Float64(value float64) Value

func Int

func Int(value int) Value

func Int16

func Int16(value int16) Value

func Int32

func Int32(value int32) Value

func Int64

func Int64(value int64) Value

func Member

func Member(name string, value Value) Value

func NullableBool

func NullableBool(ref *bool) Value

func NullableFloat32

func NullableFloat32(ref *float32) Value

func NullableFloat64

func NullableFloat64(ref *float64) Value

func NullableInt

func NullableInt(ref *int) Value

func NullableInt16

func NullableInt16(ref *int16) Value

func NullableInt32

func NullableInt32(ref *int32) Value

func NullableInt64

func NullableInt64(ref *int64) Value

func NullableRune

func NullableRune(ref *rune) Value

func NullableRuneNoEscape

func NullableRuneNoEscape(ref *rune) Value

func NullableStr

func NullableStr(ref *string) Value

func NullableStrNoEscape

func NullableStrNoEscape(ref *string) Value

func NullableUint

func NullableUint(ref *uint) Value

func NullableUint16

func NullableUint16(ref *uint16) Value

func NullableUint32

func NullableUint32(ref *uint32) Value

func NullableUint64

func NullableUint64(ref *uint64) Value

func Object

func Object(producer ...Value) Value

func RawBytes

func RawBytes(value []byte) Value

func Rune

func Rune(value rune) Value

func RuneNoEscape

func RuneNoEscape(value rune) Value

func Str

func Str(value string) Value

func StrNoEscape

func StrNoEscape(value string) Value

func Uint

func Uint(value uint) Value

func Uint16

func Uint16(value uint16) Value

func Uint32

func Uint32(value uint32) Value

func Uint64

func Uint64(value uint64) Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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