6 releases
Uses new Rust 2024
new 0.1.5 | Apr 17, 2025 |
---|---|
0.1.4 | Apr 17, 2025 |
0.1.1 | Mar 30, 2025 |
#807 in Database interfaces
348 downloads per month
30KB
737 lines
IN DEVELOPMENT DON'T USE IN PRODUCTION (wait stabilization)
- database in development and might rapidly change syntax
in_memory/embedded (single file) database
Example of using in code
#[derive(Serialize, Deserialize, Debug)]
struct Agent {
name: String,
r#type: String,
score: i32,
}
fn main() -> HandleResult<()> {
let mut db = start::in_memory();
db
.insert(Agent {
name: "ChatGPT".into(),
r#type: "AI".into(),
score: 85
})
.into("agents")?;
db
.insert(Agent {
name: "Gemini".into(),
r#type: "AI".into(),
score: 80
})
.into("agents")?;
db
.insert(Agent {
name: "RuleBot3000".into(),
r#type: "Rule-Based".into(),
score: 100
})
.into("agents")?;
let many: Vec<Agent> = db.find()
.filter(Filter::And(vec![
Filter::Eq("type".into(), Value::String("AI".into())),
Filter::Gt("score".into(), Value::Integer(80)),
]))
.from("agents")?;
// output:
// Agent { name: "ChatGPT", type: "AI", score: 85 }
for doc in many {
println!("{:?}", doc);
}
Ok(())
}
quick roadmap:
documnet [x] collection [x] findCollection [x] insertCollectionByOffset [x] insertOne [x] insertCollection [x] insertDML [x] find [x] findDML [x] find({args}) [ ] storage-pages [ ] limit [ ] insertMany [ ] bson [ ] delete [ ]
How does it works?
Based on start-storage
crate, database first keeps 100 bytes header.
Next it (sys-master) contains tables, first system-tables (like sys-master, then sys-trash)
At second, it keeps user tables. Each table is linked list.
Dependencies
~7.5MB
~143K SLoC