[][src]Struct couch_rs::document::Document

pub struct Document {
    pub _id: DocumentId,
    pub _rev: String,
    // some fields omitted
}

Document abstracts the handling of JSON values and provides direct access and casting to the fields of your documents You can get access to the fields via the implementation of the Index and IndexMut traits

Fields

_id: DocumentId

Document ID, provided by CouchDB

_rev: String

Document Revision, provided by CouchDB, helps negotiating conflicts

Implementations

impl Document[src]

pub fn new(doc: Value) -> Document[src]

pub fn get_keys(&self) -> Vec<String>[src]

Returns all document's keys

pub fn get_data(&self) -> Value[src]

Returns raw JSON data from document

pub fn merge(&mut self, doc: Value) -> &Self[src]

Merges this document with a raw JSON value, useful to update data with a payload

pub async fn populate<'_, '_, '_>(
    &'_ mut self,
    field: &'_ str,
    db: Database
) -> &'_ Self
[src]

Recursively populates field (must be an array of IDs from another database) with provided database documents

Trait Implementations

impl Clone for Document[src]

impl Debug for Document[src]

impl<'de> Deserialize<'de> for Document[src]

impl<I> Index<I> for Document where
    I: Index
[src]

type Output = Value

The returned type after indexing.

impl<I> IndexMut<I> for Document where
    I: Index
[src]

impl PartialEq<Document> for Document[src]

impl Serialize for Document[src]

impl StructuralPartialEq for Document[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.