tlwire

package
v0.21.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 15 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 (
	None = 19 + iota

	False
	True
	Nil
	Undefined

	Float8
	Float16
	Float32
	Float64

	Break
)

Specials.

View Source
const (
	Meta = iota
	Error
	Time
	Duration
	Big

	Caller

	Hex

	SemanticTlogBase
)

Semantics.

Variables

This section is empty.

Functions

func Dump

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

func SetEncoder

func SetEncoder(tp interface{}, encoder ValueEncoder)

Types

type Decoder

type Decoder struct {
	LowDecoder
}

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

func (d Decoder) Duration(p []byte, st int) (dr time.Duration, i int)

func (Decoder) Time

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

func (Decoder) Timestamp

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
	// contains filtered or unexported fields
}

func (Encoder) AppendCaller

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

func (Encoder) AppendCallers

func (e Encoder) AppendCallers(b []byte, pcs loc.PCs) []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, key string) []byte

func (Encoder) AppendKeyInt

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

func (Encoder) AppendKeyInt64

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

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

func (*Encoder) AppendKeyValue added in v0.21.0

func (e *Encoder) AppendKeyValue(b []byte, key string, v interface{}) []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) AppendTimeMonoTZ added in v0.21.2

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

func (Encoder) AppendTimeTZ

func (e Encoder) AppendTimeTZ(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) AppendValueSafe added in v0.21.0

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

func (Encoder) InsertLen

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

InsertLen inserts length l before value starting at st copying l bytes forward if needed. It is created for AppendFormat because we don't know the final message length. But it can be also used in other similar situations.

func (*Encoder) SetEncoder

func (e *Encoder) SetEncoder(tp interface{}, encoder ValueEncoder)

type LowDecoder

type LowDecoder struct{}

func (LowDecoder) Break

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

func (LowDecoder) Bytes

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

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

func (d LowDecoder) SkipTag(b []byte, st int) (tag byte, sub int64, 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

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

type LowEncoder

type LowEncoder struct{}

func (LowEncoder) AppendArray

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

func (LowEncoder) AppendBool

func (e LowEncoder) AppendBool(b []byte, v bool) []byte

func (LowEncoder) AppendBreak

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

func (LowEncoder) AppendBytes

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

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

func (LowEncoder) AppendMap

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

func (LowEncoder) AppendNil

func (e LowEncoder) AppendNil(b []byte) []byte

func (LowEncoder) AppendNone

func (e LowEncoder) AppendNone(b []byte) []byte

func (LowEncoder) AppendSemantic

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

func (LowEncoder) AppendSpecial

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

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

func (LowEncoder) AppendTagBreak

func (e LowEncoder) AppendTagBreak(b []byte, tag byte) []byte

func (LowEncoder) AppendTagBytes

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

func (LowEncoder) AppendTagString

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

func (LowEncoder) AppendUint

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

func (LowEncoder) AppendUint64

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

func (LowEncoder) AppendUndefined

func (e LowEncoder) AppendUndefined(b []byte) []byte

func (LowEncoder) Tag64Size

func (e LowEncoder) Tag64Size(v uint64) int

func (LowEncoder) TagSize

func (e LowEncoder) TagSize(v int) int

type StreamDecoder

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

func NewStreamDecoder

func NewStreamDecoder(r io.Reader) *StreamDecoder

func (*StreamDecoder) Decode

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

func (*StreamDecoder) Read

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

func (*StreamDecoder) WriteTo

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

type TlogAppender

type TlogAppender interface {
	TlogAppend(b []byte) []byte
}

type ValueEncoder

type ValueEncoder func(e *Encoder, b []byte, val interface{}) []byte

Jump to

Keyboard shortcuts

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