Queriable in-memory database for TypeScript
npm i @hazae41/decibel
const db = new Database()
db.append({
id: "1",
name: "John",
age: 30,
job: "Engineer",
certifications: ["AWS", "Azure", "GCP"]
})
db.append({
id: "2",
name: "Jane",
age: 30,
job: "Engineer",
certifications: ["AWS", "Azure", "Docker"]
})
/**
* Find people whose job is `Engineer` and who have the `GCP` certification, order by ascending age, then order by descending id if they have the same age
*/
const [john] = db.get({ age: "ascending", id: "descending" }, { job: "Engineer", certifications: ["AWS", "GCP"] })
number
will be orderable (e.g. 0.1
, "0.1"
, 1n
, "0x1"
)["GCP", "AWS"]
-> arrays containing both GCP
and AWS
)