CSV DB
A simple embedded NoSQL database using CSV files for storage.
It allows using CSV files to perform these operations on collections of documents:
- find
- insert
- delete
- update
Design
csv_db
wraps a thin layer around the [csv
] crate, providing a Database struct with the usual
methods expected from a database library. Its main purpose is to abstract the user further away
from the low level details of CSV files, namely dealing with opening files and working with
records. Additionally the crate tries to be as generic as possible, allowing the user to
seamlessly use any custom type as document. In order to achieve this easily, csv_db
's methods
expect generic documents to implement Serialize
/Deserialize
traits using [serde
]'s derive
macros.
The methods are all asynchronous, so that you can easily integrate this crate into asynchronous
code. To achieve this, and since the [csv
] crate isn't asynchronous, each method of csv_db
wraps any potentially blocking code (like opening files or dealing with records) inside a
[tokio::task::spawn_blocking
] function.
Examples
use Database;
use ;
async