
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= Generic Object Mapper - CouchDB adapter
The CouchDB adapter for the Generic Object Mapper (http://github.com/phifty/gom) provides an easy way store and fetch object data to/from a CouchDB server. Object properties are mapped as well as object relations.
http://travis-ci.org/phifty/gom-couchdb-adapter.png
== Configuration
If the couchdb adapter is chosen in the storage configuration, the following configuration values should be specified.
=== Example
GOM::Storage.configure { name :storage_name adapter :couchdb host "another_host" database "production_db" delete_database_if_exists false create_database_if_missing true }
== Documents
Basically one document is created in the CouchDB database for each stored object. The instance variables from the object are stored as the document's keys and values. The objects relations to other objects are stored as references to the other object's document id. So if the following object is saved ...
class Book
attr_accessor :pages
attr_accessor :author
end
class Author
attr_accessor :name
end
author = Author.new author.name = "Mr. Storyteller"
book = Book.new book.pages = 1253 book.author = GOM::Object.reference author
GOM::Storage.store book, :storage_name
... the following documents will occur in the database.
{ "_id": "book_1", "_rev": "...", "model_class": "Book", "pages": 1253, "author_id": "author_1" }
{ "_id": "author_1", "_rev": "...", "model_class": "Author", "name": "Mr. Storyteller" }
If the author would have been stored before and assigned to an id, it wouldn't be stored again.
To get back the book from the storage, simply call ...
book = GOM::Storage.fetch "storage_name:book_1"
... and an object of the class Book with same instance variable values as it had before, will be returned. Since lazy loading is supported, the author will just be fetched on the first access. So ...
author_name = book.author.name
... will invoke another fetch of the author's object.
== Views
This adapter currently supports class and map/reduce views. For documentation see http://github.com/phifty/gom.
== Development
Development has been done test-driven and the code follows at most the Clean Code paradigms. Code smells has been removed by using the reek[http://github.com/kevinrutherford/reek] code smell detector.
The project is still experimental and under development. Any bug report and contribution is welcome!
== Support
Apart from contribution, support via Flattr[http://flattr.com/thing/108997/Generic-Object-Mapper-CouchDB-adapter] is welcome.
FAQs
Unknown package
We found that gom-couchdb-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.