glass-relay

Strictly typed simple object model with string, set, and numeric primitives defined per object, with redis backing.

Usage no npm install needed!

<script type="module">
  import glassRelay from 'https://cdn.skypack.dev/glass-relay';
</script>

README

Reading a GlassRelayObject


const GlassRelay = require('glass-relay');

const pid = '3000';
const fetch = {
    options: [],  // These options will be searchable if true
    datum: []     // These datum keys will be searchable (all non empty values)
};

const rf = GlassRelay.RedisFoundation.createPlatform(pid, fetch, (err)=>{
  
  if (err) throw new Error(err);
});

rf.start((err)=>{
  
  if (err) throw new Error(err);
  
  const id = "ISOMEUID";  // ISOMEUID is the primary key which holds all primitives
  
  const gro = GlassRelay.Object.fromRedis(rf, id, (error)=>{
    // Called when data has been retreived, or an error occurred.
  
    if (error) throw new Error(error);
  
    console.log(gro.toObject());
   
  });  
  
});
{
  id : "ISOMEUID"
  options: {
    // true \ false values
  }
  records: {
    // numeric values
  }
  datum: {
    // string values
  }
  pool: []
  core: []
}