SoliDB Rust Client
Official Rust client library for SoliDB, a lightweight, high-performance multi-document database.
Features
- Native binary protocol using MessagePack serialization
- Persistent TCP connections for low latency
- Full async support with Tokio
- Complete API coverage: documents, collections, queries, indexes, transactions
- Builder pattern for connection configuration
Installation
Add to your Cargo.toml:
[]
= "0.5.0"
= { = "1", = ["full"] }
Quick Start
use ;
use json;
async
Using the Builder
For more control over connection setup:
let client = new
.auth
.timeout_ms
.build
.await?;
API Reference
Connection
SoliDBClient::connect(addr)- Connect to a serverclient.ping()- Check server connectivityclient.auth(database, username, password)- Authenticate
Databases
client.list_databases()- List all databasesclient.create_database(name)- Create a databaseclient.delete_database(name)- Delete a database
Collections
client.list_collections(database)- List collectionsclient.create_collection(database, name, collection_type)- Create a collectionclient.delete_collection(database, name)- Delete a collectionclient.collection_stats(database, collection)- Get collection statistics
Documents
client.get(database, collection, key)- Get a document by keyclient.insert(database, collection, key, document)- Insert a documentclient.update(database, collection, key, document, merge)- Update a documentclient.delete(database, collection, key)- Delete a documentclient.list(database, collection, limit, offset)- List documents with pagination
Queries (SDBQL)
// Simple query
let results = client.query.await?;
// With bind variables
let mut bind_vars = new;
bind_vars.insert;
let results = client.query.await?;
// Explain query plan
let plan = client.explain.await?;
Indexes
client.create_index(database, collection, name, fields, unique, sparse)- Create an indexclient.delete_index(database, collection, name)- Delete an indexclient.list_indexes(database, collection)- List indexes
Transactions
// Begin a transaction
let tx_id = client.begin_transaction.await?;
// All operations within the transaction use the same connection
let _ = client.insert.await?;
// Commit
client.commit.await?;
// Or rollback
// client.rollback().await?;
Bulk Operations
// Batch multiple commands
let commands = vec!;
let responses = client.batch.await?;
// Bulk insert documents
let count = client.bulk_insert.await?;
println!;
Error Handling
use DriverError;
match client.get.await
Feature Flags
Currently no feature flags. The client is designed to be lightweight with minimal dependencies.
Version Compatibility
| Client Version | SoliDB Server Version |
|---|---|
| 0.5.0 | 0.5.0+ |
License
MIT License - see LICENSE file.
Contributing
Contributions are welcome! Please see the main SoliDB repository for guidelines.