docs.rs failed to build turso-0.8.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
turso-0.8.0-pre.12
turso
The next evolution of SQLite: A high-performance, SQLite-compatible database library for Rust
Features
- SQLite Compatible: Similar interface to rusqlite with familiar API apart from using async Rust
- High Performance: Built with Rust for maximum speed and efficiency
- Async/Await Support: Native async operations with tokio support
- In-Process: No network overhead, runs directly in your application
- Cross-Platform: Supports Linux, macOS, and Windows
- Transaction Support: Full ACID transactions with rollback support
- Prepared Statements: Optimized query execution with parameter binding
- Cloud Sync: Sync with Turso Cloud using
Builder::new_remote()(optionalsyncfeature)
Installation
Add this to your Cargo.toml:
[]
= "0.4.3"
= { = "1.0", = ["full"] }
For cloud sync capabilities, enable the sync feature:
[]
= { = "0.4.3", = ["sync"] }
= { = "1.0", = ["full"] }
Quick Start
In-Memory Database
use Builder;
async
File-Based Database
use Builder;
async
Synced Database
Sync your local database with Turso Cloud:
use Builder;
async
API Reference
Builder
Create a new database:
let db = new_local.build.await?;
let db = new_local.build.await?;
Connection
Execute queries and statements:
// Execute SQL directly
let rows_affected = conn.execute.await?;
// Query for multiple rows
let mut rows = conn.query.await?;
// Prepare statements for reuse
let mut stmt = conn.prepare.await?;
let mut rows = stmt.query.await?;
// Execute prepared statements
let rows_affected = stmt.execute.await?;
Working with Results
use TryStreamExt;
let mut rows = conn.query.await?;
while let Some = rows.try_next.await?
Sync API Reference
sync::Builder
Create a synced database that synchronizes with Turso Cloud:
use Builder;
let db = new_remote // Local database path (or ":memory:")
.with_remote_url // Remote URL (https://, http://, or libsql://)
.with_auth_token // Authorization token
.bootstrap_if_empty // Download schema on first sync (default: true)
.with_remote_encryption // Optional remote encryption
.build
.await?;
sync::Database
Operations for synced databases:
// Push local changes to remote
db.push.await?;
// Pull remote changes (returns true if changes were applied)
let had_changes = db.pull.await?;
// Force WAL checkpoint
db.checkpoint.await?;
// Get sync statistics
let stats = db.stats.await?;
println!;
println!;
println!;
License
MIT