proto

package
v0.0.0-...-3712671 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 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

Types

type Field

type Field struct {
	Name string
	Type int64
}

Field described a column returned by mysql

func (*Field) MarshalBson

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

MarshalBson bson-encodes Field.

func (*Field) UnmarshalBson

func (field *Field) UnmarshalBson(buf *bytes.Buffer, kind byte)

UnmarshalBson bson-decodes into 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 (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string)

MarshalBson bson-encodes QueryResult.

func (*QueryResult) UnmarshalBson

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

UnmarshalBson bson-decodes into QueryResult.

Jump to

Keyboard shortcuts

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