use crate::ctx::Context; use crate::dbs::Statement; use crate::dbs::{Options, Transaction}; use crate::doc::Document; use crate::err::Error; impl<'a> Document<'a> { pub async fn check( &self, ctx: &Context<'_>, opt: &Options, txn: &Transaction, stm: &Statement<'_>, ) -> Result<(), Error> { // Check where condition if let Some(cond) = stm.conds() { // Check if the expression is truthy if !cond .compute(ctx, &opt.new_with_futures(true), txn, Some(&self.current)) .await? .is_truthy() { // Ignore this document return Err(Error::Ignore); } } // Carry on Ok(()) } }