Struct couchdb::ViewFunctionBuilder [] [src]

pub struct ViewFunctionBuilder {
    // some fields omitted
}

Builder for constructing a view function.

Examples

use couchdb::{ViewFunction, ViewFunctionBuilder};
let s = "function(doc) { if (doc.foo) { emit(doc.name, doc.foo); } }";
let v = ViewFunctionBuilder::new(s)
            .set_reduce("_sum")
            .unwrap();
assert_eq!(v.map, s);
assert_eq!(v.reduce, Some("_sum".to_string()));

Methods

impl ViewFunctionBuilder

fn new<S: Into<String>>(map_function: S) -> Self

Constructs a new view function builder.

The view function contained within the builder has the given map function and an undefined reduce function.

fn unwrap(self) -> ViewFunction

Returns the view function contained within the builder.

fn set_reduce<S: Into<String>>(self, reduce_function: S) -> Self

Replaces any reduce function in the view function contained within the builder.

Trait Implementations

Derived Implementations

impl Debug for ViewFunctionBuilder

fn fmt(&self, __arg_0: &mut Formatter) -> Result