Skip to content

Commit e07ade3

Browse files
committed
fix: statis analysis issues and coding standards
1 parent 31fa38d commit e07ade3

File tree

4 files changed

+89
-7
lines changed

4 files changed

+89
-7
lines changed

src/core/etl/src/Flow/ETL/Attribute/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ enum Module : string
2222
case JSON = 'JSON';
2323
case MEILI_SEARCH = 'MEILI_SEARCH';
2424
case PARQUET = 'PARQUET';
25+
case PG_QUERY = 'PG_QUERY';
2526
case S3_FILESYSTEM = 'S3_FILESYSTEM';
2627
case TEXT = 'TEXT';
2728
case TYPES = 'TYPES';
2829
case XML = 'XML';
29-
case PG_QUERY = 'PG_QUERY';
3030
}

src/lib/pg-query/src/Flow/PgQuery/DSL/functions.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
namespace Flow\PgQuery\DSL;
66

7+
use Flow\ETL\Attribute\{DocumentationDSL, Module, Type as DSLType};
78
use Flow\PgQuery\{ParsedQuery, Parser};
8-
use Flow\ETL\Attribute\DocumentationDSL;
9-
use Flow\ETL\Attribute\Module;
10-
use Flow\ETL\Attribute\Type as DSLType;
119

1210
#[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)]
1311
function pg_parser() : Parser
@@ -34,7 +32,7 @@ function pg_fingerprint(string $sql) : ?string
3432
/**
3533
* Normalize SQL query by replacing literal values and named parameters with positional parameters.
3634
* WHERE id = :id will be changed into WHERE id = $1
37-
* WHERE id = 1 will be changed into WHERE id = $1
35+
* WHERE id = 1 will be changed into WHERE id = $1.
3836
*/
3937
#[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)]
4038
function pg_normalize(string $sql) : ?string

web/landing/assets/codemirror/completions/dsl.js

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* CodeMirror Completer for Flow PHP DSL Functions
33
*
4-
* Total functions: 350
4+
* Total functions: 355
55
*
66
* This completer provides autocompletion for all Flow PHP DSL functions:
77
* - Extractors (flow-extractors)
@@ -3299,6 +3299,90 @@ const dslFunctions = [
32993299
},
33003300
apply: snippet("\\Flow\\Filesystem\\DSL\\path_stdout(" + "$" + "{" + "1:options" + "}" + ")"),
33013301
boost: 10
3302+
}, {
3303+
label: "pg_fingerprint",
3304+
type: "function",
3305+
detail: "flow\u002Ddsl\u002Dhelpers",
3306+
info: () => {
3307+
const div = document.createElement("div")
3308+
div.innerHTML = `
3309+
<div style="font-family: 'Fira Code', 'JetBrains Mono', monospace; margin-bottom: 8px;">
3310+
<span class=\"fn-name\">pg_fingerprint</span><span class=\"fn-operator\">(</span><span class=\"fn-type\">string</span> <span class=\"fn-param\">$sql</span><span class=\"fn-operator\">)</span> <span class=\"fn-operator\">:</span> <span class=\"fn-return\">string</span>
3311+
</div>
3312+
<div style="color: #8b949e; font-size: 13px;">
3313+
Returns a fingerprint of the given SQL query.<br>Literal values are normalized so they won\'t affect the fingerprint.
3314+
</div>
3315+
`
3316+
return div
3317+
},
3318+
apply: snippet("\\Flow\\PgQuery\\DSL\\pg_fingerprint(" + "$" + "{" + "1:sql" + "}" + ")"),
3319+
boost: 10
3320+
}, {
3321+
label: "pg_normalize",
3322+
type: "function",
3323+
detail: "flow\u002Ddsl\u002Dhelpers",
3324+
info: () => {
3325+
const div = document.createElement("div")
3326+
div.innerHTML = `
3327+
<div style="font-family: 'Fira Code', 'JetBrains Mono', monospace; margin-bottom: 8px;">
3328+
<span class=\"fn-name\">pg_normalize</span><span class=\"fn-operator\">(</span><span class=\"fn-type\">string</span> <span class=\"fn-param\">$sql</span><span class=\"fn-operator\">)</span> <span class=\"fn-operator\">:</span> <span class=\"fn-return\">string</span>
3329+
</div>
3330+
<div style="color: #8b949e; font-size: 13px;">
3331+
Normalize SQL query by replacing literal values and named parameters with positional parameters.<br>WHERE id = :id will be changed into WHERE id = $1<br>WHERE id = 1 will be changed into WHERE id = $1
3332+
</div>
3333+
`
3334+
return div
3335+
},
3336+
apply: snippet("\\Flow\\PgQuery\\DSL\\pg_normalize(" + "$" + "{" + "1:sql" + "}" + ")"),
3337+
boost: 10
3338+
}, {
3339+
label: "pg_parse",
3340+
type: "function",
3341+
detail: "flow\u002Ddsl\u002Dhelpers",
3342+
info: () => {
3343+
const div = document.createElement("div")
3344+
div.innerHTML = `
3345+
<div style="font-family: 'Fira Code', 'JetBrains Mono', monospace; margin-bottom: 8px;">
3346+
<span class=\"fn-name\">pg_parse</span><span class=\"fn-operator\">(</span><span class=\"fn-type\">string</span> <span class=\"fn-param\">$sql</span><span class=\"fn-operator\">)</span> <span class=\"fn-operator\">:</span> <span class=\"fn-return\">ParsedQuery</span>
3347+
</div>
3348+
`
3349+
return div
3350+
},
3351+
apply: snippet("\\Flow\\PgQuery\\DSL\\pg_parse(" + "$" + "{" + "1:sql" + "}" + ")"),
3352+
boost: 10
3353+
}, {
3354+
label: "pg_parser",
3355+
type: "function",
3356+
detail: "flow\u002Ddsl\u002Dhelpers",
3357+
info: () => {
3358+
const div = document.createElement("div")
3359+
div.innerHTML = `
3360+
<div style="font-family: 'Fira Code', 'JetBrains Mono', monospace; margin-bottom: 8px;">
3361+
<span class=\"fn-name\">pg_parser</span><span class=\"fn-operator\">(</span><span class=\"fn-operator\">)</span> <span class=\"fn-operator\">:</span> <span class=\"fn-return\">Parser</span>
3362+
</div>
3363+
`
3364+
return div
3365+
},
3366+
apply: snippet("\\Flow\\PgQuery\\DSL\\pg_parser()"),
3367+
boost: 10
3368+
}, {
3369+
label: "pg_split",
3370+
type: "function",
3371+
detail: "flow\u002Ddsl\u002Dhelpers",
3372+
info: () => {
3373+
const div = document.createElement("div")
3374+
div.innerHTML = `
3375+
<div style="font-family: 'Fira Code', 'JetBrains Mono', monospace; margin-bottom: 8px;">
3376+
<span class=\"fn-name\">pg_split</span><span class=\"fn-operator\">(</span><span class=\"fn-type\">string</span> <span class=\"fn-param\">$sql</span><span class=\"fn-operator\">)</span> <span class=\"fn-operator\">:</span> <span class=\"fn-return\">array</span>
3377+
</div>
3378+
<div style="color: #8b949e; font-size: 13px;">
3379+
Split string with multiple SQL statements into array of individual statements.<br>@return array<string>
3380+
</div>
3381+
`
3382+
return div
3383+
},
3384+
apply: snippet("\\Flow\\PgQuery\\DSL\\pg_split(" + "$" + "{" + "1:sql" + "}" + ")"),
3385+
boost: 10
33023386
}, {
33033387
label: "pie_chart",
33043388
type: "function",

web/landing/src/Flow/Website/Model/Documentation/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ enum Module : string
2121
case JSON = 'JSON';
2222
case MEILI_SEARCH = 'Meili Search';
2323
case PARQUET = 'Parquet';
24+
case PG_QUERY = 'PG_QUERY';
2425
case S3_FILESYSTEM = 'S3 Filesystem';
2526
case TEXT = 'Text';
2627
case TYPES = 'Types';
2728
case XML = 'XML';
28-
case PG_QUERY = 'PG_QUERY';
2929

3030
public static function fromName(string $name) : self
3131
{

0 commit comments

Comments
 (0)