protected function addWheres(PreparableSqlInterface $query, array $wheres, array $options = [])
    {
        foreach ($wheres as $key => $where) {
            if (is_array($where) && count($where) === 3) {
                $leftOpRightSyntax = true;

                $operator = $where[1];

                switch ($operator) {
                    case '=':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_EQ,
                            $where[2]
                        );
                        break;
                    case '!=':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_NE,
                            $where[2]
                        );
                        break;
                    case '>':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_GT,
                            $where[2]
                        );
                        break;
                    case '<':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_LT,
                            $where[2]
                        );
                        break;
                    case '>=':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_GTE,
                            $where[2]
                        );
                        break;
                    case '<=':
                        $predicate = new Operator(
                            $where[0],
                            Operator::OP_LTE,
                            $where[2]
                        );
                        break;
                    case 'LIKE':
                        $predicate = new Like($where[0], $where[2]);
                        break;
                    case 'NOT LIKE':
                        $predicate = new NotLike($where[0], $where[2]);
                        break;
                    case 'IN':
                        $predicate = new In($where[0], $where[2]);
                        break;
                    case 'NOT IN':
                        $predicate = new NotIn($where[0], $where[2]);
                        break;
                    case 'IS':
                        $predicate = new IsNull($where[0]);
                        break;
                    case 'IS NOT':
                        $predicate = new IsNotNull($where[0]);
                        break;
                    default:
                        $leftOpRightSyntax = false;
                        break;
                }

                if ($leftOpRightSyntax === false) {
                    $predicate = [$key => $where];
                }
            } else {
                $predicate = [$key => $where];
            }

            $query->where($predicate);
        }

        return $query;
    }