Skip to content

Commit f1eef5b

Browse files
authored
Merge pull request #9 from pfilsx/dev
Dev
2 parents a904802 + a6fab11 commit f1eef5b

27 files changed

+707
-27
lines changed

docs/Functions-and-Operators.md

+36-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
1-
Available functions
2-
===================
1+
# Available functions
32

4-
| PostgreSQL function | DQL function | Implementation |
5-
|------------------------|----------------------|-------------------------------------------------------------------------------------------------------------------------------|
6-
| ARRAY_AGG() | ARRAY_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ArrayAgg](../src/ORM/Query/AST/Functions/ArrayAgg.php) |
7-
| JSON_AGG() | JSON_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonAgg](../src/ORM/Query/AST/Functions/JsonAgg.php) |
8-
| JSONB_AGG() | JSONB_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbAgg](../src/ORM/Query/AST/Functions/JsonbAgg.php) |
9-
| PHRASETO_TSQUERY() | PHRASETO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\PhraseToTsQuery](../src/ORM/Query/AST/Functions/PhraseToTsQuery.php) |
10-
| PLAINTO_TSQUERY() | PLAINTO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\PlainToTsQuery](../src/ORM/Query/AST/Functions/PlainToTsQuery.php) |
11-
| STRING_AGG() | STRING_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\StringAgg](../src/ORM/Query/AST/Functions/StringAgg.php) |
12-
| TO_TSQUERY() | TO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToTsQuery](../src/ORM/Query/AST/Functions/ToTsQuery.php) |
13-
| TO_TSVECTOR() | TO_TSVECTOR | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToTsVector](../src/ORM/Query/AST/Functions/ToTsVector.php) |
14-
| TS_HEADLINE() | TS_HEADLINE | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsHeadline](../src/ORM/Query/AST/Functions/TsHeadline.php) |
15-
| TS_RANK() | TS_RANK | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsRank](../src/ORM/Query/AST/Functions/TsRank.php) |
16-
| TS_RANK_CD() | TS_RANK_CD | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsRankCd](../src/ORM/Query/AST/Functions/TsRankCd.php) |
17-
| WEBSEARCH_TO_TSQUERY() | WEBSEARCH_TO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\WebsearchToTsQuery](../src/ORM/Query/AST/Functions/WebsearchToTsQuery.php) |
183

19-
Available operators
20-
===================
4+
| PostgreSQL function | DQL function | Implementation |
5+
|-------------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------|
6+
| ARRAY_AGG() | ARRAY_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ArrayAgg](../src/ORM/Query/AST/Functions/ArrayAgg.php) |
7+
| ARRAY_TO_JSON() | ARRAY_TO_JSON | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ArrayToJson](../src/ORM/Query/AST/Functions/ArrayToJson.php) |
8+
| JSON_AGG() | JSON_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonAgg](../src/ORM/Query/AST/Functions/JsonAgg.php) |
9+
| JSON_ARRAY_LENGTH() | JSON_ARRAY_LENGTH | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonArrayLength](../src/ORM/Query/AST/Functions/JsonArrayLength.php) |
10+
| JSONB_AGG() | JSONB_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbAgg](../src/ORM/Query/AST/Functions/JsonbAgg.php) |
11+
| JSONB_ARRAY_LENGTH() | JSONB_ARRAY_LENGTH | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbArrayLength](../src/ORM/Query/AST/Functions/JsonbArrayLength.php) |
12+
| JSONB_BUILD_ARRAY() | JSONB_BUILD_ARRAY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbBuildArray](../src/ORM/Query/AST/Functions/JsonbBuildArray.php) |
13+
| JSONB_BUILD_OBJECT() | JSONB_BUILD_OBJECT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbBuildObject](../src/ORM/Query/AST/Functions/JsonbBuildObject.php) |
14+
| JSONB_EACH() | JSONB_EACH | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbEach](../src/ORM/Query/AST/Functions/JsonbEach.php) |
15+
| JSONB_EACH_TEXT() | JSONB_EACH_TEXT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbEachText](../src/ORM/Query/AST/Functions/JsonbEachText.php) |
16+
| JSONB_OBJECT_KEYS() | JSONB_OBJECT_KEYS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbObjectKeys](../src/ORM/Query/AST/Functions/JsonbObjectKeys.php) |
17+
| JSON_BUILD_ARRAY() | JSON_BUILD_ARRAY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonBuildArray](../src/ORM/Query/AST/Functions/JsonBuildArray.php) |
18+
| JSON_BUILD_OBJECT() | JSON_BUILD_OBJECT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonBuildObject](../src/ORM/Query/AST/Functions/JsonBuildObject.php) |
19+
| JSON_EACH() | JSON_EACH | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonEach](../src/ORM/Query/AST/Functions/JsonEach.php) |
20+
| JSON_EACH_TEXT() | JSON_EACH_TEXT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonEachText](../src/ORM/Query/AST/Functions/JsonEachText.php) |
21+
| JSON_OBJECT_KEYS() | JSON_OBJECT_KEYS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonObjectKeys](../src/ORM/Query/AST/Functions/JsonObjectKeys.php) |
22+
| PHRASETO_TSQUERY() | PHRASETO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\PhraseToTsQuery](../src/ORM/Query/AST/Functions/PhraseToTsQuery.php) |
23+
| PLAINTO_TSQUERY() | PLAINTO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\PlainToTsQuery](../src/ORM/Query/AST/Functions/PlainToTsQuery.php) |
24+
| STRING_AGG() | STRING_AGG | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\StringAgg](../src/ORM/Query/AST/Functions/StringAgg.php) |
25+
| ARRAY[] | ARRAY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToArray](../src/ORM/Query/AST/Functions/ToArray.php) |
26+
| TO_JSON() | TO_JSON | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToJson](../src/ORM/Query/AST/Functions/ToJson.php) |
27+
| TO_JSONB() | TO_JSONB | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToJsonb](../src/ORM/Query/AST/Functions/ToJsonb.php) |
28+
| TO_TSQUERY() | TO_TSQUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToTsQuery](../src/ORM/Query/AST/Functions/ToTsQuery.php) |
29+
| TO_TSVECTOR() | TO_TSVECTOR | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\ToTsVector](../src/ORM/Query/AST/Functions/ToTsVector.php) |
30+
| TS_HEADLINE() | TS_HEADLINE | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsHeadline](../src/ORM/Query/AST/Functions/TsHeadline.php) |
31+
| TS_RANK() | TS_RANK | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsRank](../src/ORM/Query/AST/Functions/TsRank.php) |
32+
| TS_RANK_CD() | TS_RANK_CD | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsRankCd](../src/ORM/Query/AST/Functions/TsRankCd.php) |
33+
| WEBSEARCH_TO_TS_QUERY() | WEBSEARCH_TO_TS_QUERY | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\WebsearchToTsQuery](../src/ORM/Query/AST/Functions/WebsearchToTsQuery.php) |
34+
35+
# Available operators
2136

2237
| PostgreSQL operator | DQL function | Implementation |
2338
|---------------------|-------------------------|---------------------------------------------------------------------------------------------------------------------------------|
39+
| @> | CONTAINS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\Contains](../src/ORM/Query/AST/Functions/Contains.php) |
2440
| || | JSONB_CONCAT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbConcat](../src/ORM/Query/AST/Functions/JsonbConcat.php) |
25-
| @> | JSONB_CONTAINS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbContains](../src/ORM/Query/AST/Functions/JsonbContains.php) |
26-
| ? | JSONB_KEY_EXISTS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbKeyExists](../src/ORM/Query/AST/Functions/JsonbKeyExists.php) |
41+
| ? | JSONB_EXISTS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbExists](../src/ORM/Query/AST/Functions/JsonbExists.php) |
2742
| - | JSONB_REMOVE | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonbRemove](../src/ORM/Query/AST/Functions/JsonbRemove.php) |
2843
| -> | JSON_GET_FIELD | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonGetField](../src/ORM/Query/AST/Functions/JsonGetField.php) |
2944
| ->> | JSON_GET_FIELD_AS_TEXT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonGetFieldAsText](../src/ORM/Query/AST/Functions/JsonGetFieldAsText.php) |
3045
| #> | JSON_GET_OBJECT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonGetObject](../src/ORM/Query/AST/Functions/JsonGetObject.php) |
3146
| #>> | JSON_GET_OBJECT_AS_TEXT | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\JsonGetObjectAsText](../src/ORM/Query/AST/Functions/JsonGetObjectAsText.php) |
47+
| && | OVERLAPS | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\Overlaps](../src/ORM/Query/AST/Functions/Overlaps.php) |
3248
| @@ | TS_MATCH | [Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions\TsMatch](../src/ORM/Query/AST/Functions/TsMatch.php) |
3349

3450
Integration with Doctrine

src/ORM/Query/AST/ArrayExpression.php

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST;
6+
7+
use Doctrine\ORM\Query\AST\Node;
8+
use Doctrine\ORM\Query\Lexer;
9+
use Doctrine\ORM\Query\Parser;
10+
11+
final class ArrayExpression extends Node
12+
{
13+
/**
14+
* @var Node[]
15+
*/
16+
private array $innerNodes;
17+
18+
/**
19+
* @param Node[] $innerNodes
20+
*/
21+
public function __construct(array $innerNodes)
22+
{
23+
$this->innerNodes = $innerNodes;
24+
}
25+
26+
public function dispatch($walker): string
27+
{
28+
return implode(', ', array_map(static fn (Node $node) => $node->dispatch($walker), $this->innerNodes));
29+
}
30+
31+
public static function parse(Parser $parser): self
32+
{
33+
$lexer = $parser->getLexer();
34+
assert($lexer->lookahead !== null);
35+
$nodes = [];
36+
37+
switch ($lexer->lookahead['type']) {
38+
case Lexer::T_INPUT_PARAMETER:
39+
$nodes[] = $parser->InputParameter();
40+
41+
break;
42+
case Lexer::T_INTEGER:
43+
case Lexer::T_FLOAT:
44+
case Lexer::T_TRUE:
45+
case Lexer::T_FALSE:
46+
case Lexer::T_STRING:
47+
$nodes[] = $parser->Literal();
48+
while ($lexer->isNextToken(Lexer::T_COMMA)) {
49+
$parser->match(Lexer::T_COMMA);
50+
$nodes[] = $parser->Literal();
51+
}
52+
53+
break;
54+
}
55+
56+
return new self($nodes);
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
8+
use Doctrine\ORM\Query\AST\Node;
9+
use Doctrine\ORM\Query\Lexer;
10+
use Doctrine\ORM\Query\Parser;
11+
use Doctrine\ORM\Query\SqlWalker;
12+
13+
abstract class AbstractJsonBuildFunction extends FunctionNode
14+
{
15+
/**
16+
* @var Node[]
17+
*/
18+
protected array $elements = [];
19+
20+
abstract protected function getFunctionName(): string;
21+
22+
public function parse(Parser $parser): void
23+
{
24+
$parser->match(Lexer::T_IDENTIFIER);
25+
$parser->match(Lexer::T_OPEN_PARENTHESIS);
26+
$this->elements[] = $parser->StringPrimary();
27+
28+
if (!$parser->getLexer()->isNextToken(Lexer::T_CLOSE_PARENTHESIS)) {
29+
while ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) {
30+
$parser->match(Lexer::T_COMMA);
31+
$this->elements[] = $parser->StringPrimary();
32+
}
33+
}
34+
35+
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
36+
}
37+
38+
public function getSql(SqlWalker $sqlWalker): string
39+
{
40+
return sprintf(
41+
'%s(%s)',
42+
$this->getFunctionName(),
43+
implode(',', array_map(static fn (Node $node) => $node->dispatch($sqlWalker), $this->elements))
44+
);
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
8+
use Doctrine\ORM\Query\AST\Node;
9+
use Doctrine\ORM\Query\Lexer;
10+
use Doctrine\ORM\Query\Parser;
11+
use Doctrine\ORM\Query\SqlWalker;
12+
13+
abstract class AbstractSingleNodeFunction extends FunctionNode
14+
{
15+
protected Node $field;
16+
17+
abstract protected function getFunctionName(): string;
18+
19+
abstract protected function parseField(Parser $parser): Node;
20+
21+
public function parse(Parser $parser): void
22+
{
23+
$parser->match(Lexer::T_IDENTIFIER);
24+
$parser->match(Lexer::T_OPEN_PARENTHESIS);
25+
$this->field = $this->parseField($parser);
26+
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
27+
}
28+
29+
public function getSql(SqlWalker $sqlWalker): string
30+
{
31+
return "{$this->getFunctionName()}({$this->field->dispatch($sqlWalker)})";
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Node;
8+
use Doctrine\ORM\Query\Parser;
9+
10+
/**
11+
* Implementation of PostgreSql ARRAY_TO_JSON() function.
12+
*
13+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE
14+
*
15+
* @example ARRAY_TO_JSON(entity.field)
16+
* @example ARRAY_TO_JSON(ARRAY(1,2,3))
17+
*/
18+
class ArrayToJson extends AbstractSingleNodeFunction
19+
{
20+
protected function getFunctionName(): string
21+
{
22+
return 'ARRAY_TO_JSON';
23+
}
24+
25+
protected function parseField(Parser $parser): Node
26+
{
27+
return $parser->StringPrimary();
28+
}
29+
}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
8+
use Doctrine\ORM\Query\AST\InputParameter;
9+
use Doctrine\ORM\Query\AST\Literal;
10+
use Doctrine\ORM\Query\AST\Node;
11+
use Doctrine\ORM\Query\Lexer;
12+
use Doctrine\ORM\Query\Parser;
13+
use Doctrine\ORM\Query\SqlWalker;
14+
15+
/**
16+
* Implementation of PostgreSql contains operator (||).
17+
*
18+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
19+
* @see https://www.postgresql.org/docs/current/functions-array.html
20+
*
21+
* @example CONTAINS(entity.field, entity2.field)
22+
* @example CONTAINS(entity.field, TO_JSON('{"a": 1}'))
23+
* @example CONTAINS(entity.field, TO_JSONB('{"a": 1}'))
24+
* @example CONTAINS(entity.field, ARRAY(1, 2, 3))
25+
*/
26+
final class Contains extends FunctionNode
27+
{
28+
protected Node $field;
29+
30+
protected Node $value;
31+
32+
public function parse(Parser $parser): void
33+
{
34+
$parser->match(Lexer::T_IDENTIFIER);
35+
$parser->match(Lexer::T_OPEN_PARENTHESIS);
36+
$this->field = $parser->StringPrimary();
37+
$parser->match(Lexer::T_COMMA);
38+
$this->value = $parser->StringPrimary();
39+
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
40+
}
41+
42+
public function getSql(SqlWalker $sqlWalker): string
43+
{
44+
$value = $this->value->dispatch($sqlWalker);
45+
if ($this->value instanceof Literal || $this->value instanceof InputParameter) {
46+
$value .= '::jsonb';
47+
}
48+
49+
return "({$this->field->dispatch($sqlWalker)} @> $value)";
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Node;
8+
use Doctrine\ORM\Query\Parser;
9+
10+
/**
11+
* Implementation of PostgreSql JSON_ARRAY_LENGTH() function.
12+
*
13+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE
14+
*
15+
* @example JSON_ARRAY_LENGTH(entity.field)
16+
*/
17+
class JsonArrayLength extends AbstractSingleNodeFunction
18+
{
19+
protected function getFunctionName(): string
20+
{
21+
return 'JSON_ARRAY_LENGTH';
22+
}
23+
24+
protected function parseField(Parser $parser): Node
25+
{
26+
return $parser->StringPrimary();
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
/**
8+
* Implementation of PostgreSql JSONB_BUILD_ARRAY() function.
9+
*
10+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE
11+
*
12+
* @example JSONB_BUILD_ARRAY(entity.field, entity.field2, entity.field3)
13+
*/
14+
class JsonBuildArray extends AbstractJsonBuildFunction
15+
{
16+
protected function getFunctionName(): string
17+
{
18+
return 'JSON_BUILD_ARRAY';
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
/**
8+
* Implementation of PostgreSql JSON_BUILD_OBJECT() function.
9+
*
10+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE
11+
*
12+
* @example JSON_BUILD_OBJECT('key1', entity.field, 'key2', entity.field2)
13+
* @example JSON_BUILD_OBJECT(entity.field, entity.field2)
14+
*/
15+
class JsonBuildObject extends AbstractJsonBuildFunction
16+
{
17+
protected function getFunctionName(): string
18+
{
19+
return 'JSON_BUILD_OBJECT';
20+
}
21+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pfilsx\PostgreSQLDoctrine\ORM\Query\AST\Functions;
6+
7+
use Doctrine\ORM\Query\AST\Node;
8+
use Doctrine\ORM\Query\Parser;
9+
10+
/**
11+
* Implementation of PostgreSql JSON_EACH() function.
12+
*
13+
* @see https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE
14+
*
15+
* @example JSON_EACH(entity.field)
16+
*/
17+
class JsonEach extends AbstractSingleNodeFunction
18+
{
19+
protected function getFunctionName(): string
20+
{
21+
return 'JSON_EACH';
22+
}
23+
24+
protected function parseField(Parser $parser): Node
25+
{
26+
return $parser->StringPrimary();
27+
}
28+
}

0 commit comments

Comments
 (0)