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

mapper

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapper

Lightweight, blazing fast ORM on top of mysql-libmysqlclient.

  • 0.1.5
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Mapper

Fast MySQL ORM on top of the awesome mysql-libmysqlclient driver.

The goal is to have a blazing fast ORM like dapper-dot-net for node. Mapper is faster than JAVA ORMs like JDBI (dropwizard). Much faster than any SQL-based ORM for node. No bloat.

Based off original code by didit-tech.

Installation

npm install mapper

Benchmarks

Time for 100,000 iterations alternating between insert and select. See test/bench or run make bench.

mapper real 0m24.197s user 0m11.146s sys 0m3.630s

node-mysqllibclient real 0m18.165s user 0m6.613s sys 0m3.396s

node-mysql real 0m34.283s user 0m19.964s sys 0m2.541s

Best Practices

A simple practice without over-engineering is to main 3 distinct layers in your code:

  1. Data Access Objects (DAO) - 1 to 1 mapping to database tables.
  2. Models - Aggregate one or more DAO and add business logic.
  3. Resources or services - Use models never DAO.

Quickstart

var Mapper = require('mapper');
var conn = { user: 'dont' , password: 'blink' , database: 'now' };
Mapper.connect(conn);

// table name only
var PostDao = Mapper.Base.extend({
  tableName: 'posts'
});

PostDao.create({ title: 'Some Title 1', body: 'Some body 1' }, function(err, results) {
  PostDao.find({ 'title.like': '%title%' }, { only: ['id', 'body'] }, function(err, post) {
    // Hooray!
  });
});

##Contributors

  • Mario Gutierrez (mgutz)

Original FastLegS

Many thanks to the original project

  • Thad Clay (thadclay)
  • Jim Drannbauer (excellentdrums)
  • Rob Malko (malkomalko)

FAQs

Package last updated on 04 May 2012

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