message: Make filter check & parse expr to pure functions for supporting recursive calls
diff: use crate::translator::Row;
  -use nom_sql::{ConditionBase, ConditionExpression, ConditionTree, Operator};
  +use nom_sql::{ConditionBase, ConditionExpression, ConditionTree, Literal, Operator};
  use std::convert::From;
  use std::fmt::Debug;
  -pub struct Filter {
  - where_clause: Option<ConditionExpression>,
  -}
  -
  -impl Filter {
  - pub fn check<'a, T: Debug>(&'a self, row: &'a Row<T>) -> bool {
  +fn parse_expr<'a, T: Debug>(row: &'a Row<T>, expr: &'a ConditionExpression) -> Option<&'a Literal> {
  let parse_base = |base: &'a ConditionBase| match base {
  ConditionBase::Field(v) => row.get_literal(&v.name),
  ConditionBase::Literal(literal) => Some(literal),
  _ => None,
  };
  - let parse_expr = |expr: &'a ConditionExpression| match expr {
  + match expr {
  ConditionExpression::Base(base) => parse_base(&base),
  _ => None,
  - };
  + }
  +}
  - let check_tree = |tree: &'a ConditionTree| {
  - let left = parse_expr(&tree.left);
  - let right = parse_expr(&tree.right);
  +fn check_expr<'a, T: Debug>(row: &'a Row<T>, expr: &'a ConditionExpression) -> bool {
  + let check_tree = |tree: &'a ConditionTree| match tree.operator {
  + Operator::Equal => {
  + let left = parse_expr(row, &tree.left);
  + let right = parse_expr(row, &tree.right);
  - match tree.operator {
  - Operator::Equal => left.is_some() && right.is_some() && left == right,
  - _ => true,
  + left.is_some() && right.is_some() && left == right
  }
  + _ => true,
  };
  - let check_expr = |expr: &'a ConditionExpression| match expr {
  + match expr {
  ConditionExpression::ComparisonOp(tree) => check_tree(&tree),
  + ConditionExpression::LogicalOp(tree) => check_tree(&tree),
  _ => false,
  - };
  + }
  +}
  +
  +pub struct Filter {
  + where_clause: Option<ConditionExpression>,
  +}
  - self.where_clause.as_ref().map_or(true, check_expr)
  +impl Filter {
  + pub fn check<'a, T: Debug>(&'a self, row: &'a Row<T>) -> bool {
  + self.where_clause
  + .as_ref()
  + .map_or(true, |expr| check_expr(row, expr))
  }
  }
  