notdb
v0.3.2
Published
A simple JavaScript/TypeScript SDK for interacting with the NotDatabase API. Define your schema and perform CRUD operations with ease.
Readme
A simple JavaScript/TypeScript SDK for interacting with the NotDatabase API. Define your schema and perform CRUD operations with ease.
Installation
npm install notdbor with pnpm:
pnpm add notdbQuick Start
import { createClient } from "notdb";
// Initialize client and define your schema
const db = createClient({
apiKey: "YOUR_API_KEY",
{
users: {
properties: {
name: { type: "string", required: true },
email: { type: "string", required: true, unique: true },
age: { type: "number" },
},
},
}
});
// Insert a user
await db.users.insert({
name: "Alice",
email: "[email protected]",
age: 30,
});
// Find users
const users = await db.users.find({ filter: { age: 30 } });
// Get a user by ID
const user = await db.users.get("user_id");
// Update a user
await db.users.update("user_id", { age: 31 });
// Increment or decrement numeric fields
await db.users.update("user_id", {
xp: { increment: 100 }, // Increments xp by 100
score: { decrement: 50 }, // Decrements score by 50
});
// Delete a user
await db.users.delete("user_id");For more details, check out the documentation.
