Giter Site home page Giter Site logo

intersystems-ru / cache-javascript-odm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nikitaeverywhere/cache-javascript-odm

1.0 10.0 1.0 320 KB

The easiest access to InterSystems Caché database via object data model using JavaScript. This is a demo project.

License: MIT License

JavaScript 36.73% HTML 3.15% CSS 0.57% TeX 19.44% Apex 40.11%
intersystems-cache javascript odm databases cacheobjectscript-udl

cache-javascript-odm's Introduction

JavaScript ODM for InterSystems Caché

JavaScript Object Data Model - easiest workflow with InterSystems Caché objects from client JavaScript or NodeJS.

Note

This project is a result of InterSystems Innovations School hackathon which had its place 2015, by the team of Anton Gnibeda, Irene Mychailova and Nikita Savchenko. The code in this repository is provided "as-is" and is not ready for potential production use. For any further info, questions or requests please, submit an issue.

Usage

  1. Include the scripts to your application (see src/index.html example file);
  2. Import and compile DemoInstaller.xml to Caché (or import from sources, src directory);
  3. A new web application named "CJS" will be created during compilation;
  4. Now, serve the src/client directory and check the demo. Demo defaults to localhost and port number 57772, see test.js.

Features

// .connect("Server address and port", "Namespace", [Any Packages/classes], callback())
// Note: all the callbacks represented here are asynchronous and may be triggered in any order.
cjs.connector.connect("http://localhost:57772", "USER", ["School2015"], function (cache) {

  // creating a new object
  var p = new cache.School2015.Participant();
  p.Name = "Anton";
  p.Surname = "Gnibeda";
  p.$save(function(obj) {
    console.log("Participant with name " + obj.name + " saved!");
  });
	
  // opening existing object
  cache.School2015.Group.openById(1, function (group) {
    console.log("Points: " + group.Points);
  });
	
  // executing class method
  cache.School2015.Group.AddPoints(1, 1);

  // executing instance method
  cache.School2015.Group.openById(1, function (group) {
    group.PrintInfo(function (res) {
      console.log(res);
    });
  });
	
	// executing linq-like queries
  cache.School2015.Participant
    .query()
    .where("Carma < 100 OR Carma > 140")
    .where("$id > 10")
    .orderByDesc("Carma")
    .orderBy("Name")
    .exec(function(res) {
      console.table(res);
    });

});

cache-javascript-odm's People

Contributors

gra-ach avatar nikitaeverywhere avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.