Skip to content
A library for persisting your objects into cassandra.
Find file
Pull request Compare This branch is 114 commits behind NZKoz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/cassandra_object
test
LICENSE
README
Rakefile
SPEC

README

Provides a nice API for cassandra backed storage.  Because I'm too lazy to write docs for something so new, here is an example:

        class Customer < CassandraObject::Base
          attribute :first_name,    :type => String
          attribute :last_name,     :type => String
          attribute :date_of_birth, :type => Date
  
          validate :should_be_cool

          key :uuid
  
          index :last_name
  
          association :invoices, :unique=>false, :inverse_of=>:customer

          private
  
          def should_be_cool
            unless ["Michael", "Anika", "Evan"].include?(first_name)
              errors.add(:first_name, "must be that of a cool person")
            end
          end


        end

        class Invoice < CassandraObject::Base
          attribute :number, :type=>Integer
          attribute :total, :type=>Float
          attribute :gst_number, :type=>String
  
          index :number, :unique=>true
  
          association :customer, :unique=>true, :inverse_of=>:invoices
  
          migrate 1 do |attrs|
            attrs["total"] ||= rand(2000) / 100.0
          end
  
          migrate 2 do |attrs|
            attrs["gst_number"] = "66-666-666"
          end
  
          key do
            ActiveSupport::SecureRandom.hex(64)
          end
        end
        
FAQ
===

# How do I make this work?

Sorry, it's hard right now.  If you can't figure it out you should ask nzkoz for help on #cassandra on freenode.

You need to have a checkout of edge rails in ../rails if you want to run the tests.

# Should I use this in production?

Only if you're looking to help out with the development, there are a bunch of rough edges right now.

Something went wrong with that request. Please try again.