Package Exports
- sqlite.easy
Readme
sqlite.easy
A simple and lightweight ORM built on top of SQLite for quick and easy database operations in Node.js.
Features
- Easy model creation with a simple schema definition.
- Supports CRUD operations:
create,find,findOne,update, anddelete. - Type mapping for common JavaScript types (
String,Number,Date, etc.). - Works with both JavaScript and TypeScript.
Installation
npm install sqlite.easyQuick Start
1. Create a model
import db from "sqlite.easy";
const User = db.model("users", {
id: String,
name: String,
age: Number,
email: String,
createdAt: Date
});
export default User;2. Use the model in your code
Import your model
import User from "./models/user.js";Get all users
const data = User.find();
console.log(data);Get users with specific conditions
User.find({ age: 28 });Create a new user
User.create({
id: "01234567890",
name: "Mazen",
age: 18,
email: "admin@maz1ndev.xyz",
createdAt: new Date()
});Get a single user
User.findOne({ id: "01234567890" });Update a user
User.update({ id: "01234567890" }, { age: 20 });Delete a user
User.delete({ id: "01234567890" });Notes
- All CRUD methods return synchronous results since SQLite operations are fast and run in-process.
- Models automatically create the table if it does not exist.
Author
👨💻 iimazin11 📂 GitHub: https://github.com/iimazin11