ryder-gembootan v1.2.0
ryder-gembootan 
Ryder Gembootan is a Simple Query Builder For Javascript.
- support chaining query like eloquent in laravel
- easy to use
Supported Database
| Database | Status |
|---|---|
| MongoDB | ✅ Supported |
| MySQL | 🚧 Ongoing |
| PostgreSQL | 🚧 Ongoing |
| SQLite | ✅ Supported |
Install
npm install ryder-gembootanOr installing with yarn? yarn add ryder-gembootan
Usage
MongoDB
First you need to create model first and extends RyderGembootan model
// UserModel.js
import RyderGembootan from "ryder-gembootan";
export default class UserModel extends RyderGembootan.MongoModel {
constructor() {
super(
"MONGODB_USER",
"MONGODB_PASS",
"MONGODB_HOST",
"MONGODB_DBNAME",
"MONGODB_COLLNAME"
);
}
}After then you can use this model to do a query into your database easily
// index.js
import UserModel from "./UserModel.js";
const main = async () => {
// initialize model object
const model = new UserModel();
// get all data
const result = await model.get();
console.log("result", result);
};
main();Get Data
to get data you can use first(), find(), or get()
get all data
// get all data
await model.get();get first record from database
// get first record
await model.first();get data by id from database
// get data by id
await model.find("15198465465138");Where
get all data from database where email = anggerpputro@gmail.com
await model.where("email", "=", "anggerpputro@gmail.com").get();get first data from database where email = anggerpputro@gmail.com
await model.where("email", "=", "anggerpputro@gmail.com").first();Insert Data
insert into database with data name: angger, and email: anggerpputro@gmail.com
await model.create({
name: "angger",
email: "anggerpputro@gmail.com",
});Update Data
update data, set name = angger priyardhan, where email = anggerpputro@gmail.com
await model.where("email", "=", "anggerpputro@gmail.com").update({
name: "angger priyardhan",
});Delete Data
delete from database where email = anggerpputro@gmail.com
await model.where("email", "=", "anggerpputro@gmail.com").delete();9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago