一个与 MySQL 兼容的关系数据库,具有无存储依赖的查询引擎。使用 Go 实现。
go-mysql-server is a data-source agnostic SQL engine and server which runs queries on data sources you provide, using the MySQL dialect and wire protocol. A simple in-memory database implementation is included, and you can query any data source you want by implementing your own backend.
Dolt, a SQL database with Git-style versioning, is the main production database implementation of this package. Check out that project for a reference implementation. Or, hop into the Dolt Discord server here if you want to talk to the core developers behind go-mysql-server and Dolt.
With the exception of specific limitations (see below), go-mysql-server is a drop-in replacement for MySQL. Any client library, tool, query, SQL syntax, SQL function, etc. that works with MySQL (including the MariaDB Java client) should also work with go-mysql-server. If you find a gap in functionality, please file an issue.
For full MySQL compatibility documentation, see the Dolt docs on this topic.
go-mysql-server has two primary uses case:
Stand-in for MySQL in a golang test environment, using the built-in
memory database implementation.
Providing access to arbitrary data sources with SQL queries by implementing a handful of interfaces. The most complete real-world implementation is Dolt.
Add go-mysql-server as a dependency to your project. In the
directory with the go.mod file, run:
go get github.com/dolthub/go-mysql-server@latest
To implement ICU-compatible regexes, go-mysql-server has a dependency on
go-icu-regex, which has a Cgo dependency on
ICU4C. To build a project
which depends on go-mysql-server, you should have a C/C++ toolchain, you
should build with Cgo enabled, and you should have libicu-dev, or the
equivalent for your environment, installed and available to your C++ toolchain.
For convenience, go-mysql-server also includes a non-compatible regex
implementation based on the Go standard library regex.Regex. To build against
that, instead of the go-icu-regex implementation, you must compile with
-tags=gms_pure_go. Please note that some of go-mysql-server's tests do not
pass with -tags=gms_pure_go and in general gms_pure_go is not recommended
for users seeking MySQL compatibility.
The in-memory test server can replace a real MySQL server in tests. Start the server using the code in the _example directory, also reproduced below.
…
This example populates the database by creating memory.Database and
memory.Table objects via golang code, but you can also populate it
by issuing CREATE DATABASE, CREATE TABLE, etc. statements to the
server once it's running.
Once the server is running, connect with any MySQL client, including
the golang MySQL connector and the mysql shell.
…
The in-memory database implementation included with this package is intended for use in tests. It has specific limitations that we know of:
CREATE TABLE, INSERT, etc.) to a single goroutine.START TRANSACTION, ROLLBACK, and COMMIT are no-ops.You can create your own backend to query your own data sources by implementing some interfaces. For detailed instructions, see the backend guide.
Are you building a database backend using go-mysql-server? We would like to hear from you and include you in this list.
go-mysql-server's security policy is maintained in this repository. Please follow the disclosure instructions there. Please do not initially report security issues in this repository's public GitHub issues.
go-mysql-server was originally developed by the {source-d}
organzation, and this repository was originally forked from
src-d. We want to thank
the entire {source-d} development team for their work on this
project, especially Miguel Molina (@erizocosmico) and Juanjo Álvarez
Martinez (@juanjux).
Apache License 2.0, see LICENSE
The Go gopher was designed by Renee French, licensed under CC BY 4.0. The mascot image is based on work by Takuya Ueda, licensed under CC BY 3.0, with modifications.
暂无开放 Issues,或尚未同步最近议题。