1.1.27 • Published 6 years ago

node-data-mapper v1.1.27

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

Build Status Coverage Status

node-data-mapper

node-data-mapper in object-relational mapper for Node.js. It uses the data-mapper pattern.

What does it do?

It takes queries that look like this:

SELECT  bs.bikeShopID, bs.name, bs.address,
        s.staffID, s.firstName, s.lastName
FROM    bike_shops bs
INNER JOIN staff s ON bs.bikeShopID = s.bikeShopID
ORDER BY bs.name, s.firstName

and makes them look like this:

dataContext
  .from('bike_shops bs')
  .innerJoin('bs.staff s')
  .select(
    'bs.bikeShopID', 'bs.name', 'bs.address',
    's.staffID', 's.firstName', 's.lastName')
  .orderBy('bs.name', 's.firstName')

It maps relational, tabular data that look like this:

bikeShopIDnameaddressstaffIDfirstNamelastName
1Bob's Bikes9107 Sunrise Blvd2JohnStovall
1Bob's Bikes9107 Sunrise Blvd1RandyAlamedo
1Bob's Bikes9107 Sunrise Blvd3TinaBeckenworth
3Cycle Works3100 La Riviera Wy7KimberlyFenters
3Cycle Works3100 La Riviera Wy8MichaelXavier
3Cycle Works3100 La Riviera Wy5SalGreen
3Cycle Works3100 La Riviera Wy6ValerieStocking
2Zephyr Cove Cruisers18271 Highway 504AbeDjango

to a normalized document like this:

[ { bikeShopID: 1,
    name: 'Bob\'s Bikes',
    address: '9107 Sunrise Blvd',
    staff: 
     [ { staffID: 2, firstName: 'John', lastName: 'Stovall' },
       { staffID: 1, firstName: 'Randy', lastName: 'Alamedo' },
       { staffID: 3, firstName: 'Tina', lastName: 'Beckenworth' } ] },
  { bikeShopID: 3,
    name: 'Cycle Works',
    address: '3100 La Riviera Wy',
    staff: 
     [ { staffID: 7, firstName: 'Kimberly', lastName: 'Fenters' },
       { staffID: 8, firstName: 'Michael', lastName: 'Xavier' },
       { staffID: 5, firstName: 'Sal', lastName: 'Green' },
       { staffID: 6, firstName: 'Valerie', lastName: 'Stocking' } ] },
  { bikeShopID: 2,
    name: 'Zephyr Cove Cruisers',
    address: '18271 Highway 50',
    staff: [ { staffID: 4, firstName: 'Abe', lastName: 'Django' } ] } ]
Why should I use it?
  • It's fast.
  • The code is well documented and thoroughly tested.
  • Tutorials and documentation help you to get started quickly.
  • It works well with existing projects and databases.
  • The query interface is intuitive and closely resembles SQL.
  • Unlike other ORMs, there's no need to define models.
  • Queries use plain ol' JavaScript objects and arrays.
  • Security concerns like SQL injection are covered.
  • CRUD operations can be reused. Create a select query, and use the same query for updates and deletes.
  • It lets you easily create queries that can be filtered and ordered dynamically.
  • There are hooks for global conversions and transformations, like normalizing dates and formatting phone numbers.
  • Database modifications show up immediately. If you add a column to the database, you don't have to change any code.
  • It eliminates incosistent property names, which is a common problem in APIs.
How do I get started?

Go check out the tutorials!

Table of Contents
1.1.27

6 years ago

1.1.26

6 years ago

1.1.25

7 years ago

1.1.24

7 years ago

1.1.23

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.12

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3-dev

7 years ago

1.1.2-dev

7 years ago

1.1.1-dev

7 years ago

1.0.19

7 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago