Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-mysql-js

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-mysql-js

Easy MySQL for NodeJS

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
30K
decreased by-86.74%
Maintainers
0
Weekly downloads
 
Created
Source

easy-mysql-js

You can do database operations easily with this package.

List of Features

  • Select (manual query)
  • SelectSingle
  • SelectMulti
  • Insert
  • Update
  • InsertOrUpdate
  • Delete

Download & Installation

$ npm i easy-mysql-js

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

DATABASE_URL

NODE_ENV

Example Usage

Select

const {Select, SelectSingle, SelectMulti} = require('easy-mysql-js')

async function test() {

	const select_result = await Select('asd')
	console.log(select_result)

	// Success => [ { id: 1, name: 'qwe', email: 'qwe@asd.com', phone: '1235' } ]
	// Error => []

	const selectSingle_result = await SelectSingle("users",{id:1},{id:true,name:true,email:true})
	console.log(selectSingle_result)

	// Success => { id: 1, name: 'qwe', email: 'qwe@asd.com', phone: '1235' }
	// Error => null

	const selectMulti_result = await SelectMulti("users",{},{id:true,name:true,email:true})
	console.log(selectMulti_result)

	// Success => [{ id: 1, name: 'qwe', email: 'qwe@asd.com', phone: '1235' },{ id: 2, name: 'asd', email: 't@t.com', phone: '12344955' }, ... ]
	// Error => []
}

test()

Insert

const {Insert} = require('easy-mysql-js')

async function test() {

	const insert_result = await Insert("users",{name:"name",email:"asd@asd.com",phone:"1234567890"})
	console.log(insert_result)

	// Success => true
	// Error => false
}

test()


Update

const {Update} = require('easy-mysql-js')

async function test() {

	const update_result = await Update("users",{email:"asd@asd.com"},{email:"qwe@qwe.com"})
	console.log(update_result)
	
	// Success => true
	// Error => false
}

test()


InsertOrUpdate

const {InsertOrUpdate} = require('easy-mysql-js')

async function test() {

	const insertOrUpdate_result = await InsertOrUpdate("users",{id:1},{phone:"123123"},{name:"name2",email:"qwe@qwe.com",phone:"1234567891"})
	console.log(insertOrUpdate_result)
	
	// Success => true
	// Error => false
}

test()


Delete

const {Delete} = require('easy-mysql-js')

async function test() {

	const delete_result = await Delete("users",{id:1})
	console.log(delete_result)
	
	// Success => true
	// Error => false
}

test()


Acknowledgements

  • Prisma

License

This project is licensed under the MIT License

Keywords

FAQs

Package last updated on 24 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc