Struct sofa::Database [−][src]
pub struct Database { /* fields omitted */ }
Database holds the logic of making operations on a CouchDB Database (sometimes called Collection in other NoSQL flavors such as MongoDB).
Methods
impl Database
[src]
impl Database
pub fn new(name: String, client: Client) -> Database
[src]
pub fn new(name: String, client: Client) -> Database
pub fn compact(&self) -> bool
[src]
pub fn compact(&self) -> bool
Launches the compact process
pub fn compact_views(&self) -> bool
[src]
pub fn compact_views(&self) -> bool
Starts the compaction of all views
pub fn compact_index(&self, index: &'static str) -> bool
[src]
pub fn compact_index(&self, index: &'static str) -> bool
Starts the compaction of a given index
pub fn exists(&self, id: DocumentId) -> bool
[src]
pub fn exists(&self, id: DocumentId) -> bool
Checks if a document ID exists
pub fn get(&self, id: DocumentId) -> Result<Document, Error>
[src]
pub fn get(&self, id: DocumentId) -> Result<Document, Error>
Gets one document
pub fn get_bulk(
&self,
ids: Vec<DocumentId>
) -> Result<DocumentCollection, Error>
[src]
pub fn get_bulk(
&self,
ids: Vec<DocumentId>
) -> Result<DocumentCollection, Error>
Gets documents in bulk with provided IDs list
pub fn get_bulk_params(
&self,
ids: Vec<DocumentId>,
params: Option<HashMap<String, String>>
) -> Result<DocumentCollection, Error>
[src]
pub fn get_bulk_params(
&self,
ids: Vec<DocumentId>,
params: Option<HashMap<String, String>>
) -> Result<DocumentCollection, Error>
Gets documents in bulk with provided IDs list, with added params. Params description can be found here: Parameters description can be found here: http://docs.couchdb.org/en/latest/api/ddoc/views.html#api-ddoc-view
pub fn get_all(&self) -> Result<DocumentCollection, Error>
[src]
pub fn get_all(&self) -> Result<DocumentCollection, Error>
Gets all the documents in database
pub fn get_all_params(
&self,
params: Option<HashMap<String, String>>
) -> Result<DocumentCollection, Error>
[src]
pub fn get_all_params(
&self,
params: Option<HashMap<String, String>>
) -> Result<DocumentCollection, Error>
Gets all the documents in database, with applied parameters. Parameters description can be found here: http://docs.couchdb.org/en/latest/api/ddoc/views.html#api-ddoc-view
pub fn find(&self, params: Value) -> Result<DocumentCollection, Error>
[src]
pub fn find(&self, params: Value) -> Result<DocumentCollection, Error>
Finds a document in the database through a Mango query. Parameters here http://docs.couchdb.org/en/latest/api/database/find.html
pub fn save(&self, doc: Document) -> Result<Document, Error>
[src]
pub fn save(&self, doc: Document) -> Result<Document, Error>
Updates a document
pub fn create(&self, raw_doc: Value) -> Result<Document, Error>
[src]
pub fn create(&self, raw_doc: Value) -> Result<Document, Error>
Creates a document from a raw JSON document Value.
pub fn remove(&self, doc: Document) -> bool
[src]
pub fn remove(&self, doc: Document) -> bool
Removes a document from the database. Returns success in a bool
pub fn insert_index(
&self,
name: String,
spec: IndexFields
) -> Result<IndexCreated, Error>
[src]
pub fn insert_index(
&self,
name: String,
spec: IndexFields
) -> Result<IndexCreated, Error>
Inserts an index in a naive way, if it already exists, will throw an
Err
pub fn read_indexes(&self) -> Result<DatabaseIndexList, Error>
[src]
pub fn read_indexes(&self) -> Result<DatabaseIndexList, Error>
Reads the database's indexes and returns them
pub fn ensure_index(
&self,
name: String,
spec: IndexFields
) -> Result<bool, Error>
[src]
pub fn ensure_index(
&self,
name: String,
spec: IndexFields
) -> Result<bool, Error>
Method to ensure an index is created on the database with the following
spec. Returns true
when we created a new one, or false
when the
index was already existing.
Trait Implementations
impl Debug for Database
[src]
impl Debug for Database
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Database
[src]
impl Clone for Database