0.1.5 • Published 10 years ago

mymodel v0.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

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
0.1.5

10 years ago

0.1.4

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago