Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToDate(b []byte) (time.Time, error)
- func BytesToDatetime(b []byte) (time.Time, error)
- func BytesToDuration(b []byte) (time.Duration, error)
- func BytesToFloat4(b []byte) (float32, error)
- func BytesToFloat8(b []byte) (float64, error)
- func BytesToInt1(b []byte) (int8, error)
- func BytesToInt2(b []byte) (int16, error)
- func BytesToInt3(b []byte) (int32, error)
- func BytesToInt4(b []byte) (int32, error)
- func BytesToInt8(b []byte) (int64, error)
- func BytesToTime(b []byte) (time.Time, error)
- func BytesToUint1(b []byte) (uint8, error)
- func BytesToUint2(b []byte) (uint16, error)
- func BytesToUint3(b []byte) (uint32, error)
- func BytesToUint4(b []byte) (uint32, error)
- func BytesToUint8(b []byte) (uint64, error)
- func DurationToTimeBytes(d time.Duration) []byte
- func Float4ToBytes(v float32) []byte
- func Float8ToBytes(v float64) []byte
- func Int1ToBytes(v int8) []byte
- func Int2ToBytes(v int16) []byte
- func Int3ToBytes(v int32) []byte
- func Int4ToBytes(v int32) []byte
- func Int8ToBytes(v int64) []byte
- func LengthEncodeIntSize(v uint64) int
- func LengthEncodedStringToString(s string) []byte
- func TimeToDateBytes(t time.Time) []byte
- func TimeToDatetimeBytes(t time.Time) []byte
- func Uint1ToBytes(v uint8) []byte
- func Uint2ToBytes(v uint16) []byte
- func Uint3ToBytes(v uint32) []byte
- func Uint4ToBytes(v uint32) []byte
- func Uint8ToBytes(v uint64) []byte
- type Reader
- func (reader *Reader) PeekByte() (uint8, error)
- func (reader *Reader) PeekBytes(n int) ([]byte, error)
- func (reader *Reader) PeekInt1() (uint8, error)
- func (reader *Reader) PeekInt2() (uint16, error)
- func (reader *Reader) PeekInt4() (uint32, error)
- func (reader *Reader) ReadByte() (byte, error)
- func (reader *Reader) ReadBytes(buf []byte) (int, error)
- func (reader *Reader) ReadBytesUntil(delim byte) ([]byte, error)
- func (reader *Reader) ReadEOFTerminatedString() (string, error)
- func (reader *Reader) ReadFixedLengthBytes(n int) ([]byte, error)
- func (reader *Reader) ReadFixedLengthString(n int) (string, error)
- func (reader *Reader) ReadInt1() (uint8, error)
- func (reader *Reader) ReadInt2() (uint16, error)
- func (reader *Reader) ReadInt3() (uint32, error)
- func (reader *Reader) ReadInt4() (uint32, error)
- func (reader *Reader) ReadInt8() (uint64, error)
- func (reader *Reader) ReadLengthEncodedBytes() ([]byte, error)
- func (reader *Reader) ReadLengthEncodedInt() (uint64, error)
- func (reader *Reader) ReadLengthEncodedString() (string, error)
- func (reader *Reader) ReadNBytes(n int) ([]byte, error)
- func (reader *Reader) ReadNullTerminatedBytes() ([]byte, error)
- func (reader *Reader) ReadNullTerminatedString() (string, error)
- func (reader *Reader) ReadTextResultsetRowString() (*string, error)
- func (reader *Reader) ReadVariableLengthString(n int) (string, error)
- func (reader *Reader) SkipBytes(n int) error
- type Writer
- func (w *Writer) Bytes() []byte
- func (w *Writer) WriteByte(b byte) error
- func (w *Writer) WriteBytes(b []byte) (int, error)
- func (w *Writer) WriteEOFTerminatedString(s string) error
- func (w *Writer) WriteFixedLengthBytes(b []byte, n int) error
- func (w *Writer) WriteFixedLengthNullBytes(n int) error
- func (w *Writer) WriteFixedLengthString(s string, n int) error
- func (w *Writer) WriteInt1(v uint8) error
- func (w *Writer) WriteInt2(v uint16) error
- func (w *Writer) WriteInt3(v uint32) error
- func (w *Writer) WriteInt4(v uint32) error
- func (w *Writer) WriteInt8(v uint64) error
- func (w *Writer) WriteLengthEncodedBytes(b []byte) error
- func (w *Writer) WriteLengthEncodedInt(v uint64) error
- func (w *Writer) WriteLengthEncodedString(s string) error
- func (w *Writer) WriteNullString() error
- func (w *Writer) WriteNullTerminatedBytes(b []byte) error
- func (w *Writer) WriteNullTerminatedString(s string) error
- func (w *Writer) WriteTextResultsetRowString(s *string) error
Constants ¶
const NullString = 0xFB
MySQL: Text Resultset Row https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_query_response_text_resultset_row.html NULL is sent as 0xFB
Variables ¶
var ErrInvalid = errors.New("invalid")
ErrInvalid is returned when an invalid value is encountered.
var ErrNull = errors.New("null")
ErrNull is returned when a null value is encountered.
Functions ¶
func BytesToDate ¶
BytesToDate converts a date byte slice to a time.Time.
func BytesToDatetime ¶
BytesToDatetime converts a datetime byte slice to a time.Time.
func BytesToDuration ¶
BytesToTime converts a byte slice to a time.Time.
func BytesToFloat4 ¶
BytesToFloat4 converts the specified byte array to a float32.
func BytesToFloat8 ¶
BytesToFloat8 converts the specified byte array to a float64.
func BytesToInt1 ¶
BytesToInt1 converts the specified byte array to an integer.
func BytesToInt2 ¶
BytesToInt2 converts the specified byte array to an integer.
func BytesToInt3 ¶
BytesToInt3 converts the specified byte array to an integer.
func BytesToInt4 ¶
BytesToInt4 converts the specified byte array to an integer.
func BytesToInt8 ¶
BytesToInt8 converts the specified byte array to an integer.
func BytesToTime ¶
BytesToTime converts a byte slice to a time.Time.
func BytesToUint1 ¶
BytesToUint8 converts the specified byte array to an integer.
func BytesToUint2 ¶
BytesToUint2 converts the specified byte array to an integer.
func BytesToUint3 ¶
BytesToUint3 converts the specified byte array to an integer.
func BytesToUint4 ¶
BytesToUint4 converts the specified byte array to an integer.
func BytesToUint8 ¶
BytesToUint8 converts the specified byte array to an integer.
func DurationToTimeBytes ¶
TimeToDatetimeBytes converts a time.Time to a datetime byte slice.
func Float4ToBytes ¶
Float4ToBytes converts the specified float32 to a byte array.
func Float8ToBytes ¶
Float8ToBytes converts the specified float64 to a byte array.
func Int1ToBytes ¶
Int1ToBytes converts the specified integer to a byte array.
func Int2ToBytes ¶
Int2ToBytes converts the specified integer to a byte array.
func Int3ToBytes ¶
Int3ToBytes converts the specified integer to a byte array.
func Int4ToBytes ¶
Int4ToBytes converts the specified integer to a byte array.
func Int8ToBytes ¶
Int8ToBytes converts the specified integer to a byte array.
func LengthEncodeIntSize ¶
LengthEncodeIntSize returns the size of a length encoded integer.
func TimeToDateBytes ¶
TimeToDatetimeBytes converts a time.Time to a datetime byte slice.
func TimeToDatetimeBytes ¶
TimeToDatetimeBytes converts a time.Time to a datetime byte slice.
func Uint1ToBytes ¶
Uint1ToBytes converts the specified integer to a byte array.
func Uint2ToBytes ¶
Uint2ToBytes converts the specified integer to a byte array.
func Uint3ToBytes ¶
Uint3ToBytes converts the specified integer to a byte array.
func Uint4ToBytes ¶
Uint4ToBytes converts the specified integer to a byte array.
func Uint8ToBytes ¶
Uint8ToBytes converts the specified integer to a byte array.
Types ¶
type Reader ¶
Reader represents a packet reader.
func NewReaderWithBytes ¶
NewReaderWithBytes returns a new packet reader with the specified byte array.
func NewReaderWithReader ¶
NewReaderWithReader returns a new packet reader with the specified reader.
func (*Reader) ReadBytesUntil ¶
ReadBytesUntil reads a byte array until the specified delimiter.
func (*Reader) ReadEOFTerminatedString ¶
ReadEOFTerminatedString reads a string until EOF.
func (*Reader) ReadFixedLengthBytes ¶
ReadFixedLengthBytes reads a fixed bytes.
func (*Reader) ReadFixedLengthString ¶
ReadFixedLengthString reads a fixd string.
func (*Reader) ReadLengthEncodedBytes ¶
ReadLengthEncodedBytes reads a length encoded bytes.
func (*Reader) ReadLengthEncodedInt ¶
ReadLengthEncodedInt reads a length encoded integer.
func (*Reader) ReadLengthEncodedString ¶
ReadLengthEncodedInt reads a length encoded integer.
func (*Reader) ReadNBytes ¶
ReadNBytes reads the specified number of bytes.
func (*Reader) ReadNullTerminatedBytes ¶
ReadNullTerminatedString reads a string until NULL.
func (*Reader) ReadNullTerminatedString ¶
ReadNullTerminatedString reads a string until NULL.
func (*Reader) ReadTextResultsetRowString ¶ added in v1.3.1
ReadTextResultsetRowString reads a string from the result set row.
func (*Reader) ReadVariableLengthString ¶
ReadVariableLengthString reads a string.
type Writer ¶
func (*Writer) WriteBytes ¶
WriteBytes writes a byte array.
func (*Writer) WriteEOFTerminatedString ¶
WriteEOFTerminatedString writes a EOF terminated string.
func (*Writer) WriteFixedLengthBytes ¶
WriteFixedLengthString writes a fixed length bytes.
func (*Writer) WriteFixedLengthNullBytes ¶
WriteFixedLengthNullBytes writes a fixed length null bytes.
func (*Writer) WriteFixedLengthString ¶
WriteFixedLengthString writes a fixed length string.
func (*Writer) WriteLengthEncodedBytes ¶
WriteLengthEncodedBytes writes a length encoded bytes.
func (*Writer) WriteLengthEncodedInt ¶
WriteLengthEncodedInt writes a length encoded integer.
func (*Writer) WriteLengthEncodedString ¶
WriteLengthEncodedString writes a length encoded string.
func (*Writer) WriteNullString ¶ added in v1.3.1
WriteNullString writes a NULL string (0xFB) to the writer.
func (*Writer) WriteNullTerminatedBytes ¶
WriteNullTerminatedBytes writes a null terminated bytes.
func (*Writer) WriteNullTerminatedString ¶
WriteNullTerminatedString writes a null terminated string.
func (*Writer) WriteTextResultsetRowString ¶ added in v1.3.1
WriteTextResultsetRow writes a text resultset row.