core

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQLTypeDecimal TableColumnType = iota
	MySQLTypeTiny
	MySQLTypeShort
	MySQLTypeLong
	MySQLTypeFloat
	MySQLTypeDouble
	MySQLTypeNull
	MySQLTypeTimestamp
	MySQLTypeLongLong
	MySQLTypeInt24
	MySQLTypeDate
	MySQLTypeTime
	MySQLTypeDatetime
	MySQLTypeYear
	MySQLTypeNewDate
	MySQLTypeVarchar
	MySQLTypeBit
	MySQLTypeTimestamp2
	MySQLTypeDatetime2
	MySQLTypeTime2
	MySQLTypeNewDecimal = iota + 0xe2
	MySQLTypeEnum
	MySQLTypeSet
	MySQLTypeTinyBlob
	MySQLTypeMediumBlob
	MySQLTypeLongBlob
	MySQLTypeBlob
	MySQLTypeVarString
	MySQLTypeString
	MySQLTypeGeometry
)

https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnType https://dev.mysql.com/doc/dev/mysql-server/latest/field__types_8h.html

View Source
const (
	ServerStatusInTrans            StatusFlag = 0x0001
	ServerStatusAutocommit                    = 0x0002
	ServerMoreResultsExists                   = 0x0008
	ServerStatusNoGoodIndexUsed               = 0x0010
	ServerStatusNoIndexUsed                   = 0x0020
	ServerStatusCursorExists                  = 0x0040
	ServerStatusLastRowSent                   = 0x0080
	ServerStatusDbDropped                     = 0x0100
	ServerStatusNoBackslashEscapes            = 0x0200
	ServerStatusMetadataChanged               = 0x0400
	ServerQueryWasSlow                        = 0x0800
	ServerPsOutParams                         = 0x1000
	ServerStatusInTransReadonly               = 0x2000
	ServerSessionStateChanged                 = 0x4000
)

TODO change to iota Status Flags: https://dev.mysql.com/doc/internals/en/status-flags.html

View Source
const (
	ComSleep            Command = 0x00
	ComQuit                     = 0x01
	ComInitDB                   = 0x02
	ComQuery                    = 0x03
	ComFieldList                = 0x04
	ComCreateDB                 = 0x05
	ComDropDB                   = 0x06
	ComRefresh                  = 0x07
	ComShutdown                 = 0x08
	ComStatistics               = 0x09
	ComProcessInfo              = 0x0a
	ComConnect                  = 0x0b
	ComProcessKill              = 0x0c
	ComDebug                    = 0x0d
	ComPing                     = 0x0e
	ComTime                     = 0x0f
	ComDelayedInsert            = 0x10
	ComChangeUser               = 0x11
	ComBinlogDump               = 0x12
	ComTableDump                = 0x13
	ComConnectOut               = 0x14
	ComRegisterSlave            = 0x15
	ComStmtPrepare              = 0x16
	ComStmtExecute              = 0x17
	ComStmtSendLongData         = 0x18
	ComStmtClose                = 0x19
	ComStmtReset                = 0x1a
	ComSetOption                = 0x1b
	ComStmtFetch                = 0x1c
	ComDaemon                   = 0x1d
	ComBinlogDumpGTID           = 0x1e
	ComResetConnection          = 0x1f
)

https://dev.mysql.com/doc/internals/en/command-phase.html

Variables

View Source
var (
	Utf8GeneralCi    = &Collation{33, "utf8", "utf8_general_ci"}
	Utf8mb4GeneralCi = &Collation{45, "utf8mb4", "utf8mb4_general_ci"}
	Utf8mb40900AiCi  = &Collation{255, "utf8mb4", "utf8mb4_0900_ai_ci"}
	Binary           = &Collation{63, "binary", "binary"}
)

TODO more collations https://dev.mysql.com/doc/internals/en/character-set.html#packet-Protocol::CharacterSet

View Source
var CollationIds = map[uint8]*Collation{
	33:  Utf8GeneralCi,
	45:  Utf8mb4GeneralCi,
	255: Utf8mb40900AiCi,
	63:  Binary,
}
View Source
var Collations = map[string]*Collation{
	"utf8_general_ci":    Utf8GeneralCi,
	"utf8mb4_general_ci": Utf8mb4GeneralCi,
	"utf8mb4_0900_ai_ci": Utf8mb40900AiCi,
	"binary":             Binary,
}

Functions

func EncryptPassword

func EncryptPassword(plugin AuthenticationPlugin, password, salt []byte) ([]byte, error)

Types

type AuthenticationPlugin

type AuthenticationPlugin uint8
const (
	MySQLNativePasswordPlugin AuthenticationPlugin = iota
	CachingSHA2PasswordPlugin
)

func ParseAuthenticationPlugin

func ParseAuthenticationPlugin(name string) (AuthenticationPlugin, error)

func (AuthenticationPlugin) String

func (p AuthenticationPlugin) String() string

type CapabilityFlag

type CapabilityFlag uint32
const (
	ClientLongPassword CapabilityFlag = 1 << iota
	ClientFoundRows
	ClientLongFlag
	ClientConnectWithDB
	ClientNoSchema
	ClientCompress
	ClientODBC
	ClientLocalFiles
	ClientIgnoreSpace
	ClientProtocol41
	ClientInteractive
	ClientSSL
	ClientIgnoreSigpipe
	ClientTransactions
	ClientReserved
	ClientSecureConnection
	ClientMultiStatements
	ClientMultiResults
	ClientPsMultiResults
	ClientPluginAuth
	ClientConnectAttrs
	ClientPluginAuthLenencClientData
	ClientCanHandleExpiredPasswords
	ClientSessionTrack
	ClientDeprecateEOF
)

func (CapabilityFlag) String

func (c CapabilityFlag) String() string

type Code

type Code uint16
const (
	ErrNo                Code = 1002
	ErrYes               Code = 1003
	ErrAccessDeniedError Code = 1045

	Err Code = 50000
)

TODO https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html

type Collation

type Collation struct {
	Id            uint8
	CharSetName   string
	CollationName string
}

type ColumnDefinitionFlag

type ColumnDefinitionFlag uint16
const (
	NotNullFlag ColumnDefinitionFlag = 1 << iota
	PriKeyFlag
	UniqueKeyFlag
	MultipleKeyFlag
	BlobFlag
	UnsignedFlag
	ZerofillFlag
	BinaryFlag
	EnumFlag
	AutoIncrementFlag
	TimestampFlag
	SetFlag
)

Column Definition Flags: https://dev.mysql.com/doc/dev/mysql-server/latest/group__group__cs__column__definition__flags.html

func (ColumnDefinitionFlag) String

func (cd ColumnDefinitionFlag) String() string

type Command

type Command uint8

func (Command) String

func (c Command) String() string

type StatusFlag

type StatusFlag uint16

func (StatusFlag) String

func (s StatusFlag) String() string

type TableColumnType

type TableColumnType uint8

func (TableColumnType) String

func (t TableColumnType) String() string

Jump to

Keyboard shortcuts

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