一個新的Node.js數據庫ORM:Moron.js
Moron.js是一個新的 Node.js 數據庫 ORM,它基于 SQL Builder Knex.js,因此完全支持 SQLite、PostgreSQL、MySQL。Moron.js 給基礎的 CRUD 提供了一個非常語義化的 Query 方法,完全基于 Promise,還可以存儲一個 document到一個 row。
Person .query() .insert({firstName: 'Jennifer', lastName: 'Lawrence'}) .then(function (jennifer) { console.log(jennifer instanceof Person); // --> true console.log(jennifer.firstName); // --> 'Jennifer' console.log(jennifer.fullName()); // --> 'Jennifer Lawrence' }) .catch(function (err) { console.log('oh noes'); });
What moron.js gives you:
- An easy declarative way of defining models and relations between them
- Simple and fun way to fetch, insert, update and delete models using the full power of SQL
- A way to store complex documents as single rows
- Powerful mechanism for loading arbitrarily large trees of relations
- Completely Promise based API
- Simple transactions
- JSON schema validation
本文由用戶 cp6p 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!