1.0.4 • Published 6 years ago

yn-mysql-utils v1.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

yn-mysql-utils

The simple secondary packaging of the mysql database plug-in is easy to use in the project, improve project development efficiency and reduce development costs!

Install


npm install yn-mysql-utils --save

Or

cnpm install yn-mysql-utils --save

Usage


const mysql = require('yn-mysql-utils')

Example


// Incoming configuration, same as mysql
let data = new mysql({
    host     : '127.0.0.1',
    user     : 'root',
    password : 'lb714500',
    database : 'SmallActivity',
    connectionLimit : 10
})

/**
 * Start query
 * sql: Query sql statement, string type
 * par: Query parameter, array type
 */
data.Query({
    sql: 'select * from activity_page where id = ?',
    par: [ 2 ]
}).then(res => {
    // Get the query result
    console.log(res)
    
  
    /* Data example

    [ RowDataPacket {
       id: 2,
       page_title: '红包拿不停',
       page_starttime: '2018-10-28 18:45:14',
       page_endtime: '2018-10-31 18:45:14',
       page_limit: '200' } 
    ] 
    */
})

other methods


You can also use await or async in your project.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago