Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hazae41/decibel
Queriable in-memory database for TypeScript
https://github.com/hazae41/decibel
Last synced: about 2 months ago
JSON representation
Queriable in-memory database for TypeScript
- Host: GitHub
- URL: https://github.com/hazae41/decibel
- Owner: hazae41
- Created: 2024-03-20T13:06:22.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-03-26T16:47:59.000Z (9 months ago)
- Last Synced: 2024-10-07T21:31:00.434Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-ccamel - hazae41/decibel - Queriable in-memory database for TypeScript (TypeScript)
README
# Decibel
Queriable in-memory database for TypeScript
```bash
npm i @hazae41/decibel
```[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/decibel)
## Features
### Current features
- 100% TypeScript and ESM
- No external dependencies
- NoSQL-like querying## Usage
```tsx
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"] })
```- Any column that can be converted to `number` will be orderable (e.g. `0.1`, `"0.1"`, `1n`, `"0x1"`)
- Arrays are filtered with inter / inner join / "and" (e.g. `["GCP", "AWS"]` -> arrays containing both `GCP` and `AWS`)