[][src]Module daas::doc

The daas module provides functionality and Object Oriented implementation of a Data as a Service (DaaS) object.

Examples

Create DaaS object that represents a new purchase of clothing from an online store.

#[macro_use] 
extern crate serde_json;
extern crate pbd;
extern crate daas;

use serde_json::value::*;
use pbd::dua::DUA;
use daas::doc::{DaaSDoc};

fn main() {
	let src = "iStore".to_string();
	let uid = 5000;
	let cat = "order".to_string();
	let sub = "clothing".to_string();
	let auth = "istore_app".to_string();
    let mut dua = Vec::new();
    dua.push(DUA {
        agreement_name: "billing".to_string(),
        location: "https://dua.org/agreements/v1/billing.pdf".to_string(),
        agreed_dtm: 1553988607,
    });
	let data = String::from(r#"{
        "product": "leather coat",
        "quantity": 1,
	    "status": "new"
	}"#).as_bytes().to_vec();
 
	let doc = DaaSDoc::new(src, uid, cat, sub, auth, dua, data);
 
    assert_eq!(doc.source_uid, uid);
}

Structs

DaaSDoc

Represents an existing DaaS document (after it has been saved and assigned a _rev value)