proto

package
v0.0.0-...-9a5932e Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2014 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VT_DECIMAL     = 0
	VT_TINY        = 1
	VT_SHORT       = 2
	VT_LONG        = 3
	VT_FLOAT       = 4
	VT_DOUBLE      = 5
	VT_NULL        = 6
	VT_TIMESTAMP   = 7
	VT_LONGLONG    = 8
	VT_INT24       = 9
	VT_DATE        = 10
	VT_TIME        = 11
	VT_DATETIME    = 12
	VT_YEAR        = 13
	VT_NEWDATE     = 14
	VT_VARCHAR     = 15
	VT_BIT         = 16
	VT_NEWDECIMAL  = 246
	VT_ENUM        = 247
	VT_SET         = 248
	VT_TINY_BLOB   = 249
	VT_MEDIUM_BLOB = 250
	VT_LONG_BLOB   = 251
	VT_BLOB        = 252
	VT_VAR_STRING  = 253
	VT_STRING      = 254
	VT_GEOMETRY    = 255
)

These numbers should exactly match values defined in dist/mysql-5.1.52/include/mysql/mysql_com.h

Variables

This section is empty.

Functions

func Convert

func Convert(mysqlType int64, val sqltypes.Value) (interface{}, error)

Convert takes a type and a value, and returns the type:

  • nil for NULL value
  • int64 for integer number types that fit in 64 bits (signed or unsigned are all converted to signed)
  • float64 for floating point values that fit in a float
  • []byte for everything else

func DecodeRowBson

func DecodeRowBson(buf *bytes.Buffer, kind byte) []sqltypes.Value

func DecodeRowsBson

func DecodeRowsBson(buf *bytes.Buffer, kind byte) [][]sqltypes.Value

func EncodeFieldsBson

func EncodeFieldsBson(fields []Field, key string, buf *bytes2.ChunkedWriter)

func EncodeRowBson

func EncodeRowBson(row []sqltypes.Value, key string, buf *bytes2.ChunkedWriter)

func EncodeRowsBson

func EncodeRowsBson(rows [][]sqltypes.Value, key string, buf *bytes2.ChunkedWriter)

func MarshalFieldBson

func MarshalFieldBson(field Field, key string, buf *bytes2.ChunkedWriter)

func UnmarshalFieldBson

func UnmarshalFieldBson(field *Field, buf *bytes.Buffer)

Types

type Field

type Field struct {
	Name string
	Type int64
}

Field described a column returned by mysql

func DecodeFieldsBson

func DecodeFieldsBson(buf *bytes.Buffer, kind byte) []Field

type QueryResult

type QueryResult struct {
	Fields       []Field
	RowsAffected uint64
	InsertId     uint64
	Rows         [][]sqltypes.Value
}

QueryResult is the structure returned by the mysql library. When transmitted over the wire, the Rows all come back as strings and lose their original sqltypes. use Fields.Type to convert them back if needed, using the following functions.

func (*QueryResult) MarshalBson

func (qr *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string)

func (*QueryResult) UnmarshalBson

func (qr *QueryResult) UnmarshalBson(buf *bytes.Buffer, kind byte)

Jump to

Keyboard shortcuts

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