Skip to content

Commit

Permalink
Fixed regex operator (=~)
Browse files Browse the repository at this point in the history
Added NOT LIKE string operator

Added ALL NOT IN, ANY NOT IN & NONE NOT IN array operators
  • Loading branch information
LaravelFreelancerNL committed Aug 16, 2024
1 parent 3ed8ff7 commit d1f1b04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Query/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ class Grammar extends IlluminateQueryGrammar
*/
protected $operators = [
'==', '!=', '<', '>', '<=', '>=',
'LIKE', '~', '!~',
'IN', 'NOT IN',
'ALL ==', 'ALL !=', 'ALL <', 'ALL >', 'ALL <=', 'ALL >=', 'ALL IN',
'ANY ==', 'ANY !=', 'ANY <', 'ANY >', 'ANY <=', 'ANY >=', 'ANY IN',
'NONE ==', 'NONE !=', 'NONE <', 'NONE >', 'NONE <=', 'NONE >=', 'NONE IN',
'IN', 'NOT IN', 'LIKE', 'NOT LIKE', '=~', '!~',
'ALL ==', 'ALL !=', 'ALL <', 'ALL >', 'ALL <=', 'ALL >=', 'ALL IN', 'ALL NOT IN',
'ANY ==', 'ANY !=', 'ANY <', 'ANY >', 'ANY <=', 'ANY >=', 'ANY IN', 'ANY NOT IN',
'NONE ==', 'NONE !=', 'NONE <', 'NONE >', 'NONE <=', 'NONE >=', 'NONE IN', 'NONE NOT IN',
];

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/Query/WheresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
);
});

test('where =~ operator', function () {
$builder = getBuilder();
$builder->select('*')
->from('users')
->where('email', '=~', '[email protected]');

$this->assertSame(
'FOR userDoc IN users '
. 'FILTER `userDoc`.`email` =~ @'
. $builder->getQueryId()
. '_where_1 RETURN userDoc',
$builder->toSql(),
);
});

test('where json arrow conversion', function () {
$builder = getBuilder();
$builder->select('*')
Expand Down

0 comments on commit d1f1b04

Please sign in to comment.