Documentation ¶
Index ¶
- Constants
- Variables
- func Distro(distro string) string
- func FormatError(err error) string
- func MySQLErrorCode(err error) uint16
- type Connection
- func (c *Connection) AtLeastVersion(minVersion string) (bool, error)
- func (c *Connection) Close()
- func (c *Connection) Connect() error
- func (c *Connection) DB() *sql.DB
- func (c *Connection) DSN() string
- func (c *Connection) Exec(queries []string) error
- func (c *Connection) GetGlobalVarBoolean(varName string) (varValue sql.NullBool, err error)
- func (c *Connection) GetGlobalVarInteger(varName string) (varValue sql.NullInt64, err error)
- func (c *Connection) GetGlobalVarNumeric(varName string) (varValue sql.NullFloat64, err error)
- func (c *Connection) GetGlobalVarString(varName string) (varValue sql.NullString, err error)
- func (c *Connection) Set(queries []Query) error
- func (c *Connection) UTCOffset() (time.Duration, time.Duration, error)
- func (c *Connection) Uptime() (uptime int64, err error)
- func (c *Connection) VersionConstraint(constraint string) (bool, error)
- type ConnectionFactory
- type Connector
- type Query
- type RealConnectionFactory
Constants ¶
View Source
const ( ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227 ER_SYNTAX_ERROR = 1064 ER_USER_DENIED = 1142 )
MySQL error codes
Variables ¶
View Source
var (
ErrNotConnected = errors.New("not connected")
)
Functions ¶
func FormatError ¶
func MySQLErrorCode ¶
Types ¶
type Connection ¶
func NewConnection ¶
func NewConnection(dsn string) *Connection
func (*Connection) AtLeastVersion ¶
func (c *Connection) AtLeastVersion(minVersion string) (bool, error)
Check if version v2 is equal or higher than v1 (v2 >= v1) v2 can be in form m.n.o-ubuntu
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) Connect ¶
func (c *Connection) Connect() error
func (*Connection) DB ¶
func (c *Connection) DB() *sql.DB
func (*Connection) DSN ¶
func (c *Connection) DSN() string
func (*Connection) Exec ¶
func (c *Connection) Exec(queries []string) error
func (*Connection) GetGlobalVarBoolean ¶ added in v1.5.0
func (c *Connection) GetGlobalVarBoolean(varName string) (varValue sql.NullBool, err error)
func (*Connection) GetGlobalVarInteger ¶ added in v1.5.0
func (c *Connection) GetGlobalVarInteger(varName string) (varValue sql.NullInt64, err error)
func (*Connection) GetGlobalVarNumeric ¶ added in v1.5.0
func (c *Connection) GetGlobalVarNumeric(varName string) (varValue sql.NullFloat64, err error)
func (*Connection) GetGlobalVarString ¶
func (c *Connection) GetGlobalVarString(varName string) (varValue sql.NullString, err error)
func (*Connection) Set ¶
func (c *Connection) Set(queries []Query) error
func (*Connection) Uptime ¶
func (c *Connection) Uptime() (uptime int64, err error)
func (*Connection) VersionConstraint ¶ added in v1.5.0
func (c *Connection) VersionConstraint(constraint string) (bool, error)
VersionConstraint checks if version fits given constraint
type ConnectionFactory ¶
type Connector ¶
type Connector interface { VersionConstraint(constraint string) (bool, error) AtLeastVersion(string) (bool, error) Connect() error Close() DB() *sql.DB DSN() string Exec([]string) error GetGlobalVarBoolean(varName string) (varValue sql.NullBool, err error) GetGlobalVarString(varName string) (varValue sql.NullString, err error) GetGlobalVarNumeric(varName string) (varValue sql.NullFloat64, err error) GetGlobalVarInteger(varName string) (varValue sql.NullInt64, err error) Set([]Query) error Uptime() (uptime int64, err error) UTCOffset() (time.Duration, time.Duration, error) }
type RealConnectionFactory ¶
type RealConnectionFactory struct { }
func (*RealConnectionFactory) Make ¶
func (f *RealConnectionFactory) Make(dsn string) Connector
Click to show internal directories.
Click to hide internal directories.