tortoise-orm
v2.0.0
Published
A small wrapper around firebase-admin
Downloads
26
Maintainers
Readme
What is Tortoise-orm
Tortoise is a small wrapper around firebase-admin for better typescript integration and manage collection easily.
Why use Tortoise-orm ?
- Tortoise-orm implement the same function that firestore, so it's easy to implement
- Tortoise-orm was built with TS in mind, so you know what you get in your document
- Tortoise-orm was built to be as small as possible
- Tortoise-orm implement some other useful functions like the data function to get document's data directly
How to use Tortoise-orm
To use tortoise-orm you first need to create a client :
import { createNewTortoiseClient } from "./createNewTortoiseClient";
export const client = createNewTortoiseClient(firebaseApp);
Now you can use tortoise-orm like you would do with firebase-admin for example if you want to create a doc you can do this like that :
interface User {
email: string;
firstname: string;
lastname: string;
age: number
}
const doc = await client.collection<User>("users").add({ email: "email", firstname: "john", lastname: "doe", age: 35 });
Furthermore, you can use the special tortoise-orm function. For example if you want to update all the users where the name is john you can do like that :
const users = await client.collection<"User">("user").where("firstname", "==", "john").update({ firstname: "Paul" });
🔥 Roadmap
- [ ] Implement better typing for fieldvalue
- [ ] Better verification on where condition
- [ ] Add more example with typescript on readme