A Mongoose Like ORM for MySQL
A Node.js Mongoose like ORM for MySQL
npm install hyena
Better documentation to follow...
var hyena = require'hyena';var connection = require'hyena/lib/mysql';var Schema = hyenaSchema;hyenaconnectconnectionuser: "example"password: "example"database: "example";var userSchema =name: type: 'string' required: trueemail: type: 'email' requried: trueclubhouse: type: 'Clubhouse' field: 'causes_sponsors_id' required: true;var clubhouseSchema =cause: type: 'Cause' field: 'cause_id' required: truesponsor: type: 'Sponsor' field: 'sponsor_id' required: trueis_wellness: type: 'boolean' default: falseis_public: type: 'boolean' default: trueis_open: type: 'boolean' default: false;var sponsorSchema =name: type: 'string' required: truelogo: type: 'url' default: '';sponsorSchemapre'save'console.log'Pre Save' thisname;next;;sponsorSchemapost'init'console.log'Post Init' thisname;next;;var causeSchema =name: type: 'string' required: truelogo: type: 'url' default: '';var User = hyenamodel'User' userSchema;var Clubhouse = hyenamodel'Clubhouse' clubhouseSchema 'causes_sponsors';var Sponsor = hyenamodel'Sponsor' sponsorSchema;var Cause = hyenamodel'Cause' causeSchema;var sponsor = ;sponsorname = 'Test Sponsor';var cause = name: 'Test Cause' ;var clubhouse = cause: cause sponsor: sponsor ;var user = name: 'Jon Doe' email: 'email@example.com' clubhouse: clubhouse ;asyncautocausesavecallback;sponsorsavecallback;clubhouse: 'cause' 'sponsor'clubhousesavecallback;user: 'clubhouse'usersavecallback;// Do something fabulous here.;
Hyena's are the closest relative to the Mongoose even though they look very different. SO when using this library keep that in mind. While this library is very similar to Mongoose it's also very different.
The MIT License (MIT)
Copyright (c) 2013 plus3network
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.