couchdb-orm
⚠ Because I don't use CouchDB anymore this project is DISCONTINUED ⚠
A simple CouchDB ORM based on TechMagister CouchDB Client
Installation
Add this to your application's shard.yml:
dependencies:
  couchdb-orm:
    github: BecauseOfProg/couchdb-ormRequirements
- CouchDB 2.x.x (Tested on CouchDB 2.1.2)
- Crystal 0.25.x (Tested on Crystal 0.25.1)
Usage
An example explain better than a long text, so
require "couchdb-orm"
CouchDB::ORM::Client.get("http://127.0.0.1:5984") # Mandatory, used everywhere to save, update, destroy
class Animal < CouchDB::ORM::Model
  fields(
    race: String, # name: type
    age: Int32
  )
end
Animal.create_database # Create database, only first time, must be removed once created
animal = Animal.new race: "Dog", age: 5
animal.save # Bool
animal.race = "Cat"
animal.save # Bool
animal2 = Animal.get(animal.id) # Get model from id
animal3 = Animal.get_by(:race, "Cat").first # Get models from field
animal.destroy # Bool
Animal.destroy_database # Destroy database, caution all data is deletedContributing
- Fork it (https://github.com/BecauseOfProg/couchdb-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
Contributors
- Whaxion Whaxion - creator, maintainer