1.2.0 • Published 9 months ago

ryder-gembootan v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 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

9 months ago

1.1.10

9 months ago

1.1.9

9 months ago

1.1.8

9 months ago

1.1.7

9 months ago

1.1.6

9 months ago

1.1.5

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago