<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          ActiveRecord.jsJavaScript 對象映射框架

          聯(lián)合創(chuàng)作 · 2023-09-22 18:02

          ActiveRecord.js 是一個開源的JavaScript 對象映射框架,包括:

          • Google Gears (client-side persistence)
          • In Memory (if no SQL server is available on the client)
          • Adobe AIR (client-side persistence)
          • SQLite and MySQL (via Aptana Jaxer, the open source Ajax server)
          • additional environments (like HTML5) expected to come through working with the community on the project

          ActiveRecord.js abstracts away underlying SQL commands so that JavaScript developers can have a unified API for storing, finding, selecting and retrieving objects and their data using the ActiveRecord pattern popularized by the Ruby on Rails community.

          示例代碼:

          1. var User = ActiveRecord.define('users',{  
          2.     username: '',  
          3.     email: ''  
          4. });  
          5. User.hasMany('articles');  
          6.   
          7. var ryan = User.create({  
          8.     username: 'ryan',  
          9.     email: '[email protected]'  
          10. });  
          11.   
          12. var Article = ActiveRecord.define('articles',{  
          13.     name: '',  
          14.     body: '',  
          15.     user_id: 0  
          16. });  
          17. Article.belongsTo('user');  
          18.   
          19. var a = Article.create({  
          20.     name: 'Announcing ActiveRecord.js',  
          21.     user_id: ryan.id  
          22. });  
          23. a.set('name','Announcing ActiveRecord.js!!!');  
          24. a.save();  
          25.   
          26. a.getUser() == ryan;  
          27. ryan.getArticleList()[0] == a; 
          瀏覽 19
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  亚洲成人网站无码在线观看 | 国内外成人免费视频 | 97精品超碰一区二区三区 | 天天干天天干素人 | 欧美精品久久久久黄片18试看 |