Documentation ¶
Index ¶
- Constants
- func Convert(mysqlType int64, val sqltypes.Value) (interface{}, error)
- func DecodeRowBson(buf *bytes.Buffer, kind byte) []sqltypes.Value
- func DecodeRowsBson(buf *bytes.Buffer, kind byte) [][]sqltypes.Value
- func EncodeFieldsBson(fields []Field, key string, buf *bytes2.ChunkedWriter)
- func EncodeRowBson(row []sqltypes.Value, key string, buf *bytes2.ChunkedWriter)
- func EncodeRowsBson(rows [][]sqltypes.Value, key string, buf *bytes2.ChunkedWriter)
- func MarshalFieldBson(field Field, key string, buf *bytes2.ChunkedWriter)
- func UnmarshalFieldBson(field *Field, buf *bytes.Buffer)
- type Field
- type QueryResult
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 ¶
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 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 ¶
Types ¶
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)
Click to show internal directories.
Click to hide internal directories.