1.0.0 • Published 2 years ago
snippetql v1.0.0
QUICK START CRUD
- Initialize Database
const SnippetQL = require('snippetql');
SnippetQL.initializeDB();
const usersCollection = SnippetQL.collection("users");- Insert Database
usersCollection.insert({ username: "alamwibowo", password: "123456" });- Update Database
/**
* Fungsi Update Data
* @return {Boolean}
*/
const update = usersCollection
.where("username")
.equal("alamwibowo")
.update({ address: "Jl. Alam Selangit 2" });- Delete Database
/**
* Fungsi Delete Data
* @return {Boolean}
*/
const hapus = usersCollection.where("username").equal("alamwibowo").delete();- Select Database
/**
* Fungsi query dengan where clauses
* @return {Object}
*/
const getAll = usersCollection
.select("*")
.hideField("password")
.build();
/**
* Fungsi query dengan where clauses
* @return {Object}
*/
const getUsernameAndPassword = usersCollection
.where("username")
.equal("alamwibowo")
.and("password")
.equal("123456")
.build();1.0.0
2 years ago