bpl

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NIL nil or null type identifier
	NIL = 0xc0
	// FALSE is a Bool type identifier
	FALSE = 0xc2
	// TRUE is a Bool type identifier
	TRUE = 0xc3
	//BIN16 is byte array type identifier
	BIN16 = 0xc5
	//EXT16 is extension type identifier
	EXT16 = 0xc8
	//UINT8 is uint8 type identifier
	UINT8 = 0xcc
	//UINT16 is uint16 type identifier
	UINT16 = 0xcd
	//UINT32 is uint32 type identifier
	UINT32 = 0xce
	//UINT64 is uint64 type identifier
	UINT64 = 0xcf
	//STR16 is string type identifier
	STR16 = 0xda
	//ARRAY16 is array size type identifier
	ARRAY16 = 0xdc
)
View Source
const (
	//NEGFIXNUM is negfix maxnum
	NEGFIXNUM = 0xe0
	//FIXMAPMAX is fixmap maxnum
	FIXMAPMAX = 0x8f
	//FIXARRAYMAX is fixarray maxnum
	FIXARRAYMAX = 0x9f
	//FIXRAWMAX is fix raw max
	FIXRAWMAX = 0xbf
	//FIRSTBYTEMASK is first byte mask
	FIRSTBYTEMASK = 0xf
)
View Source
const (
	EXT_BIGINT = 1
)

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader, v interface{}, stopField string) error

Decode decodes byte stream to struct, slice/array or other basic types

func Encode

func Encode(v interface{}, w io.Writer) error

Encode encodes struct, ptr, slice/array and basic types to byte stream

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal is to serialize the message

func PackArraySize

func PackArraySize(writer io.Writer, length uint16) (n int, err error)

PackArraySize is to pack a array size header.

func PackBin16

func PackBin16(writer io.Writer, value []byte) (n int, err error)

PackBin16 is to pack a byte array.

func PackBool

func PackBool(writer io.Writer, value bool) (n int, err error)

PackBool pack a bool value.

func PackExt16

func PackExt16(writer io.Writer, t byte, value []byte) (n int, err error)

PackExt16 is to pack a extension type.

func PackNil

func PackNil(writer io.Writer) (n int, err error)

PackNil pack a nil type

func PackStr16

func PackStr16(writer io.Writer, value string) (n int, err error)

PackStr16 is to pack a string.

func PackUint8

func PackUint8(writer io.Writer, value uint8) (n int, err error)

PackUint8 is to pack a uint8.

func PackUint16

func PackUint16(writer io.Writer, value uint16) (n int, err error)

PackUint16 is to pack a uint16

func PackUint32

func PackUint32(writer io.Writer, value uint32) (n int, err error)

PackUint32 is to pack a uint32.

func PackUint64

func PackUint64(writer io.Writer, value uint64) (n int, err error)

PackUint64 is to pack a uint64.

func ReadByte

func ReadByte(reader io.Reader) (v uint8, err error)

func ReadUint16

func ReadUint16(reader io.Reader) (v uint16, n int, err error)

func ReadUint32

func ReadUint32(reader io.Reader) (v uint32, n int, err error)

func ReadUint64

func ReadUint64(reader io.Reader) (v uint64, n int, err error)

func SetIgnoreRule

func SetIgnoreRule(structName string, rule IgnoreRule)

func TryUnpackNil

func TryUnpackNil(reader io.Reader) (suc bool, err error)

UnpackBool is to unpack message

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal is to unserialize the message

func UnmarshalUntilField

func UnmarshalUntilField(data []byte, v interface{}, stopField string) error

unserialize the message until stopField

func UnpackArraySize

func UnpackArraySize(reader io.Reader) (size uint16, err error)

UnpackArraySize is to unpack message

func UnpackBin16

func UnpackBin16(reader io.Reader) ([]byte, error)

UnpackBin16 is to unpack message

func UnpackBool

func UnpackBool(reader io.Reader) (v bool, err error)

UnpackBool is to unpack message

func UnpackExt16

func UnpackExt16(reader io.Reader) ([]byte, byte, error)

func UnpackStr16

func UnpackStr16(reader io.Reader) (string, error)

UnpackStr16 is to unpack message

func UnpackUint8

func UnpackUint8(reader io.Reader) (v uint8, err error)

UnpackUint8 is to unpack message

func UnpackUint16

func UnpackUint16(reader io.Reader) (v uint16, err error)

UnpackUint16 is to unpack message

func UnpackUint32

func UnpackUint32(reader io.Reader) (v uint32, err error)

UnpackUint32 is to unpack message

func UnpackUint64

func UnpackUint64(reader io.Reader) (v uint64, err error)

UnpackUint64 is to unpack message

Types

type Bytes

type Bytes []byte

Bytes is []byte type

type Bytes1

type Bytes1 [1]byte

Bytes1 is first

type Bytes2

type Bytes2 [2]byte

Bytes2 is second

type Bytes4

type Bytes4 [4]byte

Bytes4 is third

type Bytes8

type Bytes8 [8]byte

Bytes8 is forth

type DecodeContext

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

type Decoder

type Decoder interface {
	DecodeBPL(io.Reader) error
}

Decoder interface for customization

type DecoderReader

type DecoderReader func(reflect.Value, *DecodeContext) error

DecoderReader function type of the decoder

type EncodeContext

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

type EncodeWriter

type EncodeWriter func(reflect.Value, io.Writer, *EncodeContext) error

EncodeWriter function type of the encoder

type Encoder

type Encoder interface {
	EncodeBPL(io.Writer) error
}

Encoder interface for customization

type IgnoreRule

type IgnoreRule func(reflect.StructField, int, interface{}, interface{}) bool

ignore field rule, params:field, index of field in struct, cur struct value(e.g. Header), top struct value(e.g. Block)

Jump to

Keyboard shortcuts

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