New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mymodel

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mymodel

A MySql model structure for nodejs

latest
Source
npmnpm
Version
0.1.5
Version published
Weekly downloads
16
6.67%
Maintainers
1
Weekly downloads
 
Created
Source

MyModel is Mysql Models for NodeJs

Usage

Selection

var mysql = require('mysql');
var model = new MyModel();    
model.extend(connection, "movies"); //mysql connection and table name
model.findOne("name", "id", "julien"); //which columns will be selected
model.where("id = 3", "OR"); //first criteria
model.where("name = 'slience'"); //second criteria
model.execute(function(err, rows, field){
    console.log(rows);
});

Insertation

var insertmodel = new MyModel();
insertmodel.extend(connection, "movies");
insertmodel.setProperty("name", "yigit"); //property with column name to insert
insertmodel.setProperty("password", 123456); //property with column name to insert
insertmodel.save();
insertmodel.execute(function(err, rows, fields){
    if(!err){
        console.log("inserted");
    }
});

Running test

Running unit tests is easy as:

nodeunit test.js

TODO

  • Multiple Selection Feature
  • Update
  • Relations

FAQs

Package last updated on 25 Sep 2015

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