wire

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Int = iota << 5
	Neg
	Bytes
	String
	Array
	Map
	Semantic
	Special

	TagMask    = 0b111_00000
	TagDetMask = 0b000_11111
)

Basic types.

View Source
const (
	Len1 = 24 + iota
	Len2
	Len4
	Len8

	LenBreak = Break
)

Len.

View Source
const (
	False = 20 + iota
	True
	Nil
	Undefined

	Float8
	Float16
	Float32
	Float64

	Break = 1<<5 - 1
)

Specials.

View Source
const (
	Meta = iota
	Error
	Time
	Duration
	Big

	Caller

	Hex

	SemanticExtBase
)

Semantics.

Variables

View Source
var ErrSubstate = errors.New("in substate")

Functions

func Dump

func Dump(p []byte) (r string)

Types

type BigKind added in v0.13.0

type BigKind int8
const (
	BigNil BigKind = iota
	BigInt
	BigRat
	BigFloat

	NotBig BigKind = -1
)

type Decoder

type Decoder struct {
	LowDecoder
}

func (*Decoder) BigFloat added in v0.13.0

func (d *Decoder) BigFloat(p []byte, st int, x *big.Float) (text []byte, i int)

func (*Decoder) BigInt added in v0.13.0

func (d *Decoder) BigInt(p []byte, st int, x *big.Int) (raw []byte, i int)

func (*Decoder) BigRat added in v0.13.0

func (d *Decoder) BigRat(p []byte, st int, x *big.Rat) (num, denom []byte, i int)

func (*Decoder) BigWhich added in v0.13.0

func (d *Decoder) BigWhich(p []byte, st int) BigKind

func (*Decoder) Caller

func (d *Decoder) Caller(p []byte, st int) (pc loc.PC, i int)

func (*Decoder) Callers

func (d *Decoder) Callers(p []byte, st int) (pc loc.PC, pcs loc.PCs, i int)

func (*Decoder) Time

func (d *Decoder) Time(p []byte, st int) (t time.Time, i int)

func (*Decoder) Timestamp added in v0.13.0

func (d *Decoder) Timestamp(p []byte, st int) (ts int64, i int)

type Dumper

type Dumper struct {
	LowDecoder

	io.Writer

	NoGlobalOffset bool
	// contains filtered or unexported fields
}

func NewDumper

func NewDumper(w io.Writer) *Dumper

func (*Dumper) Write

func (d *Dumper) Write(p []byte) (n int, err error)

type Encoder

type Encoder struct {
	LowEncoder
}

func (*Encoder) AppendArray

func (e *Encoder) AppendArray(b []byte, l int) []byte

func (*Encoder) AppendBigFloat added in v0.13.0

func (e *Encoder) AppendBigFloat(b []byte, x *big.Float) []byte

func (*Encoder) AppendBigInt added in v0.13.0

func (e *Encoder) AppendBigInt(b []byte, x *big.Int) []byte

func (*Encoder) AppendBigRat added in v0.13.0

func (e *Encoder) AppendBigRat(b []byte, x *big.Rat) []byte

func (*Encoder) AppendBreak

func (e *Encoder) AppendBreak(b []byte) []byte

func (*Encoder) AppendDuration

func (e *Encoder) AppendDuration(b []byte, d time.Duration) []byte

func (*Encoder) AppendError

func (e *Encoder) AppendError(b []byte, err error) []byte

func (*Encoder) AppendFormat

func (e *Encoder) AppendFormat(b []byte, fmt string, args ...interface{}) []byte

func (*Encoder) AppendKey

func (e *Encoder) AppendKey(b []byte, k string) []byte

func (*Encoder) AppendKeyBytes

func (e *Encoder) AppendKeyBytes(b []byte, k string, v []byte) []byte

func (*Encoder) AppendKeyInt

func (e *Encoder) AppendKeyInt(b []byte, k string, v int) []byte

func (*Encoder) AppendKeyInt64 added in v0.13.0

func (e *Encoder) AppendKeyInt64(b []byte, k string, v int64) []byte

func (*Encoder) AppendKeyString

func (e *Encoder) AppendKeyString(b []byte, k, v string) []byte

func (*Encoder) AppendKeyUint

func (e *Encoder) AppendKeyUint(b []byte, k string, v uint) []byte

func (*Encoder) AppendKeyUint64 added in v0.13.0

func (e *Encoder) AppendKeyUint64(b []byte, k string, v uint64) []byte

func (*Encoder) AppendKeyValue

func (e *Encoder) AppendKeyValue(b []byte, k string, v interface{}) []byte

func (*Encoder) AppendMap added in v0.12.1

func (e *Encoder) AppendMap(b []byte, l int) []byte

func (*Encoder) AppendNil added in v0.13.0

func (e *Encoder) AppendNil(b []byte) []byte

func (*Encoder) AppendPC

func (e *Encoder) AppendPC(b []byte, pc loc.PC) []byte

func (*Encoder) AppendPCs

func (e *Encoder) AppendPCs(b []byte, pcs loc.PCs) []byte

func (*Encoder) AppendTime

func (e *Encoder) AppendTime(b []byte, t time.Time) []byte

func (*Encoder) AppendTimestamp

func (e *Encoder) AppendTimestamp(b []byte, t int64) []byte

func (*Encoder) AppendValue

func (e *Encoder) AppendValue(b []byte, v interface{}) []byte

func (*Encoder) InsertLen added in v0.13.0

func (e *Encoder) InsertLen(b []byte, st, l int) []byte

type LowDecoder

type LowDecoder struct{}

func (*LowDecoder) Break

func (d *LowDecoder) Break(b []byte, i *int) bool

func (*LowDecoder) Float

func (d *LowDecoder) Float(b []byte, st int) (v float64, i int)

func (*LowDecoder) Signed

func (d *LowDecoder) Signed(b []byte, st int) (v int64, i int)

func (*LowDecoder) Skip

func (d *LowDecoder) Skip(b []byte, st int) (i int)

func (*LowDecoder) SkipTag added in v0.13.0

func (d *LowDecoder) SkipTag(b []byte, st int) (tag byte, sub int64, i int)

func (*LowDecoder) String

func (d *LowDecoder) String(b []byte, st int) (v []byte, i int)

func (*LowDecoder) Tag

func (d *LowDecoder) Tag(b []byte, st int) (tag byte, sub int64, i int)

func (*LowDecoder) TagOnly

func (d *LowDecoder) TagOnly(b []byte, st int) (tag byte)

func (*LowDecoder) Unsigned added in v0.13.0

func (d *LowDecoder) Unsigned(b []byte, st int) (v uint64, i int)

type LowEncoder

type LowEncoder struct{}

func (*LowEncoder) AppendBreak added in v0.14.0

func (e *LowEncoder) AppendBreak(b []byte) []byte

func (*LowEncoder) AppendBytes added in v0.13.0

func (e *LowEncoder) AppendBytes(b, s []byte) []byte

func (*LowEncoder) AppendFloat

func (e *LowEncoder) AppendFloat(b []byte, v float64) []byte

func (*LowEncoder) AppendInt

func (e *LowEncoder) AppendInt(b []byte, v int) []byte

func (*LowEncoder) AppendInt64 added in v0.13.0

func (e *LowEncoder) AppendInt64(b []byte, v int64) []byte

func (*LowEncoder) AppendSemantic added in v0.13.0

func (e *LowEncoder) AppendSemantic(b []byte, s int) []byte

func (*LowEncoder) AppendSpecial added in v0.13.0

func (e *LowEncoder) AppendSpecial(b []byte, x byte) []byte

func (*LowEncoder) AppendString

func (e *LowEncoder) AppendString(b []byte, s string) []byte

func (*LowEncoder) AppendTag

func (e *LowEncoder) AppendTag(b []byte, tag byte, v int) []byte

func (*LowEncoder) AppendTag64 added in v0.13.0

func (e *LowEncoder) AppendTag64(b []byte, tag byte, v int64) []byte

func (*LowEncoder) AppendTagBytes added in v0.14.0

func (e *LowEncoder) AppendTagBytes(b []byte, tag byte, s []byte) []byte

func (*LowEncoder) AppendTagInt added in v0.13.0

func (e *LowEncoder) AppendTagInt(b []byte, tag byte, v uint64) []byte

func (*LowEncoder) AppendTagString added in v0.13.0

func (e *LowEncoder) AppendTagString(b []byte, tag byte, s string) []byte

func (*LowEncoder) AppendUint added in v0.13.0

func (e *LowEncoder) AppendUint(b []byte, v uint) []byte

func (*LowEncoder) AppendUint64 added in v0.13.0

func (e *LowEncoder) AppendUint64(b []byte, v uint64) []byte

type State added in v0.13.0

type State struct {
	io.Reader
	// contains filtered or unexported fields
}

func (*State) Read added in v0.13.0

func (s *State) Read(p []byte) (i int, err error)

func (*State) SubState added in v0.13.0

func (s *State) SubState(p []byte) (sub *SubState, i int, err error)

type StreamDecoder

type StreamDecoder struct {
	io.Reader
	// contains filtered or unexported fields
}

func NewStreamDecoder

func NewStreamDecoder(r io.Reader) *StreamDecoder

func (*StreamDecoder) Decode added in v0.12.1

func (d *StreamDecoder) Decode() (data []byte, err error)

func (*StreamDecoder) Read added in v0.13.0

func (d *StreamDecoder) Read(p []byte) (n int, err error)

func (*StreamDecoder) WriteTo added in v0.13.0

func (d *StreamDecoder) WriteTo(w io.Writer) (n int64, err error)

type SubState added in v0.13.0

type SubState struct {
	Tag byte
	Sub int64
	// contains filtered or unexported fields
}

func (*SubState) Close added in v0.13.0

func (ss *SubState) Close() error

func (*SubState) Read added in v0.13.0

func (ss *SubState) Read(p []byte) (int, error)

type Tag added in v0.13.0

type Tag byte

func (Tag) String added in v0.13.0

func (t Tag) String() string

type TlogAppender

type TlogAppender interface {
	TlogAppend(e *Encoder, b []byte) []byte
}

type TlogParser

type TlogParser interface {
	TlogParse(d *Decoder, b []byte, st int) int
}

Jump to

Keyboard shortcuts

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