pub fn construct_id(
template: &str,
partition: &str,
doc: &Value,
) -> Result<String, RewriteError>Expand description
Expands template against the resolved partition and the document doc.
§Errors
Returns RewriteError::PathNotScalar if a {body.<path>} placeholder does
not resolve to a scalar, or RewriteError::UnsupportedPlaceholder for any
placeholder other than {partition} or {body.<path>}.
§Examples
use serde_json::json;
use osproxy_rewrite::construct_id;
let doc = json!({ "order_id": 1001 });
let id = construct_id("{partition}:{body.order_id}", "acme", &doc).unwrap();
assert_eq!(id, "acme:1001");