Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 74 additions & 2 deletions src/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function ($expression) {

/**
* Returns the filters generated by the expression
*
*
* @return array
*/
public function getExpressionFilters(): array
Expand All @@ -74,7 +74,7 @@ public function getExpressionFilters(): array

/**
* Adds or filter
*
*
* @param array|Expression $expression
*
* @return $this|Expression
Expand Down Expand Up @@ -125,6 +125,78 @@ public function notEqual(string $field, $value): Expression
return $this;
}

/**
* Adds gt filter
*
* @param string $field
* @param string $value
*
* @return $this|Expression
*/

public function greaterThan(string $field, $value): Expression
{
$this->prepareFilterIndex($field);

$this->filters[$field] = $this->operationExpression('$gt', $value);

return $this;
}

/**
* Adds gte filter
*
* @param string $field
* @param string $value
*
* @return $this|Expression
*/

public function greaterEqualThan(string $field, $value): Expression
{
$this->prepareFilterIndex($field);

$this->filters[$field] = $this->operationExpression('$gte', $value);

return $this;
}

/**
* Adds lt filter
*
* @param string $field
* @param string $value
*
* @return $this|Expression
*/

public function lowerThan(string $field, $value): Expression
{
$this->prepareFilterIndex($field);

$this->filters[$field] = $this->operationExpression('$lt', $value);

return $this;
}

/**
* Adds lte filter
*
* @param string $field
* @param string $value
*
* @return $this|Expression
*/

public function lowerEqualThan(string $field, $value): Expression
{
$this->prepareFilterIndex($field);

$this->filters[$field] = $this->operationExpression('$lte', $value);

return $this;
}

/**
* Adds in filter
*
Expand Down
64 changes: 64 additions & 0 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,70 @@ public function notEqual(string $field, $value)
return $this;
}

/**
* Adds gt filter
*
* @param string $field
* @param mixed $value
*
* @return $this
*/

public function greaterThan(string $field, $value)
{
$this->expression->greaterThan($field,$value);

return $this;
}

/**
* Adds gte filter
*
* @param string $field
* @param mixed $value
*
* @return $this
*/

public function greaterEqualThan(string $field, $value)
{
$this->expression->greaterEqualThan($field,$value);

return $this;
}

/**
* Adds lt filter
*
* @param string $field
* @param mixed $value
*
* @return $this
*/

public function lowerThan(string $field, $value)
{
$this->expression->lowerThan($field,$value);

return $this;
}

/**
* Adds lte filter
*
* @param string $field
* @param mixed $value
*
* @return $this
*/

public function lowerEqualThan(string $field, $value)
{
$this->expression->lowerEqualThan($field,$value);

return $this;
}

/**
* Adds in filter
*
Expand Down