This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Aug 27 11:01:35 -0700 2009 | |
| |
LICENSE | Wed Jul 15 02:50:29 -0700 2009 | |
| |
README | Wed Aug 26 09:04:15 -0700 2009 | |
| |
Rakefile | Sat Oct 17 17:08:02 -0700 2009 | |
| |
SPEC | Sun Jul 26 18:41:12 -0700 2009 | |
| |
VERSION | Sat Oct 17 17:08:02 -0700 2009 | |
| |
lib/ | Wed Nov 04 16:42:58 -0800 2009 | |
| |
test/ | Wed Nov 04 16:45:25 -0800 2009 | |
| |
vendor/ | Thu Sep 03 17:42:01 -0700 2009 |
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", "James"].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?
Here are some basic directions:
1. Clone Evan Weaver's cassandra gem repository: `git clone git://github.com/fauna/cassandra.git`
2. `sudo gem install echoe`
3. `rake cassandra`
4. `git clone git://github.com/NZKoz/cassandra_object.git`
5. You can now drop into irb, and require 'cassandra_object/lib/cassandra_object'
6. CassandraObject::Base.establish_connection "Twitter"
7. Create a class that inherits from CassandraObject::Base
8.1. Note that you'll need to modify storage-conf.xml in the cassandra repository you cloned in step #1 if you want
to change the column families or anything.
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.







