kreetitech / rdx Goto Github PK
View Code? Open in Web Editor NEWan ORM for node.js - still under development
License: MIT License
an ORM for node.js - still under development
License: MIT License
RDX ======== A simple ORM for Node.js. Currently only supports mysql-libmysqlclient: https://github.com/Sannis/node-mysql-libmysqlclient Usage ----- Here is some example usage using the test database present in tests/fixtures/db_schema.sql: var rdx = require('rdx') var cfg = { adapter: 'mysql-libmysqlclient', host: "localhost", database: "test", }; var cp = new rdx.ConnectionPool(cfg); var User = new rdx.Model(cp, 'users'); var Collection = new rdx.Model(cp, 'collections'); var Item = new rdx.Model(cp, 'items'); User.toMany('collections', Collection, Collection.fields["user_id"]); Collection.belongsTo('user', Collection.fields["user_id"], User); Collection.toMany('items', Item, Item.fields['collection_id']); Item.belongsTo('collections',Item.fields["collection_id"], Collection); u = User.create({email: "a@b", user_type: 0}, false) u.destroySync() u = User.find("1", false) u.collections.findOne(false).user.findOne(false) u = User.where('id = 1').findOne(false); User.find("1", function(err, res) { console.log(res); }); u.collections.where("name like '%book'").all(function(err, res) { console.log(res); }) Installation ------------ Here is how you can install RDX: npm install rdx Contributing ------------ Contributions to this project are most welcome, so feel free to fork, improve and submit pull requests. The test suite requires nodeunit https://github.com/caolan/nodeunit and can be run using the command node test.js TODO ------------ * Add tests for object creation, updation, deletion, etc. * Better error handling * SQL escaping, improve where clause
You have the package name rdx
on https://www.npmjs.com/.
I would like to use that name if you're not maintaining this anymore.
Please let me know, thank you :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.