Open jonahzheng opened 4 months ago
Hi @jonahzheng,
There is no persistent database implementation built into the package. The provided memory
implementation only persists in memory for a single process's lifetime. You would need to implement a persistent version to get this functionality.
We would take this contribution as a patch if you wanted to write it. A first attempt would probably extend the memory.Database
and serialize table schemas as CREATE TABLE
statements, and table data as CSV or JSON. Happy to provide additional pointers if you or someone else want to attempt this.
Alternately, you could build on top of Dolt, which is MySQL compatible and uses go-mysql-server as its query layer. Then you get persistence for free.
https://github.com/dolthub/dolt
Depending on what you're trying to do, the driver package might be a more convenient way to build on top of Dolt:
go-mysql-server, how to save data to hard disk?