1.2.0 • Published 5 months ago

ryder-gembootan v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

ryder-gembootan NPM version

Ryder Gembootan is a Simple Query Builder For Javascript.

  • support chaining query like eloquent in laravel
  • easy to use

Supported Database

DatabaseStatus
MongoDB✅ Supported
MySQL🚧 Ongoing
PostgreSQL🚧 Ongoing
SQLite✅ Supported

Install

npm install ryder-gembootan

Or 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();
1.2.0

5 months ago

1.1.10

5 months ago

1.1.9

5 months ago

1.1.8

5 months ago

1.1.7

5 months ago

1.1.6

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.16

5 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago