ActiveOrm
ActiveOrm is a library for object ruby mapping of different databases.
Supported:
- Redis
Roadmap:
- Cassandra
- InfluxDB
Note: Library will be rewritten to be even more flexible for connection switching.
Installation
Add this line to your application's Gemfile:
gem 'active_orm'
And then execute:
$ bundle
Or install it yourself as:
$ gem install active_orm
Table of Contents
Redis
Configuration:
Options:
- client: add a custom Redis client
ActiveOrm::Redis.configure do |config|
config.client = Redis.new(:host => "10.0.1.1", :port => 6380, :db => 15)
end
Usage:
Commands:
- Geo
- Hash
- HyperLogLog
- Key
- List
- PubSub
- Script
- Set
- Sorted Set
- String
- Transaction
ActiveOrm::Redis::String.create(:month, "01")
ActiveOrm::Redis::String.find(:month) #=> "01"
ActiveOrm::Redis::String.evaluate.find(:month) #=> 1
ActiveOrm::Redis::List.create(:user_1, { id: 32123, name: "James Dean", username: "alpha123" })
ActiveOrm::Redis::List.find(:user_1) #=> { id: "32123", name: "James Dean", username: "alpha123" }
ActiveOrm::Redis::List.evaluate.find(:user_1) #=> { id: 32123, name: "James Dean", username: "alpha123" }
Rake:
Options:
- reset: reset current database
- reset_all: reset all databases
rake redis:reset
and rake redis:reset_all
Contributing
- Fork it ( https://github.com/[my-github-username]/active_orm/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request