@gravitybot/sql
TypeScript icon, indicating that this package has built-in type declarations

1.8.2 • Public • Published

Gravitybot SQL !

Installation

npm install @gravitybot/sql

Required

How to use?

@gravitybot/sql Is a simple module that includes simplified functions of the mysql module

This is an example usage of our package

// Import the module
const mysql = require("@gravitybot/sql");

// Create a connection
mysql.createConnection({
  host: "localhost",
  user: "root",
  database: "test",
  password: "mysecretpassword",
});

// Create a Model
const user = new mysql.Model("users", {
  // Default Values
  userId: 1,
  username: "User",
  age: 18,
});

// Export data from Model
const me = await user.findOne({ username: "eyun-dev" });

// Console the data
console.log(me);

CONSOLE:

{
  userId: 1,
  username: "eyun-dev",
  age: 18
}
Function Description Params
create To create a new data in the table values (optional)
find To get an array of requested data where (optional)
findOne To get an object of requested data where (optional)
findOneAndDelete To delete some data from the table where
findOneAndUpdate To update some data in the table where , values

Package Sidebar

Install

npm i @gravitybot/sql

Weekly Downloads

0

Version

1.8.2

License

ISC

Unpacked Size

12.9 kB

Total Files

5

Last publish

Collaborators

  • gravitybot