Documentation ¶
Overview ¶
Package encoding implements hdb field type en,- and decodings.
Index ¶
- Constants
- func VarFieldSize(size int) int
- type Decoder
- func (d *Decoder) Bool() bool
- func (d *Decoder) Byte() byte
- func (d *Decoder) Bytes(p []byte)
- func (d *Decoder) CESU8Bytes(size int) ([]byte, error)
- func (d *Decoder) CESU8LIBytes() (int, []byte, error)
- func (d *Decoder) CESU8LIString() (int, string, error)
- func (d *Decoder) Cnt() int
- func (d *Decoder) Decimal() (*big.Int, int, error)
- func (d *Decoder) Dfv() int
- func (d *Decoder) Error() error
- func (d *Decoder) Fixed(size int) *big.Int
- func (d *Decoder) Float32() float32
- func (d *Decoder) Float64() float64
- func (d *Decoder) Int16() int16
- func (d *Decoder) Int32() int32
- func (d *Decoder) Int64() int64
- func (d *Decoder) Int8() int8
- func (d *Decoder) LIBytes() (n int, b []byte)
- func (d *Decoder) LIString() (n int, s string)
- func (d *Decoder) ResetCnt()
- func (d *Decoder) ResetError() error
- func (d *Decoder) SetDfv(dfv int)
- func (d *Decoder) Skip(cnt int)
- func (d *Decoder) Uint16() uint16
- func (d *Decoder) Uint16ByteOrder(byteOrder binary.ByteOrder) uint16
- func (d *Decoder) Uint32() uint32
- func (d *Decoder) Uint32ByteOrder(byteOrder binary.ByteOrder) uint32
- func (d *Decoder) Uint64() uint64
- type Encoder
- func (e *Encoder) Bool(v bool)
- func (e *Encoder) Byte(b byte)
- func (e *Encoder) Bytes(p []byte)
- func (e *Encoder) CESU8Bytes(p []byte) (int, error)
- func (e *Encoder) CESU8LIBytes(p []byte) error
- func (e *Encoder) CESU8LIString(s string) error
- func (e *Encoder) CESU8String(s string) (int, error)
- func (e *Encoder) Decimal(m *big.Int, exp int)
- func (e *Encoder) Fixed(m *big.Int, size int)
- func (e *Encoder) Float32(f float32)
- func (e *Encoder) Float64(f float64)
- func (e *Encoder) Int16(i int16)
- func (e *Encoder) Int32(i int32)
- func (e *Encoder) Int64(i int64)
- func (e *Encoder) Int8(i int8)
- func (e *Encoder) LIBytes(p []byte) error
- func (e *Encoder) LIString(s string) error
- func (e *Encoder) String(s string)
- func (e *Encoder) Uint16(i uint16)
- func (e *Encoder) Uint16ByteOrder(i uint16, byteOrder binary.ByteOrder)
- func (e *Encoder) Uint32(i uint32)
- func (e *Encoder) Uint64(i uint64)
- func (e *Encoder) Zeroes(cnt int)
Constants ¶
const ( BooleanFieldSize = 1 TinyintFieldSize = 1 SmallintFieldSize = 2 IntegerFieldSize = 4 BigintFieldSize = 8 RealFieldSize = 4 DoubleFieldSize = 8 DateFieldSize = 4 TimeFieldSize = 4 TimestampFieldSize = DateFieldSize + TimeFieldSize LongdateFieldSize = 8 SeconddateFieldSize = 8 DaydateFieldSize = 4 SecondtimeFieldSize = 4 DecimalFieldSize = 16 Fixed8FieldSize = 8 Fixed12FieldSize = 12 Fixed16FieldSize = 16 )
Filed size constants.
Variables ¶
This section is empty.
Functions ¶
func VarFieldSize ¶ added in v0.107.4
VarFieldSize returns the size of a varible field variable ([]byte, string and unicode variants).
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes hdb protocol datatypes an basis of an io.Reader.
func NewDecoder ¶
func NewDecoder(rd io.Reader, decoder func() transform.Transformer) *Decoder
NewDecoder creates a new Decoder instance based on an io.Reader.
func (*Decoder) CESU8Bytes ¶
CESU8Bytes decodes CESU-8 into UTF-8 bytes. - error is only returned in case of conversion errors.
func (*Decoder) CESU8LIBytes ¶ added in v0.107.3
CESU8LIBytes decodes CESU-8 into UTF-8 bytes with length indicator.
func (*Decoder) CESU8LIString ¶ added in v0.107.3
CESU8LIString decodes a CESU-8 into a UTF-8 string with length indicator.
func (*Decoder) Decimal ¶
Decimal decodes a decimal. - error is only returned in case of conversion errors.
func (*Decoder) ResetError ¶
ResetError return and resets reader error.
func (*Decoder) Uint16ByteOrder ¶ added in v0.107.0
Uint16ByteOrder decodes an uint16 in given byte order.
func (*Decoder) Uint32ByteOrder ¶
Uint32ByteOrder decodes an uint32 in given byte order.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes hdb protocol datatypes an basis of an io.Writer.
func NewEncoder ¶
func NewEncoder(wr io.Writer, encoder func() transform.Transformer) *Encoder
NewEncoder creates a new Encoder instance.
func (*Encoder) CESU8Bytes ¶
CESU8Bytes encodes UTF-8 bytes into CESU-8 and returns the CESU-8 bytes written.
func (*Encoder) CESU8LIBytes ¶ added in v0.107.3
CESU8LIBytes encodes UTF-8 into CESU-8 bytes with length indicator.
func (*Encoder) CESU8LIString ¶ added in v0.107.3
CESU8LIString encodes an UTF-8 into a CESU-8 string with length indicator.
func (*Encoder) CESU8String ¶
CESU8String encodes an UTF-8 string into CESU-8 and returns the CESU-8 bytes written.
func (*Encoder) Uint16ByteOrder ¶ added in v0.107.0
Uint16ByteOrder encodes an uint16 in given byte order.