Created
December 3, 2015 12:20
-
-
Save ccapndave/3964506e061488bb113d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PouchDB where | |
import Task exposing (Task) | |
import Native.PouchDB | |
type PouchDB = POUCHDB_IMPLEMENTED_IN_JAVASCRIPT | |
type PouchError | |
= Error | |
type alias PouchDoc a = | |
{ a | pouchId : Maybe String, pouchRev : Maybe String } | |
type alias PouchAttachment = | |
{ content_type : String | |
, data : String | |
} | |
makePouchAttachment : String -> String -> PouchAttachment | |
makePouchAttachment content_type data = | |
{ content_type = content_type, data = data } | |
getPouchDB : String -> Task PouchError PouchDB | |
getPouchDB dbName = | |
Native.PouchDB.getPouchDB dbName | |
get : PouchDB -> String -> Task PouchError a | |
get db pouchId = | |
Native.PouchDB.get db pouchId | |
remove : PouchDB -> PouchDoc a -> Task PouchError Bool | |
remove db doc = | |
Native.PouchDB.remove db doc | |
post : PouchDB -> a -> Task PouchError Bool | |
post db doc = | |
Native.PouchDB.post db doc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment