npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mysqlasyncawaitwrapper

v0.0.5

Published

node js MySql module wrapper. it wrapping MySql and return promise. so you could use async/await syntax it in !

Downloads

12

Readme

https://www.npmjs.com/package/mysqlasyncawaitwrapper

MysqlAsyncWrapper

npm i mysqlasyncawaitwrapper

the node js mysql module ( mysql.js https://www.npmjs.com/package/mysql ) is Only support Callbacks.

this wrapping package, wrap the mysql module and returning Promise.

so you can use async / await syntax with mysql js Package

Usage

  1. you need to make DB file , and put in Config.json file like this.

file

  1. set Mysql connection Config like this.

file;

(https://www.npmjs.com/package/mysql)

it is completely same mysql module connection config.

  1. get in library
let mysqlAsync = require('mysqlasyncawaitwrapper');
let {connected,release} = await mysqlAsync.connect();

const INSERT = 'INSERT INTO CATEGORY (NAME) VALUES("TEST")';
let result = await connected(INSERT);
...
release();

use it !

.connect method return connected,release method.

connected method is used sending query

release method is used returning connection to db pools

node js mysql 모듈은 콜백 기반이기 때문에 제가 너무 좋아하는 async/await 문법을 사용할 수 없어 만든 작은 라이브러리입니다. !

node js mysql 모듈을 감싸 Promise 기반의 모듈로 변형하는 역할을 수행합니다. !

필요한것

  1. mysql모듈을 랩핑하기 때문에 , mysql 접속을 위한 config파일을 다음과 같이 db 파일을 넣어 Config.json 파일을 만들어주세요.

file

  1. mysql connection 설정과 동일한 설정을 넣어주세요.

file;

설정에 대한 자세한 옵션들은 mysql 홈페이지에서 확인해주세요 . (https://www.npmjs.com/package/mysql)

Usage

  1. require로 라이브러리를 가져옵니다.
let mysqlAsync = require('mysqlasyncawaitwrapper');
  1. db 폴더에 config.json 파일을 넣어 DB와 연동 가능하게 준비해줍시다.
{
    "connectionLimit":10,
    "host":"localhost",
    "user":"root",
    "password":null,
    "database":"BoostCourse_Web"
}
  1. .connect() 메소드로 DB와 연동을 시도합시다.
let {connected,release} = await mysqlAsync.connect();

const INSERT = 'INSERT INTO CATEGORY (NAME) VALUES("TEST")';
let result = await connected(INSERT);
...
release();

connected 함수로 query를 날리는 것이 가능합니다.

release 함수는 연결된 커넥션을 커넥션풀로 돌려주는 함수입니다.