0.01
No release in over 3 years
Low commit activity in last 3 years
Builder of the CQL statements.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.0.11
~> 0.11
~> 0.3
 Project Readme

QueryBuilder

Gem Version Build Status Dependency Status Code Climate Coverage Inline docs

Builder of CQL 3 (Cassandra Query Language) statements in OOP style.

Synopsis

require "query_builder"

include QueryBuilder::CQL::Operators # for operators like cql_gt, cql_lte below.

table = QueryBuilder::CQL.keyspace(:auth).table(:users)

statement = table
  .select(:id, :role)
  .select(name: :user)
  .where(id: cql_gt(1))
  .where(id: cql_lte(4))
  .using(consistency: :quorum)
  .limit(3)
# => #<QueryBuilder::CQL::Statements::Select ...>

statement.to_s
# => "SELECT id, role, user AS name FROM auth.users WHERE id > 1 AND id <= 4 USING consistency = 'quorum' LIMIT 3;"

See the list of all supported contexts, statements and operators.

The gem doesn't depend on any specific Cassandra driver. It could be used to extend official Datastax driver with features of CQL building.

It doesn't validate CQL statements, leaving this to either driver or Cassandra database.

Installation

Add this line to your application's Gemfile:

# Gemfile
gem "query_builder"

Then execute:

bundle

Or add it manually:

gem install query_builder

Compatibility

Tested under rubies compatible to MRI 1.9.3+.

Uses RSpec 3.0+ for testing and hexx-suit for dev/test tools collection.

Contributing

  • Read the STYLEGUIDE
  • Fork the project
  • Create your feature branch (git checkout -b my-new-feature)
  • Add tests for it
  • Commit your changes (git commit -am '[UPDATE] Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

License

See the MIT LICENSE.