{"id":26457128,"url":"https://github.com/azuqua/cassanknex","last_synced_at":"2025-04-09T06:09:32.717Z","repository":{"id":32413895,"uuid":"35990843","full_name":"azuqua/cassanknex","owner":"azuqua","description":"A CQL query builder written in the spirit of Knexjs","archived":false,"fork":false,"pushed_at":"2025-03-27T15:56:49.000Z","size":495,"stargazers_count":50,"open_issues_count":7,"forks_count":10,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-04-02T02:12:18.993Z","etag":null,"topics":["azuqua-io-role-library","cql-query-builder","datastax-driver","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azuqua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-21T04:24:38.000Z","updated_at":"2024-07-16T19:08:56.000Z","dependencies_parsed_at":"2024-06-18T19:58:35.696Z","dependency_job_id":"a7447978-77f0-4d26-80c2-a96bd42321a4","html_url":"https://github.com/azuqua/cassanknex","commit_stats":{"total_commits":161,"total_committers":11,"mean_commits":"14.636363636363637","dds":0.1925465838509317,"last_synced_commit":"a1245c3773d92933fbc3cfd2d28a95a43eceab17"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuqua%2Fcassanknex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuqua%2Fcassanknex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuqua%2Fcassanknex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuqua%2Fcassanknex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azuqua","download_url":"https://codeload.github.com/azuqua/cassanknex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azuqua-io-role-library","cql-query-builder","datastax-driver","nodejs"],"created_at":"2025-03-18T22:42:26.962Z","updated_at":"2025-04-09T06:09:32.701Z","avatar_url":"https://github.com/azuqua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![NPM Version][npm-image]][npm-url]\n[![Inline docs][inch-image]][inch-url]\n[![Build Status][circleci-image]][circleci-url]\n\n# CassanKnex\n\nA [fully tested][circleci-url] Apache Cassandra CQL query builder with support for the [DataStax NodeJS driver][cassandra-driver-url], written in the spirit of [Knex][knexjs-url] for [CQL 3.x][cassandra-cql-3_1-ref-url].\n\n## Installation\n\n```\nnpm install cassanknex\n```\n\n## Index\n\n- [Why CassanKnex](#WhyCassanknex)\n- [Usage](#Usage)\n  - [Generating Queries](#GeneratingQueries)\n  - [Executing Queries](#ExecutingQueries)\n  - [Bring Your Own Driver](#BYOD)\n  - [Quick Start](#Quickstart)\n  - [Debugging Queries](#Debugging)\n  - [Query Executors (Examples)](#QueryExecutors)\n    - [`exec`](#exec)\n    - [`eachRow`](#eachrow)\n    - [`stream`](#stream)\n    - [`batch`](#batch)\n  - [Query Commands (Examples)](#QueryCommands)\n    - [Rows](#QueryCommands-Rows)\n    - [Column Families](#QueryCommands-ColumnFamilies)\n    - [Keyspaces](#QueryCommands-Keyspaces)\n  - [Query Modifiers](#QueryModifiers)\n    - [Rows](#QueryModifiers-Rows)\n    - [Column Families](#QueryModifiers-ColumnFamilies)\n    - [Keyspaces](#QueryModifiers-Keyspaces)\n  - [Utility Methods](#UtilityMethods)\n- [ChangeLog](#ChangeLog)\n- [Releasing to NPM](#ReleasingToNPM)\n\n## \u003ca name=\"WhyCassanknex\"\u003e\u003c/a\u003eWhy (what's in a name)\n\nCQL was purposefully designed to be SQL-esq to enhance ease of access for those familiar w/ relational databases\nwhile Knex is the canonical NodeJS query builder for SQL dialects; however, even given the lexical similarities, the difference\nbetween the usage of CQL vs SQL is significant enough that adding CQL as yet another Knex SQL dialect does not make sense.\nThus, CassanKnex.\n\n## \u003ca name=\"Usage\"\u003e\u003c/a\u003eUsage\n\nCassanKnex can be used to execute queries against a Cassandra cluster via [`cassandra-driver`][cassandra-driver-url] (the official DataStax NodeJS driver) or as a simple CQL statement generator via the following relative instantiations:\n\n### \u003ca name=\"GeneratingQueries\"\u003e\u003c/a\u003eAs a query generator\n\nCompiled CQL statements can be retrieved at any time via the `cql` method.\n\n```js\nvar cassanKnex = require(\"cassanknex\")(\u003cDRIVER_OPTIONS|undefined\u003e);\nvar qb = cassanKnex(KEYSPACE).QUERY_COMMAND()\n          .QUERY_MODIFIER_1()\n          .\n          .\n          .QUERY_MODIFIER_N();\n\nvar cql = qb.cql(); // get the cql statement\n```\n\nWhere `KEYSPACE` is the name of the relevant keyspace and\n`QUERY_COMMAND` and `QUERY_MODIFIER` are among the list of available [Query Commands](#QueryCommands)  and [Query Modifiers](#QueryModifiers).\n\n`\u003cDRIVER_OPTIONS\u003e` may be provided to configure the client, and is an object w/ the following optional fields:\n\n- `connection`: `\u003cInitializedDatastaxDriverInstance\u003e` or `\u003cDatastaxConnectionArguments\u003e`\n  The client will use an initialized datastax driver instance if provied (either the [Cassandra driver][cassandra-driver-url] or [DSE driver][dse-driver-url] will work).\n  Alternatively, you can provide arguments that will be forwarded to the underlying Cassandra driver instance.\n  Default is 'undefined'\n- `debug`: `boolean`\n  Toggle debug logs (see [debugging](#Debugging)). Default is false\n- `awsKeyspace`: `boolean`\n  Toggle when using aws managed keyspaces. Will disable prepared statements on DDL statements. Default is false\n### \u003ca name=\"ExecutingQueries\"\u003e\u003c/a\u003eAs a query executor\n\nExecution of a given query is performed by invoking either the `exec`, `stream` or `eachRow` methods\n(which are straight pass throughs to the DataStax driver's `execute`, `stream` and `eachRow` [methods][cassandra-driver-docs-url], respectively);\nbatch queries may be executed via the `batch` method (again, a pass through to the DataStax driver's own `batch` method).\n\nYou may provide your own driver or use the included DataStax driver.\n\n```js\nvar cassanKnex = require(\"cassanknex\")({\n  connection: {\n    contactPoints: [\"LIST OF CONNECTION POINTS\"]\n  }\n});\n\ncassanKnex.on(\"ready\", function (err) {\n\n  if (err)\n    console.error(\"Error Connecting to Cassandra Cluster\", err);\n  else\n    console.log(\"Cassandra Connected\");\n\n  var qb = cassanKnex(KEYSPACE).QUERY_COMMAND()\n          .QUERY_MODIFIER_1()\n          .\n          .\n          .QUERY_MODIFIER_N();\n\n  // pass through to the underlying DataStax nodejs-driver 'execute' method\n\n  qb.exec(function(err, res) {\n    // do something w/ your query response\n  });\n\n  // OR pass through to the underlying DataStax nodejs-driver 'stream' method\n\n  var onReadable = function () {\n      // Readable is emitted as soon a row is received and parsed\n      var row;\n      while (row = this.read()) {\n        console.log(row);\n        // do something w/ the row response\n      }\n    }\n    , onEnd = function () {\n      // Stream ended, there aren't any more rows\n      console.log(\"query finished\");\n    }\n    , onError = function (err) {\n      // Something went wrong: err is a response error from Cassandra\n      console.log(\"query error\", err);\n    };\n\n  // Invoke the stream method\n  qb.stream({\n    \"readable\": onReadable,\n    \"end\": onEnd,\n    \"error\": onError\n  });\n\n  // OR pass through to the underlying DataStax nodejs-driver 'eachRow' method\n\n  var rowCallback = function (n, row) {\n      // The callback will be invoked per each row as soon as they are received\n      console.log(row);\n      // do something w/ the row response\n    }\n    , errorCb = function (err) {\n      // Something went wrong: err is a response error from Cassandra\n      console.log(\"query error\", err);\n    };\n\n  // Invoke the eachRow method\n  qb.eachRow(rowCallback, errorCb);\n\n  // Invoke the batch method to process multiple requests\n  cassanKnex().batch([qb, qb], function(err, res) {\n    // do something w/ your response\n  });\n});\n```\n\n#### \u003ca name=\"BYOD\"\u003e\u003c/a\u003eBring your own Driver\n\nWhile the package includes the vanilla [Cassandra driver][cassandra-driver-url] (supported by Datastax),\nand will use that driver to connect to your cluster if you provide a connection configuration, you may optionally provide your own initialized driver to the `cassaknex` constructor.\nThis allows for using either the [DSE driver][dse-driver-url] or a different version of the Cassandra driver, per your applications needs.\n\ne.g., w/ the built in `cassandra-driver`:\n\n```js\nvar cassanKnex = require(\"cassanknex\")({\n  connection: { // default is 'undefined'\n    contactPoints: [\"10.0.0.2\"]\n  },\n  exec: { // default is '{}'\n    prepare: false // default is 'true'\n  }\n});\n\ncassanKnex.on(\"ready\", function (err) {...});\n```\n\nor, using a custom `dse-driver` connection:\n\n```js\n// create a new dse-driver connection\nvar dse = require(\"dse-driver\");\nvar dseClient = new dse.Client({\n  contactPoints: [\"10.0.0.2\"],\n  queryOptions: {\n    prepare: true\n  },\n  socketOptions: {\n    readTimeout: 0\n  },\n  profiles: []\n});\n\n// initialize dse-driver connection\ndseClient.connect(function (err) {\n  if (err) {\n    console.log(\"Error initializing dse-driver\", err);\n  }\n  else {\n    // provide connection to cassanknex constructor\n    var cassanKnex = require(\"cassanknex\")({\n      connection: dseClient,\n      debug: false\n    });\n\n    cassanKnex.on(\"ready\", function (err) {\n      // ...\n    });\n  }\n});\n```\n\n#### \u003ca name=\"Quickstart\"\u003e\u003c/a\u003eQuickstart\n\n\n```js\nvar cassanKnex = require(\"cassanknex\")({\n  connection: { // default is 'undefined'\n    contactPoints: [\"10.0.0.2\"]\n  },\n  exec: { // default is '{}'\n    prepare: false // default is 'true'\n  },\n  awsKeyspace: false // default is 'false'\n});\n\ncassanKnex.on(\"ready\", function (err) {\n\n  if (err)\n    console.error(\"Error Connecting to Cassandra Cluster\", err);\n  else {\n    console.log(\"Cassandra Connected\");\n\n  var qb(\"keyspace\").select(\"id\", \"foo\", \"bar\", \"baz\")\n    .ttl(\"foo\")\n    .where(\"id\", \"=\", \"1\")\n    .orWhere(\"id\", \"in\", [\"2\", \"3\"])\n    .orWhere(\"baz\", \"=\", \"bar\")\n    .andWhere(\"foo\", \"IN\", [\"baz\", \"bar\"])\n    .limit(10)\n    .from(\"table\")\n    .exec(function(err, res) {\n\n      // executes query :\n      //  'SELECT \"id\",\"foo\",\"bar\",\"baz\",ttl(\"foo\") FROM \"keyspace\".\"table\"\n      //    WHERE \"id\" = ? OR \"id\" in (?, ?)\n      //    OR \"baz\" = ? AND \"foo\" IN (?, ?)\n      //    LIMIT 10;'\n      // with bindings array  : [ '1', '2', '3', 'bar', 'baz', 'bar' ]\n\n      if (err)\n        console.error(\"error\", err);\n      else\n        console.log(\"res\", res);\n\n    });\n  }\n});\n\n```\n\n#### \u003ca name=\"Debugging\"\u003e\u003c/a\u003eDebugging\n\nTo enable `debug` mode pass `{ debug: true }` into the CassanKnex `require` statement, e.g.\n\n```\nvar cassanKnex = require(\"cassanknex\")({ debug: true });\n\n```\n\nWhen `debug` is enabled the query object will be logged upon execution,\nand you'll receive two informational components provided to ease the act of debugging:\n\n1. `_queryPhases`:\n  - An array showing the state of the query string at each step of it's compilation.\n2. `_methodStack`:\n  - An array showing the methods called throughout the modification lifespan of the query object.\n  You'll notice that the 'compiling' method is called after each modification in this stack, that's due to\n  re-compiling the query statement (and pushing the result into `_queryPhases`) at each step, when `debug == false`\n  the `_cql` query statement and accompanying `_bindings` array are not created until either `qb.cql()` or `qb.exec()`\n  are called.\n\nSo you'll see something akin to the following `insert` statement upon invoking either `qb.cql()` or `qb.exec()`:\n```js\nvar values = {\n  \"id\": \"foo\"\n  , \"bar\": \"baz\"\n  , \"baz\": [\"foo\", \"bar\"]\n};\nvar qb = cassanknex(\"cassanKnexy\");\nqb.insert(values)\n      .usingTimestamp(250000)\n      .usingTTL(50000)\n      .into(\"columnFamily\")\n      .cql();\n\n// =\u003e\n{ _debug: true,\n  _dialect: 'cql',\n  _exec: {},\n  _execPrepare: true,\n  _keyspace: 'cassanKnexy',\n  _columnFamily: 'columnFamily',\n  _methodStack:\n   [ 'insert',\n     'usingTimestamp',\n     'insert',\n     'usingTTL',\n     'insert',\n     'into',\n     'insert',\n     'insert' ],\n  _queryPhases:\n   [ 'INSERT INTO  (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?);',\n     'INSERT INTO  (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?) USING TIMESTAMP ?;',\n     'INSERT INTO  (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?) USING TIMESTAMP ? AND USING TTL ?;',\n     'INSERT INTO \"cassanKnexy\".\"columnFamily\" (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?) USING TIMESTAMP ? AND USING TTL ?;',\n     'INSERT INTO \"cassanKnexy\".\"columnFamily\" (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?) USING TIMESTAMP ? AND USING TTL ?;' ],\n  _cql: 'INSERT INTO \"cassanKnexy\".\"columnFamily\" (\"id\",\"bar\",\"baz\") VALUES (?, ?, ?) USING TIMESTAMP ? AND USING TTL ?;',\n  _bindings: [ 'foo', 'baz', [ 'foo', 'bar' ], 250000, 50000 ],\n  _statements:\n   [ { grouping: 'compiling', type: 'insert', value: [Object] },\n     { grouping: 'using', type: 'usingTimestamp', val: 250000 },\n     { grouping: 'using', type: 'usingTTL', val: 50000 } ],\n  ... }\n```\n\n\u003e While fuller documentation for all methods is in the works, **the [test files](./tests) provide thorough examples as to method usage**.\n\n#### \u003ca name=\"QueryExecutors\"\u003e\u003c/a\u003eQuery Executors\n\n\u003e All methods take an optional `options` object as the first argument in the call signature; if provided, the options will be passed through to the corresponding `cassandra-driver` call.\n\n##### exec\n\n  - *execute a query and return the response via a callback*:\n\n  ```js\n  var item = {\n    foo: \"bar\",\n    bar: [\"foo\", \"baz\"]\n  };\n  var qb = cassanKnex(\"cassanKnexy\")\n    .insert(item)\n    .into(\"columnFamily\")\n    .exec(function(err, result) {\n      // do something w/ your err/result\n    });\n\n    // w/ options\n    qb.exec({ prepare: false }, function(err, result) {\n       // do something w/ your err/result\n     });\n  ```\n\n##### eachRow\n\n  - *execute a query and invoke a callback as each row is received*:\n\n  ```js\n  var rowCallback = function (n, row) {\n      // Readable is emitted as soon a row is received and parsed\n    }\n    , errorCallback = function (err) {\n      // Something went wrong: err is a response error from Cassandra\n    };\n\n  var qb = cassanKnex(\"cassanKnexy\")\n    .select()\n    .from(\"columnFamily\");\n\n  // Invoke the eachRow method\n  qb.eachRow(rowCallback, errorCallback);\n  ```\n\n##### stream\n\n  - *execute a query and stream each row as it is received*:\n\n  ```js\n  var onReadable = function () {\n      // Readable is emitted as soon a row is received and parsed\n      var row;\n      while (row = this.read()) {\n        // do something w/ your row\n      }\n    }\n    , onEnd = function () {\n      // Stream ended, there aren't any more rows\n    }\n    , onError = function (err) {\n      // Something went wrong: err is a response error from Cassandra\n    };\n\n  var qb = cassanKnex(\"cassanKnexy\")\n    .select()\n    .from(\"columnFamily\");\n\n  // Invoke the stream method\n  qb.stream({\n    \"readable\": onReadable,\n    \"end\": onEnd,\n    \"error\": onError\n  });\n  ```\n\n##### batch\n\n  - *execute a batch of cassanknex queries in a single batch statement*:\n\n  ```js\n  var qb1 = cassanKnex(\"cassanKnexy\")\n    .insert({foo: \"is bar\"})\n    .usingTimestamp(250000)\n    .usingTTL(50000)\n    .into(\"columnFamily\");\n\n  var qb2 = cassanKnex(\"cassanKnexy\")\n    .insert({bar: \"is foo\"})\n    .usingTimestamp(250000)\n    .usingTTL(50000)\n    .into(\"columnFamily\");\n\n  // w/o options\n  cassanKnex().batch([qb1, qb2], function(err, res) {\n      // do something w/ your err/result\n  });\n\n  // w/ options\n  cassanKnex().batch({prepare: true}, [qb1, qb2], function(err, res) {\n      // do something w/ your err/result\n  });\n  ```\n\n#### \u003ca name=\"QueryCommands\"\u003e\u003c/a\u003eQuery Commands\n\n##### \u003ca name=\"QueryCommands-Rows\"\u003e\u003c/a\u003e*For standard (row) queries*:\n- insert - *compile an __insert__ query string*\n\n  ```js\n      var qb = cassanKnex(\"cassanKnexy\")\n        , values = {\n          \"id\": \"foo\"\n          , \"bar\": \"baz\"\n          , \"baz\": [\"foo\", \"bar\"]\n        };\n      qb.insert(values)\n        .usingTimestamp(250000)\n        .usingTTL(50000)\n        .into(\"columnFamily\");\n\n      // =\u003e INSERT INTO cassanKnexy.columnFamily (id,bar,baz)\n      //      VALUES (?, ?, ?)\n      //      USING TIMESTAMP ?\n      //      AND USING TTL ?;\n  ```\n- select - *compile a __select OR select as__ query string*\n  - select all columns for a given query:\n\n    ```js\n    var qb = cassanKnex(\"cassanKnexy\");\n    qb.select(\"id\", \"foo\", \"bar\", \"baz\")\n      .ttl(\"foo\")\n      .where(\"id\", \"=\", \"1\")\n      .orWhere(\"id\", \"in\", [\"2\", \"3\"])\n      .orWhere(\"baz\", \"=\", \"bar\")\n      .andWhere(\"foo\", \"IN\", [\"baz\", \"bar\"])\n      .limitPerPartition(10)\n      .from(\"columnFamily\");\n\n    // =\u003e SELECT \"id\",\"foo\",\"bar\",\"baz\",ttl(\"foo\") FROM \"cassanKnexy\".\"columnFamily\"\n    //      WHERE \"id\" = ?\n    //      OR \"id\" in (?, ?)\n    //      OR \"baz\" = ?\n    //      AND \"foo\" IN (?, ?)\n    //      PER PARTITION LIMIT ?;\n    ```\n  - 'select as' specified columns:\n\n    ```js\n    var qb = cassanKnex(\"cassanKnexy\");\n    qb.select({id: \"foo\"})\n      .ttl({id: \"fooTTL\"})\n      .limit(10)\n      .from(\"columnFamily\");\n\n    // =\u003e SELECT \"id\" AS \"foo\",ttl(\"id\") AS \"fooTTL\" FROM \"cassanKnexy\".\"columnFamily\" LIMIT ?;\n    ```\n- update - *compile an __update__ query string*\n  - simple set column values:\n\n  ```js\n    var qb = cassanKnex(\"cassanKnexy\");\n    qb.update(\"columnFamily\")\n      .set(\"bar\", \"foo\")\n      .set(\"foo\", \"bar\")\n      .where(\"foo[bar]\", \"=\", \"baz\")\n      .where(\"id\", \"in\", [\"1\", \"1\", \"2\", \"3\", \"5\"]);\n\n    // =\u003e UPDATE cassanKnexy.columnFamily\n    //      SET bar = ?,foo = ?\n    //      WHERE foo[bar] = ?\n    //      AND id in (?, ?, ?, ?, ?);\n  ```\n\n  set column values using object parameters:\n\n  ```js\n  var qb = cassanKnex(\"cassanKnexy\");\n  qb.update(\"columnFamily\")\n    .set({\n      \"bar\": \"baz\",\n      \"foo\": [\"bar\", \"baz\"]\n    })\n    .where(\"foo[bar]\", \"=\", \"baz\")\n    .where(\"id\", \"in\", [\"1\", \"1\", \"2\", \"3\", \"5\"]);\n\n  // =\u003e UPDATE cassanKnexy.columnFamily\n  //      SET bar = ?,foo = ?\n  //      WHERE foo[bar] = ?\n  //      AND id in (?, ?, ?, ?, ?);\n  ```\n\n  - add or remove from map or list:\n\n  ```js\n  var qb = cassanKnex(\"cassanKnexy\");\n  qb.update(\"columnFamily\")\n    .add(\"bar\", {\"foo\": \"baz\"}) // \"bar\" is a map\n    .remove(\"foo\", [\"bar\"]) // \"foo\" is a set\n    .where(\"id\", \"=\", 1);\n\n  // =\u003e UPDATE cassanKnexy.columnFamily\n  //      SET \"bar\" = \"bar\" + ?,\n  //          \"foo\" = \"foo\" - ?;\n  //      WHERE id = ?;\n  ```\n\n  or w/ object notation:\n\n  ```js\n  var qb = cassanKnex(\"cassanKnexy\");\n  qb.update(\"columnFamily\")\n    .add({\n      \"bar\": {\"baz\": \"foo\"}, // \"bar\" is a map\n      \"foo\": [\"baz\"] // \"foo\" is a set\n    })\n    .remove({\n      \"bar\": [\"foo\"], // \"bar\" is a map\n      \"foo\": [\"bar\"] // \"foo\" is a set\n    })\n    .where(\"id\", \"=\", 1);\n  ```\n\n  - increment or decrement counter columns:\n\n  ```js\n  var qb = cassanKnex(\"cassanKnexy\");\n  qb.update(\"columnFamily\")\n    .increment(\"bar\", 5) // incr by 5\n    .increment(\"baz\", 7) // incr by 7\n    .decrement(\"foo\", 9) // decr by 9\n    .decrement(\"bop\", 11) // decr by 11\n    .where(\"id\", \"=\", 1);\n\n  // =\u003e UPDATE cassanKnexy.columnFamily\n  //      SET \"bar\" = \"bar\" + ?,\n  //          \"baz\" = \"baz\" + ?,\n  //          \"foo\" = \"foo\" - ?;\n  //      WHERE id = ?;\n  ```\n\n  or w/ object notation:\n\n  ```js\n  var qb = cassanKnex(\"cassanKnexy\");\n  qb.update(\"columnFamily\")\n    .increment({\"bar\": 5, \"baz\": 7})\n    .decrement({\"foo\": 9, \"bop\": 11})\n    .where(\"id\", \"=\", 1);\n  ```\n\n- delete - *compile a __delete__ query string*\n  - delete all columns for a given row:\n\n    ```js\n      var qb = cassanknex(\"cassanKnexy\");\n      qb.delete()\n        .from(\"columnFamily\")\n        .where(\"foo[bar]\", \"=\", \"baz\")\n        .where(\"id\", \"in\", [\"1\", \"1\", \"2\", \"3\", \"5\"]);\n\n      // =\u003e DELETE  FROM cassanKnexy.columnFamily\n      //      WHERE foo[bar] = ?\n      //      AND id in (?, ?, ?, ?, ?);\n    ```\n  - delete specified columns for a given row:\n\n    ```js\n      var qb = cassanknex(\"cassanKnexy\");\n      qb.delete([\"foo\", \"bar\"])\n      // OR\n      qb.delete(\"foo\", \"bar\")\n\n        .from(\"columnFamily\")\n        .where(\"foo[bar]\", \"=\", \"baz\")\n        .where(\"id\", \"in\", [\"1\", \"1\", \"2\", \"3\", \"5\"]);\n\n      // =\u003e DELETE foo,bar FROM cassanKnexy.columnFamily\n      //      WHERE foo[bar] = ?\n      //      AND id in (?, ?, ?, ?, ?);\n    ```\n\n##### \u003ca name=\"QueryCommands-ColumnFamilies\"\u003e\u003c/a\u003e*For column family queries*:\n- alterColumnFamily\n- createColumnFamily\n- createColumnFamilyIfNotExists\n- createIndex\n- createIndexCustom\n- createType\n- createTypeIfNotExists\n- dropColumnFamily\n- dropColumnFamilyIfExists\n- dropType\n- dropTypeIfExists\n- truncate\n\n##### \u003ca name=\"QueryCommands-Keyspaces\"\u003e\u003c/a\u003e*For keyspace queries*:\n- alterKeyspace\n- createKeyspace\n- createKeyspaceIfNotExists\n- dropKeyspace\n- dropKeyspaceIfExists\n\n#### \u003ca name=\"QueryModifiers\"\u003e\u003c/a\u003eQuery Modifiers\n\n##### \u003ca name=\"QueryModifiers-Rows\"\u003e\u003c/a\u003e*For standard (row) queries*:\n- from\n- into\n- where\n- andWhere\n- orWhere\n- tokenWhere\n- minTimeuuidWhere\n- maxTimeuuidWhere\n- set\n- add\n- remove\n- increment\n- decrement\n- if\n- ifExists\n- ifNotExists\n- usingTTL\n- usingTimestamp\n- limit\n- limitPerPartition\n- orderBy\n- ttl\n- count\n- writetime\n- dateOf\n- unixTimestampOf\n- toDate\n- toTimestamp\n- toUnixTimestamp\n\n##### \u003ca name=\"QueryModifiers-ColumnFamilies\"\u003e\u003c/a\u003e*For column family queries*:\n- alter\n- drop\n- rename\n- primary\n- list\n- set\n- decimal\n- boolean\n- blob\n- timestamp\n- inet\n- bigint\n- counter\n- double\n- int\n- float\n- map\n- ascii\n- text\n- timeuuid\n- uuid\n- varchar\n- frozen\n- frozenSet\n- frozenMap\n- with\n- withCaching\n- withCompression\n- withCompaction\n- withClusteringOrderBy\n- withOptions\n\n##### \u003ca name=\"QueryModifiers-Keyspaces\"\u003e\u003c/a\u003e*For keyspace queries*:\n- withSingleRegionStrategy\n- withNetworkTopologyStrategy\n- withSimpleStrategy\n- withDurableWrites\n\n#### \u003ca name=\"UtilityMethods\"\u003e\u003c/a\u003eUtility Methods\n\n- getClient, returns the Datastax Cassandra Driver in use.\n\n```js\nvar cassanKnex = require(\"cassanknex\")({\n  connection: {\n    contactPoints: [\"10.0.0.2\"]\n  }\n});\n\ncassanKnex.on(\"ready\", function (err) {\n\n  if (err)\n    console.error(\"Error Connecting to Cassandra Cluster\", err);\n  else {\n    console.log(\"Cassandra Connected\");\n\n    // get the Cassandra Driver\n    var client = cassanKnex.getClient();\n  }\n});\n```\n\n- getDriver, returns the raw Datastax Cassandra Driver dependency module.\n\n```js\nvar cassanKnex = require(\"cassanknex\")();\n\n// get the Cassandra Driver\nvar driver = cassanKnex.getDriver();\n```\n\n#### \u003ca name=\"ChangeLog\"\u003e\u003c/a\u003eChangeLog\n- 2.0.2\n  - Upgrades to dependency versions.\n- 2.0.1\n  - Major version upgrade of `mocha` dev dependency from 6.2.0 to 9.2.2\n- 2.0.0\n  - Major version upgrade of `cassandra-driver` dependency from v3 to v4\n- 1.21.1\n  - Upgrades to dependency versions.\n- 1.21.0\n  - Added support for managed Aws Keyspaces when cassanknex is initialized with `awsKeyspace`\n  - Added Single Region Replication Strategy for Aws Keyspaces\n- 1.20.5\n  - Upgrades to dependency versions.\n- 1.20.4\n  - Upgrades to dependency versions.\n- 1.20.3\n  - Changes to test framework per [61](https://github.com/azuqua/cassanknex/pull/61).\n  - Upgrades to all dependency versions.\n- 1.20.2\n  - Upgrade lodash per CVE-2019-10744\n- 1.20.1\n  - Update dependencies.\n- 1.20.0\n  - Add QueryModifier `with` for column family statements.\n- 1.19.0 (@dekelev is killing it w/ new features :thumbsup:)\n  - Add where clause QueryModifiers `minTimeuuidWhere` and `maxTimeuuidWhere`, and aggregation QueryModifiers `dateOf`, `unixTimestampOf`, `toDate`, `toTimestamp`, `toUnixTimestamp` per [#48](https://github.com/azuqua/cassanknex/pull/48).\n- 1.18.0 (Special thanks to @dekelev for these contributions)\n  - Update project library dependencies per [#42](https://github.com/azuqua/cassanknex/pull/42).\n  - Fix issue when using both the `usingTimestamp` \u0026 `usingTTL` query modifiers per [#43](https://github.com/azuqua/cassanknex/pull/43).\n  - Add `writetime` query modifier per [#44](https://github.com/azuqua/cassanknex/pull/44/files).\n  - Add `tokenWhere` query modifier per [#45](https://github.com/azuqua/cassanknex/pull/45/files).\n- 1.17.0\n  - Add `Date` type for column family compilation.\n- 1.16.0\n  - Add QueryModifier `count`, per issue [#30](https://github.com/azuqua/cassanknex/issues/30).\n  - Update DataStax Driver module from `3.1.6` to `3.2.2`.\n- 1.15.0\n  - Add bring-your-own-driver support.\n  - Allow supplying clustered columns via array input in the `createColumnFamily` `primary` annotation, per issue [#35](https://github.com/azuqua/cassanknex/issues/35).\n- 1.14.0\n  - Add QueryModifiers `withOptions`, `limitPerPartition`, `ttl`, `add` and `remove`, `increment` and `decrement`.\n  - Add QueryCommand `createIndexCustom`.\n  - Update DataStax Driver module from `3.1.5` to `3.1.6`.\n- 1.13.1\n  - Update DataStax Driver module from `3.1.1` to `3.1.5`.\n- 1.13.0\n  - Add `if` (for `update`), `ifExists` (for `update`), and `ifNotExists` (for `insert`) per PR [#28](https://github.com/azuqua/cassanknex/pull/28).\n- 1.12.1\n  - Update DataStax Driver module from `2.2.2` to `3.1.1`.\n- 1.12.0\n  - Add `getDriver` method to allow retrieving the raw DataStax Driver module from cassanknex per issue [#25](https://github.com/azuqua/cassanknex/issues/25).\n  - Update DataStax Driver module from `2.2.1` to `2.2.2`.\n- 1.11.0\n  - Add `getClient` method to allow retrieving the Cassandra Driver instance from cassanknex.\n- 1.10.1\n  - Patch invalid error response when executing commands via an uninitialized Cassandra client.\n- 1.10.0\n  - Add QueryModifier `orderBy` for standard queries.\n- 1.9.0\n  - Add `truncate` functionality.\n- 1.8.0\n  - Add `batch` execution functionality per the specifications laid out in issue [#19](https://github.com/azuqua/cassanknex/issues/19).\n- 1.7.1\n  - Wrap all keyspace, column family, and column names in double quotes to preserve case per issue [#14](https://github.com/azuqua/cassanknex/issues/14).\n  - Fix `frozen set` statement compilation per issue [#16](https://github.com/azuqua/cassanknex/issues/16).\n  - Fix `frozen list` statement compilation per issue [#17](https://github.com/azuqua/cassanknex/issues/17).\n- 1.7.0\n  - Add QueryCommands `createType`/`IfNotExists` and `dropType`/`IfExists`.\n  - Add QueryModifiers `frozen`/`Set`/`Map`/`List`.\n  - 1.7.0 features added per issue [#10](https://github.com/azuqua/cassanknex/issues/10).\n- 1.6.0\n  - Add `options` support for `eachRow` per issue [#8](https://github.com/azuqua/cassanknex/issues/8).\n- 1.5.1, 1.5.2\n  - OMG DOCS!\n- 1.5.0\n  - Add QueryCommand `delete`.\n- 1.4.0\n  - Add support for object style `set` calls; e.g. `.set(\u003cObject := {\u003cString\u003e: \u003cMixed\u003e, ...}\u003e)`.\n- 1.3.0\n  - Add support for the DataStax driver `eachRow` method.\n- 1.2.0\n  - Add support for the DataStax driver `stream` method.\n- 1.1.0\n  - Add QueryCommand `createIndex`.\n  - Add QueryModifier `allowFiltering`.\n\n#### \u003ca name=\"ReleasingToNPM\"\u003e\u003c/a\u003eReleasing To NPM\n\nAll CICD logic is managed by CircleCI via the configuration in the `.circleci/` directory.\n\nThis configuration will automatically package and publish a new version to NPM when an appropriate Github Release is created.\n\nSo, to publish a new version, simply create a new Github Release whose name matches the current release version (i.e., `v1.20.5`).\n\n[npm-image]: https://img.shields.io/npm/v/cassanknex.svg?style=flat\n[npm-url]: https://npmjs.org/package/cassanknex\n[inch-image]: http://inch-ci.org/github/azuqua/cassanknex.svg?branch=master\u0026style=shields\n[inch-url]: http://inch-ci.org/github/azuqua/cassanknex\n[circleci-image]: https://circleci.com/gh/azuqua/cassanknex/tree/master.svg?style=svg\n[circleci-url]: https://circleci.com/gh/azuqua/cassanknex\n\n[cassandra-cql-3_1-ref-url]: http://docs.datastax.com/en/cql/3.1/cql/cql_reference/cqlReferenceTOC.html\n[cassandra-driver-url]: https://github.com/datastax/nodejs-driver\n[dse-driver-url]: https://github.com/datastax/nodejs-driver-dse\n[cassandra-driver-docs-url]: http://docs.datastax.com/en/drivers/nodejs/2.1/Client.html\n[knexjs-url]: http://knexjs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuqua%2Fcassanknex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuqua%2Fcassanknex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuqua%2Fcassanknex/lists"}