Giter VIP home page Giter VIP logo

orm-html5's Introduction

Object-Relational mapping for Web SQL is a LGPL JavaScript? library that allows you develop easily rich database Internet apps using the ORM paradigm.

ORM HTML5 is inspired by Django model.

How to?
1. Include "orm.js"
    <script language="JavaScript" src="orm.js"></script>
2. Define your models
    <script language="JavaScript">

      function Client(db)
      {
        this.base = ModelBase;
        this.base("client");         // Name of table
               // Specifies the fields: 
               //             name:       string not null
               //             surname:    string
               //             age:        integer
        this.fields = ["snName", "sSurname", "iAge"];
               // Preload objects in table      
        this.predata = [   {id:1, name: 'John' , surname: 'Smith', age: 20 },
                           {id:2, name: 'Ana' , surname: 'Castillo', age: null} ];
        // Initialiaze
        this.init(db);       
      }
      // Create DB Manager
      dbm = new DBM('ERP');
      // Register your models
      dbm.register(['Client']);
    </script>
3. Use it!
    <script language="JavaScript">

      var c = new Client(dbm);
      c.name = 'David';
      c.surname = 'Lohan';
      c.age = '30';
      c.save(function (result) { if (result) alert('save ok'); });
    </script>
How works?
ORM-HTML5 use Javascript's reflection and Web SQL API (no needs external libraries).

DBM.register() create the tables of models if is necessary. Also loads "preload" data.


orm-html5's People

Contributors

jmrobles avatar

Watchers

Álvaro Felipe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.