Skip to content
/ casserole Public

🍲 Casserole - Cassandra object mapper for Node.js

License

Notifications You must be signed in to change notification settings

mhio/casserole

Repository files navigation

Cassandra JS Object Mapper. Build models and queries from JS objects. (WIP)

API docco

Install

yarn add casserole
npm i casserole --save

Usage

const { Client, Model } = require('casserole')

let client = new Client('my_keyspace') 

let CounterModel = Model.generate('Counter',{ 
  id: { type:'uuid', primary: true },
  name: 'string',
  count: 'integer',
})

async function go(){
  // Connect to Cassandra and sync all Models (in the default ModelStore)
  await client.connect() 

  // Use MyModel
  let myc = new CounterModel({ id: '12341234-1234-1234-1234-123412341234', name: 'kimmy', count: 5 })
  let res = await myc.execSave()
  console.log('Saved id "%s" result set:', mym.id, res)

  return client.disconnect()
}

go()

Links