Introducing mysql-orm-promise

mysql-orm-promise

A node.js based ORM to communicate with your MySQL database.

After trying several npm packages for interacting with MySQL, I decided to create a cleaner and robust version of my own. I have come across packages which follow the callback as well as the promise based implementations, but query chaining was something which felt missing from those packages. I needed something which would be a shameless mockery of the mongoosejs package(a pure model implementation on schema basis, and allow me to chain my queries in an easy and cleaner way), but for MySQL.

Enter mysql-orm-promise

Using this package can be as easy as eating a pie(smirks). So let’s begin.

Install

npm install mysql-orm-promise

Initialization

var MysqlORM = require('mysql-orm-promise')
MysqlORM.connection.connect({
    host     : '<hostname>',
    user     : '<username>',
    password : '<password>',
    database : '<database_name>'
})

A simple query – retrieving all records

var UserModel = MysqlORM.model('user')
UserModel.findAll().exec().then(function(usersData){
    // usersData is the array of results
    // The attributes of the records can be accessed as `usersData[0].attributes`
    // In order to get the `name` attribute of the user, you will have to execute the following code
    console.log(usersData[0].attributes.name)
})

Query Chaining

UserModel.where({"name": "Jack"})
.skip(5)
.limit(10)
.orderBy('last_name')
.exec()
.then(function(usersData){
    // handle the result data here
})

Moving Forward

mysql-orm-promise currently only allows you execute read operations on your database. Write operations are still a work in progress. You can check out the links below for future updates

jqueryfadeslider continues to grow

Today marks the release of jquery-fade-slider version 2.2

This release provides the ability to listen to events and has some fixes based on the issues reported on Github

The documentation site now has its own domain.

So go and give this awesome plugin a try.

jquery-fade-slider v2.0 Released

25 days after publishing the initial release of this plugin, today I have released and advanced version of jquery-fade-slider

I have also improved the documentation around this significantly. You can take a look at the plugin’s documentation and some of the demos

jquery-fade-slider Released

Released the first version of jquery-fade-slider, my first jQuery plugin.

It enables you to have a usual carousel like behavior, the only major difference being, the items list is not scrolled through, rather a fade effect is used to traverse through the list.

Take a look at the plugin here