Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Umanni FORK, with Cassandra 0.7 features for Tienle Cassandra-Model
Ruby Shell

This branch is 61 commits ahead, 4 commits behind tienle:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.document
.gitignore
Gemfile
LICENSE
README.rdoc
Rakefile
cassilds-model.gemspec

README.rdoc

cassilds-model

Simple model support for Cassandra (github.com/fauna/cassandra)

Currently, it supports:

  • Keys (String, Time_UUID)

  • Serialisation (String, Integer, Float, Boolean, DateTime, JSON)

  • Callbacks

  • Validations

Getting started

gem install cassilds-model

Define

require 'cassandra-model'

class User << CassandraModel::Base
  column_family :Users

  key :username, :string
  column :full_name
  column :created, :datetime
  column :profile, :json

  write_consistency_level Cassandra::Consistency::ALL
  before_save :set_created_at

  validation do
    errors << "full name required" if full_name.blank?
  end

private

  def set_created_at
    self.created = Time.now
  end
end

CRUD

User.create(:username => 'foo', :full_name => 'foo bar')

foo = User.new(:username => 'foo', :full_name => 'foo bar')
foo.save

foo.full_name = 'foo baz'
foo.save

foo = User['foo']
foo = User.get('foo')

foo.destroy

Copyright

Copyright © 2010 Tien Le. See LICENSE for details.

Something went wrong with that request. Please try again.