godrv

package
v0.4.8-0...-185a669 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2012 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

MySQL driver for Go sql package

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDSN     = errors.New("Wrong URI")
	ErrMaxIdle = errors.New("Wrong max idle value")
)

Functions

func Register

func Register(query string)

Registers initialisation commands. This is workaround, see http://codereview.appspot.com/5706047

func RegisterFunc

func RegisterFunc(f mysql.RegFunc)

Registers initialisation functions.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func (*Driver) Open

func (d *Driver) Open(uri string) (driver.Conn, error)

Open new connection. The uri need to have the following syntax:

[tcp://addr/]dbname/user/password[?params]
[unix://sockpath/]dbname/user/password[?params]

Params need to have the following syntax:

key1=val1&key2=val2

Key need to have the following value:

charset - used by 'set names'
keepalive - send a PING to mysql server after every keepalive seconds.

where protocol spercific part may be empty (this means connection to local server using default protocol). Currently possible forms:

DBNAME/USER/PASSWD?charset=utf8
unix://SOCKPATH/DBNAME/USER/PASSWD
tcp://ADDR/DBNAME/USER/PASSWD?maxidle=3600

If a password contains the slashes (/), use a star (*) to repleace it. If a password contains the star (*), use double stars (**) to repleace it.

pass/wd => pass*wd
pass*wd => pass**wd

Jump to

Keyboard shortcuts

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