joi-of-cql

2.0.6 • Public • Published

joi-of-cql

Create cql type definitions from joi schema validations

Usage

var joc = require('joi-of-cql');

apollo.define('car', {
  schema: joc.object({
    car_id: joc.cql.uuid(),
    manufacturer_id: joc.cql.uuid(),
    drivers: joc.set(joc.cql.uuid())
  }).partitionKey('car_id')
    .clusteringKey('manufacturer_id')
CQL Data Type Validation Type
ascii cql.ascii()
bigint cql.bigint()
blob cql.blob()
boolean cql.boolean()
counter cql.counter()
decimal cql.decimal()
double cql.double()
float cql.float()
inet cql.inet()
text cql.text()
timestamp cql.timestamp()
timeuuid cql.timeuuid()
uuid cql.uuid()
varchar cql.varchar()
varint cql.varint()
map cql.map(cql.text(), cql.text()),
set cql.set(cql.text())

Extensions to Joi.Object

  • .partitionKey(key) - key can be an array or a single string identifying one or more of the properties in the schema as a partition key.
  • .partitionKey() - retrieve the previously defined partition key.
  • .clusteringKey(key) - key can be an array or a single string identifying one or more of the properties in the schema as a clustering key.
  • .clusteringKey() - retrieve the previously defined clustering key.
  • .lookupKeys(...keys) - either an array of lookup keys or lookup keys passed as arguments that are collected into an array.
  • .lookupKeys() - retrieve the previously defined lookup keys.
  • .aliases() - retrieve the previously defined renamed properties.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.6
    0
    • latest

Version History

Package Sidebar

Install

npm i joi-of-cql

Weekly Downloads

9

Version

2.0.6

License

MIT

Unpacked Size

41.8 kB

Total Files

9

Last publish

Collaborators

  • jpage
  • samshull
  • scommisso
  • jcrugzz
  • indexzero