Python bindings (#115)

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2024-01-28 14:39:59 -08:00
committed by GitHub
parent 055bdd295f
commit 8ca863c661
12 changed files with 514 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ use crate::QueryResults;
use std::convert::AsRef;
use std::path::Path;
use anyhow::Result;
use anyhow::{bail, Result};
/// The Rego evaluation engine.
///
@@ -175,6 +175,9 @@ impl Engine {
/// # }
/// ```
pub fn add_data(&mut self, data: Value) -> Result<()> {
if data.as_object().is_err() {
bail!("data must be object");
}
self.prepared = false;
self.interpreter.get_data_mut().merge(data)
}