BunORM is a ORM implementation for bun:sqlite that makes it easy to manage your bun:sqlite database by not only providing a simple to use interface, but also really good typescript support
(This package is still in an very early state so dont expect to much lol)
- ⚡ BLAZINGLY FAST
- 😮 Tiny no-dependencies package
- 🔤 Bestest autocompletion due to really good typescript types
- 💻 Easy to use interface inspired by TypeORM
- Supports following cool features out of the box:
- Custom data types like "JSON" with full type support (so you dont have to cast 😉)
- Middleware support (get/set)
- Custom functions that will be added to the row objects
- Relations between tables (also with type support)
- Automatic Id, createdAt and updatedAt properties
Stable release
bun install bunorm
Dev release
bun install https://github.com/deadlinecode/BunORM
Just import the package
import { BunORM } from "bunorm";
and define your table like this
const db = new BunORM("db.sqlite", {
tables: {
roles: {
columns: {
name: {
type: "TEXT",
},
},
},
users: {
columns: {
username: {
type: "TEXT",
},
password: {
type: "TEXT",
},
userData: {
type: "JSON",
},
},
},
},
});
Then use it ^~^
const users = db.tables.users.find();
Wait thats not all!!!
BunORM can do so much more for you 😎
Just take a look at the example folder
Sure thing! You can tinker with the package like this:
- Clone the repo
git clone https://github.com/deadlinecode/BunORM .
- Change stuff you wanna change
- Build the package
npm build
- Install it in another nodejs project from wherever you saved it on your disk
or alternatively run the example
# inside your other project npm install /path/to/the/repo/named/BunORM
# inside the package folder bun run src/example/example.ts
If you found an issue or would like to submit an improvement, please open an issue here.
If you actually have some spare time and want to contribute, feel free to open a PR and please don't forget to (create and) link the corresponding issue.
It's important so we can keep track of all the issues and feature requests that got resolved by PRs.
Please!
Please! Please! Please! Please! Please use the dev branch when making changes and PRs. I won't accept any changes to the master branch.
- Cleaning up the messy shit i call "code"
- Adding support for multiple relation types (one-to-many, one-to-one, etc.)
- Support relations both ways if one is set
- Bulk actions for everything
-
db.tables.[table].save
should return the saved or updated entity
Well bad for you.
Jk.
I currently don't have a discord but you can find me on the bun discord server or just dm me on discord
See ya over there and thanks for using my package ^^ <3