Project

virsandra

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Cassandra CQL3 persistence for Virtus extended classes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0.4
~> 2.13.0
~> 0.7.1
~> 0.3.0

Runtime

~> 1.1.0.pre7
~> 0.5.5
 Project Readme

Virsandra Build Status Code Climate Dependency Status Coverage Status

The Cassandra backed models with Virtus gem with a stupid name.

Moving target

Virsandra is meant to make it easy to use cassandra for persistence for models build with virtus.

The feature set will likely remain simple, the idea is to not block development of other projects while the implementation of CQL changes quickly.

Schema yourself

At this stage, you're on your own in terms of schema management. The gem expects you to maintain table <=> model attribute mappings yourself.

Example usage

require 'virsandra'

Virsandra.configure do |c|
  c.servers = "127.0.0.1"
  c.keyspace = "example_keyspace"
end

To define a Company model backed by a table companies using a composite primary key of name text, founder text:

class Company
  include Virsandra::Model

  attribute :name, String
  attribute :founder, String
  attribute :turnover, Fixnum
  attribute :founded, Date

  table :companies
  key :name, :founder
end

Create a company:

company = Company.new(name: "Gooble",
                      founder: "Larry Brin",
                      turnover: 2000000,
                      founded: 1884)
company.save

Find the company by key:

company = Company.find(name: "Gooble", founder: "Larry Brin")

Find or initialize a company. If there is a row with the same primary key, this will load missing attributes from cassandra and merge new ones.

company = Company.load(name: "Gooble", founder: "Larry Brin", foundec: 2012)
company.attributes
#=> {name: "Gooble", founder: "Larry Brin", turnover: 2000000, founded: 2012}

Search for companies:

companies = Companies.all

googbles = Companies.where(name: 'Gooble')

company_names = Companies.all.map(&:name)

TODO / Milestones

Todos are managed with Github issues, hopefully assigned to a milestone.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request