Documentation ¶
Overview ¶
Package mysql implements gdb.Driver, which supports operations for database MySQL.
Index ¶
- func New() gdb.Driver
- type Driver
- func (d *Driver) DoFilter(ctx context.Context, link gdb.Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error)
- func (d *Driver) GetChars() (charLeft string, charRight string)
- func (d *Driver) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error)
- func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error)
- func (d *Driver) TableFields(ctx context.Context, table string, schema ...string) (fields map[string]*gdb.TableField, err error)
- func (d *Driver) Tables(ctx context.Context, schema ...string) (tables []string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
Driver is the driver for mysql database. clannad_sk
func (*Driver) DoFilter ¶
func (d *Driver) DoFilter(ctx context.Context, link gdb.Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error)
DoFilter handles the sql before posts it to database.
func (*Driver) New ¶
New creates and returns a database object for mysql. It implements the interface of gdb.Driver for extra database driver installation.
func (*Driver) Open ¶
Open creates and returns an underlying sql.DB object for mysql. Note that it converts time.Time argument to local timezone in default.
func (*Driver) TableFields ¶
func (d *Driver) TableFields(ctx context.Context, table string, schema ...string) (fields map[string]*gdb.TableField, err error)
TableFields retrieves and returns the fields' information of specified table of current schema.
The parameter `link` is optional, if given nil it automatically retrieves a raw sql connection as its link to proceed necessary sql query.
Note that it returns a map containing the field name and its corresponding fields. As a map is unsorted, the TableField struct has a "Index" field marks its sequence in the fields.
It's using cache feature to enhance the performance, which is never expired util the process restarts.