polyglot

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

polyglot-go

Go library used for encoding and decoding data types from a portable byte buffer, used in fRPC

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/loopholelabs/polyglot-go. For more contribution information check out the contribution guide.

License

The Polyglot project is available as open source under the terms of the Apache License, Version 2.0.

Code of Conduct

Everyone interacting in the Polyglot project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the CNCF Code of Conduct.

Project Managed By:

Documentation

Index

Constants

View Source
const (
	VarIntLen16 = 3
	VarIntLen32 = 5
	VarIntLen64 = 10
)

Variables

View Source
var (
	InvalidSlice   = errors.New("invalid slice encoding")
	InvalidMap     = errors.New("invalid map encoding")
	InvalidBytes   = errors.New("invalid bytes encoding")
	InvalidString  = errors.New("invalid string encoding")
	InvalidError   = errors.New("invalid error encoding")
	InvalidBool    = errors.New("invalid bool encoding")
	InvalidUint8   = errors.New("invalid uint8 encoding")
	InvalidUint16  = errors.New("invalid uint16 encoding")
	InvalidUint32  = errors.New("invalid uint32 encoding")
	InvalidUint64  = errors.New("invalid uint64 encoding")
	InvalidInt32   = errors.New("invalid int32 encoding")
	InvalidInt64   = errors.New("invalid int64 encoding")
	InvalidFloat32 = errors.New("invalid float32 encoding")
	InvalidFloat64 = errors.New("invalid float64 encoding")
)
View Source
var (
	NilKind     = Kind([]byte{0})
	SliceKind   = Kind([]byte{1})
	MapKind     = Kind([]byte{2})
	AnyKind     = Kind([]byte{3})
	BytesKind   = Kind([]byte{4})
	StringKind  = Kind([]byte{5})
	ErrorKind   = Kind([]byte{6})
	BoolKind    = Kind([]byte{7})
	Uint8Kind   = Kind([]byte{8})
	Uint16Kind  = Kind([]byte{9})
	Uint32Kind  = Kind([]byte{10})
	Uint64Kind  = Kind([]byte{11})
	Int32Kind   = Kind([]byte{12})
	Int64Kind   = Kind([]byte{13})
	Float32Kind = Kind([]byte{14})
	Float64Kind = Kind([]byte{15})
)

Functions

func Encoder

func Encoder(b *Buffer) *encoder

func PutBuffer added in v0.3.0

func PutBuffer(b *Buffer)

func ReturnDecoder

func ReturnDecoder(d *Decoder)

Types

type Buffer added in v0.2.0

type Buffer []byte

func GetBuffer added in v0.3.0

func GetBuffer() *Buffer

func NewBuffer added in v0.2.0

func NewBuffer() *Buffer

func (*Buffer) Bytes added in v0.4.1

func (buf *Buffer) Bytes() []byte

func (*Buffer) Len added in v0.4.1

func (buf *Buffer) Len() int

func (*Buffer) Reset added in v0.2.0

func (buf *Buffer) Reset()

func (*Buffer) Write added in v0.2.0

func (buf *Buffer) Write(b []byte) int

type Decoder

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

func GetDecoder

func GetDecoder(b []byte) (d *Decoder)

func (*Decoder) Bool

func (d *Decoder) Bool() (value bool, err error)

func (*Decoder) Bytes

func (d *Decoder) Bytes(b []byte) (value []byte, err error)

func (*Decoder) Error

func (d *Decoder) Error() (value, err error)

func (*Decoder) Float32

func (d *Decoder) Float32() (value float32, err error)

func (*Decoder) Float64

func (d *Decoder) Float64() (value float64, err error)

func (*Decoder) Int32

func (d *Decoder) Int32() (value int32, err error)

func (*Decoder) Int64

func (d *Decoder) Int64() (value int64, err error)

func (*Decoder) Map

func (d *Decoder) Map(keyKind, valueKind Kind) (size uint32, err error)

func (*Decoder) Nil

func (d *Decoder) Nil() (value bool)

func (*Decoder) Return

func (d *Decoder) Return()

func (*Decoder) Slice

func (d *Decoder) Slice(kind Kind) (size uint32, err error)

func (*Decoder) String

func (d *Decoder) String() (value string, err error)

func (*Decoder) Uint16

func (d *Decoder) Uint16() (value uint16, err error)

func (*Decoder) Uint32

func (d *Decoder) Uint32() (value uint32, err error)

func (*Decoder) Uint64

func (d *Decoder) Uint64() (value uint64, err error)

func (*Decoder) Uint8

func (d *Decoder) Uint8() (value uint8, err error)

type Error

type Error string

func (Error) Error

func (e Error) Error() string

func (Error) Is

func (e Error) Is(err error) bool

type Kind

type Kind []byte

type Pool added in v0.3.0

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

func NewPool added in v0.3.0

func NewPool() *Pool

func (*Pool) Get added in v0.3.0

func (p *Pool) Get() (b *Buffer)

func (*Pool) Put added in v0.3.0

func (p *Pool) Put(b *Buffer)

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

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