loke-mysql-orm
v1.11.0
Published
MySQL Data Mapper
Downloads
47
Readme
loke-mysql-orm
Install
npm install --save loke-mysql-orm
Example
var db = require('loke-mysql-orm').create('mysql://root@localhost/demo');
var petRepository = db.table('Pets', {
name: { type: String, defaultValue: () => 'Untitled' },
description: db.Text
});
var userRepository = db.table('Users', {
firstName: db.String,
lastName: db.String,
pets: [petRepository]
});
userRepository.find({firstName: 'Testing'})
.then(function (users) {
users[0].pets[0].description = 'Hello World!';
// Save changes:
return userRepository.persist(users[0]);
});
View Documentation.
Tests
npm test
Coverage
npm run coverage