Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dodecaphonic/opal-pouchdb
An Opal bridge to PouchDB
https://github.com/dodecaphonic/opal-pouchdb
Last synced: 4 months ago
JSON representation
An Opal bridge to PouchDB
- Host: GitHub
- URL: https://github.com/dodecaphonic/opal-pouchdb
- Owner: dodecaphonic
- License: mit
- Created: 2015-03-30T19:54:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-17T15:26:14.000Z (almost 10 years ago)
- Last Synced: 2024-07-07T09:22:32.487Z (7 months ago)
- Language: Ruby
- Size: 313 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opal - Opal PunchDB - An Opal bridge to PouchDB (Uncategorized / Uncategorized)
README
# opal-pouchdb: A PouchDB Wrapper for Opal
[![Build Status](https://travis-ci.org/dodecaphonic/opal-pouchdb.svg?branch=master)](https://travis-ci.org/dodecaphonic/opal-pouchdb)
[![Code Climate](https://codeclimate.com/github/dodecaphonic/opal-pouchdb/badges/gpa.svg)](https://codeclimate.com/github/dodecaphonic/opal-pouchdb)opal-pouchdb allows [PouchDB][pouchdb] databases to be used with a nice Ruby API.
## Usage
Basic usage follows [PouchDB's API][pouchdb-api] very closely. The major difference is that, in JavaScript, a developer may decide if she wishes get the results of her interactions with the database via callbacks or promises. In opal-pouchdb, everything returns an [Opal Promise][opal-promise], allowing your async code to be as composable as that abstraction allows.
``` ruby
db = PouchDB::Database.new("my_database")db.put(_id: "doc-1", summary: "Awesome", text: "Cake").then
db.get("doc-1")
end.then do |db_record|
puts db_record # => { "_id" => "doc-1", "_rev" => "some-large-string", "summary" => "Awesome", "text" => "Cake" }
end
```Every single CRUD operation is supported right now:
- put
- post
- get
- delete
- all_docs
- bulk_docs## TODO
- Attachments
- Querying
- Plugins
- Debug mode[pouchdb]: http://pouchdb.com
[pouchdb-api]: http://pouchdb.com/api.html
[opal-promise]: http://opalrb.org/docs/promises/