cberner / redb

An embedded key-value database in pure Rust
https://www.redb.org
Apache License 2.0
3.07k stars 137 forks source link

Wanting to know if this is suitable for my use case #800

Closed Raj2032 closed 2 months ago

Raj2032 commented 2 months ago

Forgive me for my lack of understanding but I am here to seek advise:

Lets say I had this structure:

pub struct Customer
{
    pub id: u32,
    pub name: Name,
    pub email: String,
    pub is_disabled: bool,
}

pub struct Name
{
    first: String,
    last: String,
}

let customer_1 = Customer{id: 0, name: Name{first: "John", last: "Doe"}, email: "someemail@gmail.com", is_disabled: false};

Where I want to insert customer_1 as a row into a table. Is this possible first of all?

And lets say I have another structure:

pub struct Issue
{
    pub customer_id: u32, // Foreign key to Customer id
    pub issue_id: u32,
    pub description: String,
    pub pricing: f32,
}

Would I be able to have primary and foreign keys that would link Issue table with Customer table and be able to query it?