npm.io
1.0.6 • Published 8 years ago

yf-jsql

Licence
ISC
Version
1.0.6
Deps
1
Size
6 kB
Vulns
0
Weekly
0

yf-jsql

A simple sql queries translation to javascript

Install

$ npm install yf-jssql

Setting up our database

The first thing we need to do is setup a database.

const Jsql = require('yf-jssql');

let jsql = new Jsql({
  port: 3000,
  database: {
    DATABASE: 'hospital',
    USERNAME: 'root',
    PASSWORD: 'fly',
    PORT: '3306',
    HOST: 'localhost'
  }
});

async function excute() {
  let data = await jsql.select('article', {id: 2}, ['id']).page(5, 0);
  console.log(data);
  data = await jsql.one('article', {id: 2}, ['id', 'title', 'description', 'content', 'create_time']);
  console.log(data);
}

excute();

Keywords