gnieh.sohva

Database

Related Doc: package sohva

trait Database[Result[_]] extends AnyRef

Gives the user access to the different operations available on a database. Among other operations this is the key class to get access to the documents of this database.

It also exposes the change handler interface, that allows people to react to change notifications. This is a low-level API, that handles raw Json objects

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Database
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def _all_docs(key: Option[String] = None, keys: List[String] = Nil, startkey: Option[String] = None, startkey_docid: Option[String] = None, endkey: Option[String] = None, endkey_docid: Option[String] = None, limit: Int = 1, stale: Option[String] = None, descending: Boolean = false, skip: Int = 0, inclusive_end: Boolean = true): Result[List[String]]

    Returns the list of identifiers of the documents in this database

  2. abstract def attachTo(docId: String, attachment: String, stream: InputStream, contentType: String): Result[Boolean]

    Attaches the given file (given as an input stream) to the given document id.

    Attaches the given file (given as an input stream) to the given document id. If no mime type is given, sohva tries to guess the mime type of the file itself. It it does not manage to identify the mime type, the file won't be attached... This method returns true iff the file was attached to the document.

  3. abstract def attachTo(docId: String, file: File, contentType: String): Result[Boolean]

    Attaches the given file to the given document id.

    Attaches the given file to the given document id. This method returns true iff the file was attached to the document.

  4. abstract def builtInView(view: String): View[Result]

    Returns a built-in view of this database, identified by its name.

    Returns a built-in view of this database, identified by its name. E.g. _all_docs.

  5. abstract def changes(since: Option[Int] = None, filter: Option[String] = None): ChangeStream

    Registers to the change stream of this database with potential filter and since some revision.

    Registers to the change stream of this database with potential filter and since some revision. If no revision is given changes that occurred before the connection was established are not sent

  6. abstract def copy(origin: String, target: String, originRev: Option[String] = None, targetRev: Option[String] = None): Result[Boolean]

    Copies the origin document to the target document.

    Copies the origin document to the target document. If the target does not exist, it is created, otherwise it is updated and the target revision must be provided

  7. abstract def couch: CouchDB[Result]

    The couchdb instance this database belongs to

  8. abstract def create: Result[Boolean]

    Creates this database in the couchdb instance if it does not already exist.

    Creates this database in the couchdb instance if it does not already exist. Returns true iff the database was actually created.

  9. abstract def createDoc(doc: Any): Result[DbResult]

    Creates a document in the database and returns its identifier and revision.

    Creates a document in the database and returns its identifier and revision. If the json version of the object has a _id field, this identifier is used for the document, otherwise a new one is generated.

  10. abstract def createDocs(doc: List[Any]): Result[List[DbResult]]

    Creates a set of documents in the database and returns theirs identifiers and revision.

    Creates a set of documents in the database and returns theirs identifiers and revision. If the json version of an object has a _id field, this identifier is used for the document, otherwise a new one is generated.

  11. abstract val credit: Int

    The retry credit

  12. abstract def delete: Result[Boolean]

    Deletes this database in the couchdb instance if it exists.

    Deletes this database in the couchdb instance if it exists. Returns true iff the database was actually deleted.

  13. abstract def deleteAttachment(docId: String, attachment: String): Result[Boolean]

    Deletes the given attachment for the given docId

  14. abstract def deleteDoc(id: String): Result[Boolean]

    Deletes the document identified by the given id from the database.

    Deletes the document identified by the given id from the database. If the document exists it is deleted and the method returns true, otherwise returns false.

  15. abstract def deleteDoc[T](doc: T)(implicit arg0: (T) ⇒ IdRev): Result[Boolean]

    Deletes the document from the database.

    Deletes the document from the database. The document will only be deleted if the caller provided the last revision

  16. abstract def deleteDocs(ids: List[String], all_or_nothing: Boolean = false): Result[List[DbResult]]

    Deletes a bunch of documents at once returning the results for each identifier in the document list.

    Deletes a bunch of documents at once returning the results for each identifier in the document list. One can choose the update strategy by setting the parameter all_or_nothing to true or false.

  17. abstract def design(designName: String, language: String = "javascript"): Design[Result]

    Returns a design object that allows user to work with views

  18. abstract def exists: Result[Boolean]

    Indicates whether this database exists

  19. abstract def getAttachment(docId: String, attachment: String): Result[Option[(String, InputStream)]]

    Returns the given attachment for the given docId.

    Returns the given attachment for the given docId. It returns the mime type if any given in the response and the input stream to read the response from the server.

  20. abstract def getDocById[T](id: String, revision: Option[String] = None)(implicit arg0: Manifest[T]): Result[Option[T]]

    Returns the document identified by the given id if it exists

  21. abstract def getDocRevision(id: String): Result[Option[String]]

    Returns the current revision of the document if it exists

  22. abstract def getDocRevisions(ids: List[String]): Result[List[(String, String)]]

    Returns the current revision of the documents

  23. abstract def getDocsById[T](ids: List[String])(implicit arg0: Manifest[T]): Result[List[T]]

    Returns all the documents with given identifiers and of the given type.

    Returns all the documents with given identifiers and of the given type. If the document with an identifier exists in the database but has not the required type, it is not added to the result

  24. abstract def getRawDocById(id: String, revision: Option[String] = None): Result[Option[JValue]]

    Returns the raw repsentation of the document identified by the given id if it exists

  25. abstract def info: Result[Option[InfoResult]]

    Returns the information about this database

  26. abstract val name: String

    The database name

  27. abstract def patchDoc[T <: IdRev](id: String, rev: String, patch: JsonPatch)(implicit arg0: Manifest[T]): Result[T]

    Patches the document identified by the given identifier in the given revision.

    Patches the document identified by the given identifier in the given revision. This will work if the revision is the last one, or if it is not but the automatic conflict manager manages to solve the potential conflicts. The patched revision is returned. If something went wrong, an exception is raised

  28. abstract def saveDoc[T](doc: T)(implicit arg0: (T) ⇒ IdRev, arg1: Manifest[T]): Result[T]

    Creates or updates the given object as a document into this database The given object must have an _id and an optional _rev fields to conform to the couchdb document structure.

    Creates or updates the given object as a document into this database The given object must have an _id and an optional _rev fields to conform to the couchdb document structure. The saved revision is returned. If something went wrong, an exception is raised

  29. abstract def saveDocs[T](docs: List[T], all_or_nothing: Boolean = false)(implicit arg0: (T) ⇒ IdRev): Result[List[DbResult]]

    Creates or updates a bunch of documents into the database.

  30. abstract def saveSecurityDoc(doc: SecurityDoc): Result[Boolean]

    Creates or updates the security document.

    Creates or updates the security document. Security documents are special documents with no _id nor _rev fields.

  31. abstract def securityDoc: Result[SecurityDoc]

    Returns the security document of this database if any defined

  32. abstract def serializer: JsonSerializer

    The serializer used by this database

  33. abstract val strategy: Strategy

    The merge strategy

  34. abstract def temporaryView(viewDoc: ViewDoc): View[Result]

    Returns a temporary view of this database, specified by the ViewDoc.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  16. def toString(): String

    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped