pub fn eval_func_with<F: FnOnce(&mut Expression, &[Expr]) -> ()>(
        sig: ScalarFuncSig,
        args: &[Datum],
        f: F,
    ) -> super::Result<Datum> {
        let mut ctx = EvalContext::default();
        let args: Vec<Expr> = args.iter().map(|arg| datum_expr(arg.clone())).collect();
        let expr = scalar_func_expr(sig, &args);
        let mut op = Expression::build(&ctx, expr).unwrap();
        f(&mut op, &args);
        op.eval(&mut ctx, &[])
    }
/// dispatch ScalarFuncSig with the args, return the result by calling eval.
/// f is used to setup the Expression before calling eval, like the set flag of the FieldType.
///
/// # Examples
///
/// ```ignore
/// let x = Datum::U64(18446744073709551615);
/// let d = Datum::I64(-2);
/// let exp = Datum::U64(18446744073709551600);
/// let got = eval_func_with(ScalarFuncSig::TruncateInt, &[x, d], |op, args| {
///     if mysql::has_unsigned_flag(args[0].get_field_type().get_flag()) {
///         op.mut_tp().set_flag(types::UNSIGNED_FLAG as u32);
///     }
/// }).unwrap();
/// assert_eq!(got, exp);
/// ```
dispatch ScalarFuncSig with the args, return the result by calling eval.
f is used to setup the Expression before calling eval, like the set flag of the FieldType.
dispatch ScalarFuncSig with the args return the result by calling eval . f is used to setup the Expression before calling eval like the set flag of the FieldType .
pub fn eval_func_with<F: FnOnce(&mut Expression, &[Expr]) -> ()>(
        sig: ScalarFuncSig,
        args: &[Datum],
        f: F,
    ) -> super::Result<Datum> {
        let mut ctx = EvalContext::default();
        let args: Vec<Expr> = args.iter().map(|arg| datum_expr(arg.clone())).collect();
        let expr = scalar_func_expr(sig, &args);
        let mut op = Expression::build(&ctx, expr).unwrap();
        f(&mut op, &args);
        op.eval(&mut ctx, &[])
    }
pub fn eval_func_with < F : FnOnce ( & mut Expression , & [ Expr ] ) -> ( ) > ( sig : ScalarFuncSig , args : & [ Datum ] , f : F , ) -> super :: Result < Datum > { let mut ctx = EvalContext :: default ( ) ; let args : Vec < Expr > = args . iter ( ) . map ( | arg | datum_expr ( arg . clone ( ) ) ) . collect ( ) ; let expr = scalar_func_expr ( sig , & args ) ; let mut op = Expression :: build ( & ctx , expr ) . unwrap ( ) ; f ( & mut op , & args ) ; op . eval ( & mut ctx , & [ ] ) }
dispatch ScalarFuncSig with the args, return the result by calling eval.
dispatch ScalarFuncSig with the args return the result by calling eval .
sig
ScalarFuncSig
args
&[Datum]
f
F
sig
ScalarFuncSig
args
&[Datum]
f
F
examples
None