OpenSrv - MySQL
Bindings for emulating a MySQL/MariaDB server.
When developing new databases or caching layers, it can be immensely useful to test your system using existing applications. However, this often requires significant work modifying applications to use your database over the existing ones. This crate solves that problem by acting as a MySQL server, and delegating operations such as querying and query execution to user-defined logic.
Usage
To start, implement AsyncMysqlShim
for your backend, and create a AsyncMysqlIntermediary
over an
instance of your backend and a connection stream. The appropriate methods will be called on
your backend whenever a client issues a QUERY
, PREPARE
, or EXECUTE
command, and you will
have a chance to respond appropriately. For example, to write a shim that always responds to
all commands with a "no results" reply:
use io;
use AsyncWrite;
use *;
use TcpListener;
;
async
This example can be exected with:
cargo run --example=serve_one
More examples can be found here.
Getting help
Submit issues for bug report or asking questions in discussion.
Credits
This project is a branch of jonhoo/msql-srv and focuses on providing asynchronous support.
License
Licensed under Apache License, Version 2.0.