Documentation ¶
Overview ¶
Package mysql 实现了 gdb.Driver 接口,该接口支持对 MySQL 数据库的相关操作。
Index ¶
- func New() db类.Driver
- type Driver
- func (d *Driver) New(core *db类.Core, node *db类.X配置项) (db类.DB, error)
- func (d *Driver) X取表名称数组(上下文 context.Context, schema ...string) (表名称数组 []string, 错误 error)
- func (d *Driver) X取表字段信息Map(上下文 context.Context, 表名称 string, schema ...string) (字段信息Map map[string]*db类.TableField, err error)
- func (d *Driver) X底层DoFilter(ctx context.Context, link db类.Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error)
- func (d *Driver) X底层Open(配置对象 *db类.X配置项) (db *sql.DB, err error)
- func (d *Driver) X底层取数据库安全字符() (左字符 string, 右字符 string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
type Driver struct {
*db类.Core
}
Driver 是 MySQL 数据库的驱动程序。
func (*Driver) X取表字段信息Map ¶
func (d *Driver) X取表字段信息Map(上下文 context.Context, 表名称 string, schema ...string) (字段信息Map map[string]*db类.TableField, err error)
TableFields 获取并返回当前模式下指定表的字段信息。
参数`link`是可选的,如果给定为nil,它会自动获取一个原始sql连接作为链接执行必要的sql查询。
注意,它返回一个包含字段名及其对应字段信息的map。由于map是无序的,TableField结构体中有一个"Index"字段标记其在所有字段中的顺序。
为了提高性能,该方法使用了缓存功能,缓存有效期直到进程重启才会失效。
func (*Driver) X底层DoFilter ¶
func (d *Driver) X底层DoFilter(ctx context.Context, link db类.Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error)
DoFilter 在将 SQL 发送给数据库之前处理 SQL。
func (*Driver) X底层取数据库安全字符 ¶
GetChars 返回此类型数据库的安全字符。
Click to show internal directories.
Click to hide internal directories.