mysql

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mysql 实现 MySQL 数据库驱动(纯 Go,经 go-sql-driver/mysql,无 CGO)。

支持 MySQL 5.7 / 8.0.x(含 8.0.12、8.0.37 等)。 8.0 默认认证插件 caching_sha2_password 由驱动原生支持(需驱动 v1.5+)。

同时通过别名支持 MariaDB:MariaDB 是 MySQL 的分支,协议高度兼容, go-sql-driver/mysql 驱动可直接连接 MariaDB。注册别名 "mariadb" -> "mysql" 后, 配置里写 type: mariadb 即等价于 type: mysql。

本包在被 import 时通过 init() 自动注册到 driver 注册表,注册名 "mysql"。 CLI 在 main 里空导入本包(import _ ".../internal/mysql")即生效。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct{}

Driver 实现 driver.Driver,注册名 "mysql"。

func (*Driver) Description

func (d *Driver) Description() string

Description 返回面向 manifest 的描述。

func (*Driver) Name

func (d *Driver) Name() string

Name 返回驱动名。

func (*Driver) Open

func (d *Driver) Open(cfg *driver.DatasourceConfig) (driver.Conn, error)

Open 依据配置创建连接。

func (*Driver) SupportedVersions

func (d *Driver) SupportedVersions() string

SupportedVersions 返回支持的 MySQL 版本范围。

Jump to

Keyboard shortcuts

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