Expand description
AimemDb — Turso connection wrapper + schema bootstrap.
§Overview
AimemDb wraps a turso::Database and owns the full schema lifecycle.
It is cheaply cloneable (Arc-backed internally) and safe to share across
async tasks.
§Schema
Three tables live in one file:
| Table | Purpose |
|---|---|
drawers | Verbatim text chunks + vector32 embeddings |
entities | Knowledge-graph entity nodes |
triples | Temporal (subject→predicate→object) edges |
§Example
use aimem_core::{Drawer, AimemDb};
use chrono::Utc;
// In-memory DB — perfect for tests
let db = AimemDb::memory().await?;
let drawer = Drawer::new(
"d_001",
"my_project",
"decisions",
"We chose Turso for native vector support.",
"claude",
)
.with_filed_at(Utc::now().to_rfc3339());
let inserted = db.insert_drawer(&drawer, None).await?;
assert!(inserted);
assert_eq!(db.drawer_count().await?, 1);Structs§
- AimemDb
- Shared Turso database handle.
- Embedding
Store Profile