pg-ast 0.1.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js ADDED
@@ -0,0 +1,1426 @@
1
+ // @ts-nocheck
2
+ export const jsonSet = (vresult, prop, value) => {
3
+ if (typeof value !== 'undefined')
4
+ vresult[prop] = value;
5
+ return vresult;
6
+ };
7
+ export const RawStmt = ({ stmt }) => {
8
+ let vresult = {};
9
+ vresult = jsonSet(vresult, 'stmt', stmt);
10
+ return {
11
+ RawStmt: vresult
12
+ };
13
+ };
14
+ export const CreateSchemaStmt = ({ schemaname, if_not_exists, schemaElts, authrole }) => {
15
+ let vresult = {};
16
+ vresult = jsonSet(vresult, 'schemaname', schemaname);
17
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
18
+ vresult = jsonSet(vresult, 'schemaElts', schemaElts);
19
+ vresult = jsonSet(vresult, 'authrole', authrole);
20
+ return {
21
+ CreateSchemaStmt: vresult
22
+ };
23
+ };
24
+ export const CreateStmt = ({ relation, tableElts, oncommit, inhRelations, options, ofTypename, if_not_exists }) => {
25
+ let vresult = {};
26
+ vresult = jsonSet(vresult, 'relation', relation);
27
+ vresult = jsonSet(vresult, 'tableElts', tableElts);
28
+ vresult = jsonSet(vresult, 'oncommit', oncommit);
29
+ vresult = jsonSet(vresult, 'inhRelations', inhRelations);
30
+ vresult = jsonSet(vresult, 'options', options);
31
+ vresult = jsonSet(vresult, 'ofTypename', ofTypename);
32
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
33
+ return {
34
+ CreateStmt: vresult
35
+ };
36
+ };
37
+ export const RangeVar = ({ schemaname, relname, inh, relpersistence, alias }) => {
38
+ let vresult = {};
39
+ vresult = jsonSet(vresult, 'schemaname', schemaname);
40
+ vresult = jsonSet(vresult, 'relname', relname);
41
+ vresult = jsonSet(vresult, 'inh', inh);
42
+ vresult = jsonSet(vresult, 'relpersistence', relpersistence);
43
+ vresult = jsonSet(vresult, 'alias', alias);
44
+ return {
45
+ RangeVar: vresult
46
+ };
47
+ };
48
+ export const ColumnDef = ({ colname, typeName, is_local, constraints, raw_default, collClause, fdwoptions }) => {
49
+ let vresult = {};
50
+ vresult = jsonSet(vresult, 'colname', colname);
51
+ vresult = jsonSet(vresult, 'typeName', typeName);
52
+ vresult = jsonSet(vresult, 'is_local', is_local);
53
+ vresult = jsonSet(vresult, 'constraints', constraints);
54
+ vresult = jsonSet(vresult, 'raw_default', raw_default);
55
+ vresult = jsonSet(vresult, 'collClause', collClause);
56
+ vresult = jsonSet(vresult, 'fdwoptions', fdwoptions);
57
+ return {
58
+ ColumnDef: vresult
59
+ };
60
+ };
61
+ export const TypeName = ({ names, typemod, typmods, setof, arrayBounds }) => {
62
+ let vresult = {};
63
+ vresult = jsonSet(vresult, 'names', names);
64
+ vresult = jsonSet(vresult, 'typemod', typemod);
65
+ vresult = jsonSet(vresult, 'typmods', typmods);
66
+ vresult = jsonSet(vresult, 'setof', setof);
67
+ vresult = jsonSet(vresult, 'arrayBounds', arrayBounds);
68
+ return {
69
+ TypeName: vresult
70
+ };
71
+ };
72
+ export const String = ({ str }) => {
73
+ let vresult = {};
74
+ vresult = jsonSet(vresult, 'str', str);
75
+ return {
76
+ String: vresult
77
+ };
78
+ };
79
+ export const Constraint = ({ contype, raw_expr, conname, pktable, fk_attrs, pk_attrs, fk_matchtype, fk_upd_action, fk_del_action, initially_valid, keys, is_no_inherit, skip_validation, exclusions, access_method, deferrable, indexname }) => {
80
+ let vresult = {};
81
+ vresult = jsonSet(vresult, 'contype', contype);
82
+ vresult = jsonSet(vresult, 'raw_expr', raw_expr);
83
+ vresult = jsonSet(vresult, 'conname', conname);
84
+ vresult = jsonSet(vresult, 'pktable', pktable);
85
+ vresult = jsonSet(vresult, 'fk_attrs', fk_attrs);
86
+ vresult = jsonSet(vresult, 'pk_attrs', pk_attrs);
87
+ vresult = jsonSet(vresult, 'fk_matchtype', fk_matchtype);
88
+ vresult = jsonSet(vresult, 'fk_upd_action', fk_upd_action);
89
+ vresult = jsonSet(vresult, 'fk_del_action', fk_del_action);
90
+ vresult = jsonSet(vresult, 'initially_valid', initially_valid);
91
+ vresult = jsonSet(vresult, 'keys', keys);
92
+ vresult = jsonSet(vresult, 'is_no_inherit', is_no_inherit);
93
+ vresult = jsonSet(vresult, 'skip_validation', skip_validation);
94
+ vresult = jsonSet(vresult, 'exclusions', exclusions);
95
+ vresult = jsonSet(vresult, 'access_method', access_method);
96
+ vresult = jsonSet(vresult, 'deferrable', deferrable);
97
+ vresult = jsonSet(vresult, 'indexname', indexname);
98
+ return {
99
+ Constraint: vresult
100
+ };
101
+ };
102
+ export const A_Const = ({ val }) => {
103
+ let vresult = {};
104
+ vresult = jsonSet(vresult, 'val', val);
105
+ return {
106
+ A_Const: vresult
107
+ };
108
+ };
109
+ export const Integer = ({ ival }) => {
110
+ let vresult = {};
111
+ vresult = jsonSet(vresult, 'ival', ival);
112
+ return {
113
+ Integer: vresult
114
+ };
115
+ };
116
+ export const AlterTableStmt = ({ relation, cmds, relkind, missing_ok }) => {
117
+ let vresult = {};
118
+ vresult = jsonSet(vresult, 'relation', relation);
119
+ vresult = jsonSet(vresult, 'cmds', cmds);
120
+ vresult = jsonSet(vresult, 'relkind', relkind);
121
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
122
+ return {
123
+ AlterTableStmt: vresult
124
+ };
125
+ };
126
+ export const AlterTableCmd = ({ subtype, behavior, name, def, missing_ok, newowner }) => {
127
+ let vresult = {};
128
+ vresult = jsonSet(vresult, 'subtype', subtype);
129
+ vresult = jsonSet(vresult, 'behavior', behavior);
130
+ vresult = jsonSet(vresult, 'name', name);
131
+ vresult = jsonSet(vresult, 'def', def);
132
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
133
+ vresult = jsonSet(vresult, 'newowner', newowner);
134
+ return {
135
+ AlterTableCmd: vresult
136
+ };
137
+ };
138
+ export const SQLValueFunction = ({ op, typmod }) => {
139
+ let vresult = {};
140
+ vresult = jsonSet(vresult, 'op', op);
141
+ vresult = jsonSet(vresult, 'typmod', typmod);
142
+ return {
143
+ SQLValueFunction: vresult
144
+ };
145
+ };
146
+ export const RenameStmt = ({ renameType, relationType, relation, subname, newname, behavior, object, missing_ok }) => {
147
+ let vresult = {};
148
+ vresult = jsonSet(vresult, 'renameType', renameType);
149
+ vresult = jsonSet(vresult, 'relationType', relationType);
150
+ vresult = jsonSet(vresult, 'relation', relation);
151
+ vresult = jsonSet(vresult, 'subname', subname);
152
+ vresult = jsonSet(vresult, 'newname', newname);
153
+ vresult = jsonSet(vresult, 'behavior', behavior);
154
+ vresult = jsonSet(vresult, 'object', object);
155
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
156
+ return {
157
+ RenameStmt: vresult
158
+ };
159
+ };
160
+ export const A_Expr = ({ kind, name, lexpr, rexpr }) => {
161
+ let vresult = {};
162
+ vresult = jsonSet(vresult, 'kind', kind);
163
+ vresult = jsonSet(vresult, 'name', name);
164
+ vresult = jsonSet(vresult, 'lexpr', lexpr);
165
+ vresult = jsonSet(vresult, 'rexpr', rexpr);
166
+ return {
167
+ A_Expr: vresult
168
+ };
169
+ };
170
+ export const TypeCast = ({ arg, typeName }) => {
171
+ let vresult = {};
172
+ vresult = jsonSet(vresult, 'arg', arg);
173
+ vresult = jsonSet(vresult, 'typeName', typeName);
174
+ return {
175
+ TypeCast: vresult
176
+ };
177
+ };
178
+ export const ColumnRef = ({ fields }) => {
179
+ let vresult = {};
180
+ vresult = jsonSet(vresult, 'fields', fields);
181
+ return {
182
+ ColumnRef: vresult
183
+ };
184
+ };
185
+ export const FuncCall = ({ funcname, args, agg_star, func_variadic, agg_order, agg_distinct, agg_filter, agg_within_group, over }) => {
186
+ let vresult = {};
187
+ vresult = jsonSet(vresult, 'funcname', funcname);
188
+ vresult = jsonSet(vresult, 'args', args);
189
+ vresult = jsonSet(vresult, 'agg_star', agg_star);
190
+ vresult = jsonSet(vresult, 'func_variadic', func_variadic);
191
+ vresult = jsonSet(vresult, 'agg_order', agg_order);
192
+ vresult = jsonSet(vresult, 'agg_distinct', agg_distinct);
193
+ vresult = jsonSet(vresult, 'agg_filter', agg_filter);
194
+ vresult = jsonSet(vresult, 'agg_within_group', agg_within_group);
195
+ vresult = jsonSet(vresult, 'over', over);
196
+ return {
197
+ FuncCall: vresult
198
+ };
199
+ };
200
+ export const AlterDefaultPrivilegesStmt = ({ options, action }) => {
201
+ let vresult = {};
202
+ vresult = jsonSet(vresult, 'options', options);
203
+ vresult = jsonSet(vresult, 'action', action);
204
+ return {
205
+ AlterDefaultPrivilegesStmt: vresult
206
+ };
207
+ };
208
+ export const DefElem = ({ defname, arg, defaction, defnamespace }) => {
209
+ let vresult = {};
210
+ vresult = jsonSet(vresult, 'defname', defname);
211
+ vresult = jsonSet(vresult, 'arg', arg);
212
+ vresult = jsonSet(vresult, 'defaction', defaction);
213
+ vresult = jsonSet(vresult, 'defnamespace', defnamespace);
214
+ return {
215
+ DefElem: vresult
216
+ };
217
+ };
218
+ export const GrantStmt = ({ is_grant, targtype, objtype, privileges, grantees, behavior, objects, grant_option }) => {
219
+ let vresult = {};
220
+ vresult = jsonSet(vresult, 'is_grant', is_grant);
221
+ vresult = jsonSet(vresult, 'targtype', targtype);
222
+ vresult = jsonSet(vresult, 'objtype', objtype);
223
+ vresult = jsonSet(vresult, 'privileges', privileges);
224
+ vresult = jsonSet(vresult, 'grantees', grantees);
225
+ vresult = jsonSet(vresult, 'behavior', behavior);
226
+ vresult = jsonSet(vresult, 'objects', objects);
227
+ vresult = jsonSet(vresult, 'grant_option', grant_option);
228
+ return {
229
+ GrantStmt: vresult
230
+ };
231
+ };
232
+ export const AccessPriv = ({ priv_name, cols }) => {
233
+ let vresult = {};
234
+ vresult = jsonSet(vresult, 'priv_name', priv_name);
235
+ vresult = jsonSet(vresult, 'cols', cols);
236
+ return {
237
+ AccessPriv: vresult
238
+ };
239
+ };
240
+ export const RoleSpec = ({ roletype, rolename }) => {
241
+ let vresult = {};
242
+ vresult = jsonSet(vresult, 'roletype', roletype);
243
+ vresult = jsonSet(vresult, 'rolename', rolename);
244
+ return {
245
+ RoleSpec: vresult
246
+ };
247
+ };
248
+ export const CommentStmt = ({ objtype, object, comment }) => {
249
+ let vresult = {};
250
+ vresult = jsonSet(vresult, 'objtype', objtype);
251
+ vresult = jsonSet(vresult, 'object', object);
252
+ vresult = jsonSet(vresult, 'comment', comment);
253
+ return {
254
+ CommentStmt: vresult
255
+ };
256
+ };
257
+ export const ObjectWithArgs = ({ objname, objargs, args_unspecified }) => {
258
+ let vresult = {};
259
+ vresult = jsonSet(vresult, 'objname', objname);
260
+ vresult = jsonSet(vresult, 'objargs', objargs);
261
+ vresult = jsonSet(vresult, 'args_unspecified', args_unspecified);
262
+ return {
263
+ ObjectWithArgs: vresult
264
+ };
265
+ };
266
+ export const SelectStmt = ({ targetList, fromClause, groupClause, havingClause, op, sortClause, whereClause, distinctClause, limitCount, valuesLists, intoClause, all, larg, rarg, limitOffset, withClause, lockingClause, windowClause }) => {
267
+ let vresult = {};
268
+ vresult = jsonSet(vresult, 'targetList', targetList);
269
+ vresult = jsonSet(vresult, 'fromClause', fromClause);
270
+ vresult = jsonSet(vresult, 'groupClause', groupClause);
271
+ vresult = jsonSet(vresult, 'havingClause', havingClause);
272
+ vresult = jsonSet(vresult, 'op', op);
273
+ vresult = jsonSet(vresult, 'sortClause', sortClause);
274
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
275
+ vresult = jsonSet(vresult, 'distinctClause', distinctClause);
276
+ vresult = jsonSet(vresult, 'limitCount', limitCount);
277
+ vresult = jsonSet(vresult, 'valuesLists', valuesLists);
278
+ vresult = jsonSet(vresult, 'intoClause', intoClause);
279
+ vresult = jsonSet(vresult, 'all', all);
280
+ vresult = jsonSet(vresult, 'larg', larg);
281
+ vresult = jsonSet(vresult, 'rarg', rarg);
282
+ vresult = jsonSet(vresult, 'limitOffset', limitOffset);
283
+ vresult = jsonSet(vresult, 'withClause', withClause);
284
+ vresult = jsonSet(vresult, 'lockingClause', lockingClause);
285
+ vresult = jsonSet(vresult, 'windowClause', windowClause);
286
+ return {
287
+ SelectStmt: vresult
288
+ };
289
+ };
290
+ export const ResTarget = ({ val, name, indirection }) => {
291
+ let vresult = {};
292
+ vresult = jsonSet(vresult, 'val', val);
293
+ vresult = jsonSet(vresult, 'name', name);
294
+ vresult = jsonSet(vresult, 'indirection', indirection);
295
+ return {
296
+ ResTarget: vresult
297
+ };
298
+ };
299
+ export const Alias = ({ aliasname, colnames }) => {
300
+ let vresult = {};
301
+ vresult = jsonSet(vresult, 'aliasname', aliasname);
302
+ vresult = jsonSet(vresult, 'colnames', colnames);
303
+ return {
304
+ Alias: vresult
305
+ };
306
+ };
307
+ export const JoinExpr = ({ jointype, larg, rarg, quals, usingClause, isNatural, alias }) => {
308
+ let vresult = {};
309
+ vresult = jsonSet(vresult, 'jointype', jointype);
310
+ vresult = jsonSet(vresult, 'larg', larg);
311
+ vresult = jsonSet(vresult, 'rarg', rarg);
312
+ vresult = jsonSet(vresult, 'quals', quals);
313
+ vresult = jsonSet(vresult, 'usingClause', usingClause);
314
+ vresult = jsonSet(vresult, 'isNatural', isNatural);
315
+ vresult = jsonSet(vresult, 'alias', alias);
316
+ return {
317
+ JoinExpr: vresult
318
+ };
319
+ };
320
+ export const BoolExpr = ({ boolop, args }) => {
321
+ let vresult = {};
322
+ vresult = jsonSet(vresult, 'boolop', boolop);
323
+ vresult = jsonSet(vresult, 'args', args);
324
+ return {
325
+ BoolExpr: vresult
326
+ };
327
+ };
328
+ export const A_Star = ({}) => {
329
+ const vresult = {};
330
+ return {
331
+ A_Star: vresult
332
+ };
333
+ };
334
+ export const SortBy = ({ node, sortby_dir, sortby_nulls, useOp }) => {
335
+ let vresult = {};
336
+ vresult = jsonSet(vresult, 'node', node);
337
+ vresult = jsonSet(vresult, 'sortby_dir', sortby_dir);
338
+ vresult = jsonSet(vresult, 'sortby_nulls', sortby_nulls);
339
+ vresult = jsonSet(vresult, 'useOp', useOp);
340
+ return {
341
+ SortBy: vresult
342
+ };
343
+ };
344
+ export const NamedArgExpr = ({ arg, name, argnumber }) => {
345
+ let vresult = {};
346
+ vresult = jsonSet(vresult, 'arg', arg);
347
+ vresult = jsonSet(vresult, 'name', name);
348
+ vresult = jsonSet(vresult, 'argnumber', argnumber);
349
+ return {
350
+ NamedArgExpr: vresult
351
+ };
352
+ };
353
+ export const A_ArrayExpr = ({ elements }) => {
354
+ let vresult = {};
355
+ vresult = jsonSet(vresult, 'elements', elements);
356
+ return {
357
+ A_ArrayExpr: vresult
358
+ };
359
+ };
360
+ export const Float = ({ str }) => {
361
+ let vresult = {};
362
+ vresult = jsonSet(vresult, 'str', str);
363
+ return {
364
+ Float: vresult
365
+ };
366
+ };
367
+ export const RangeFunction = ({ is_rowsfrom, functions, coldeflist, alias, lateral, ordinality }) => {
368
+ let vresult = {};
369
+ vresult = jsonSet(vresult, 'is_rowsfrom', is_rowsfrom);
370
+ vresult = jsonSet(vresult, 'functions', functions);
371
+ vresult = jsonSet(vresult, 'coldeflist', coldeflist);
372
+ vresult = jsonSet(vresult, 'alias', alias);
373
+ vresult = jsonSet(vresult, 'lateral', lateral);
374
+ vresult = jsonSet(vresult, 'ordinality', ordinality);
375
+ return {
376
+ RangeFunction: vresult
377
+ };
378
+ };
379
+ export const SubLink = ({ subLinkType, subselect, testexpr, operName }) => {
380
+ let vresult = {};
381
+ vresult = jsonSet(vresult, 'subLinkType', subLinkType);
382
+ vresult = jsonSet(vresult, 'subselect', subselect);
383
+ vresult = jsonSet(vresult, 'testexpr', testexpr);
384
+ vresult = jsonSet(vresult, 'operName', operName);
385
+ return {
386
+ SubLink: vresult
387
+ };
388
+ };
389
+ export const Null = ({}) => {
390
+ const vresult = {};
391
+ return {
392
+ Null: vresult
393
+ };
394
+ };
395
+ export const VariableSetStmt = ({ kind, name, args, is_local }) => {
396
+ let vresult = {};
397
+ vresult = jsonSet(vresult, 'kind', kind);
398
+ vresult = jsonSet(vresult, 'name', name);
399
+ vresult = jsonSet(vresult, 'args', args);
400
+ vresult = jsonSet(vresult, 'is_local', is_local);
401
+ return {
402
+ VariableSetStmt: vresult
403
+ };
404
+ };
405
+ export const VariableShowStmt = ({ name }) => {
406
+ let vresult = {};
407
+ vresult = jsonSet(vresult, 'name', name);
408
+ return {
409
+ VariableShowStmt: vresult
410
+ };
411
+ };
412
+ export const DoStmt = ({ args }) => {
413
+ let vresult = {};
414
+ vresult = jsonSet(vresult, 'args', args);
415
+ return {
416
+ DoStmt: vresult
417
+ };
418
+ };
419
+ export const CreateDomainStmt = ({ domainname, typeName, constraints, collClause }) => {
420
+ let vresult = {};
421
+ vresult = jsonSet(vresult, 'domainname', domainname);
422
+ vresult = jsonSet(vresult, 'typeName', typeName);
423
+ vresult = jsonSet(vresult, 'constraints', constraints);
424
+ vresult = jsonSet(vresult, 'collClause', collClause);
425
+ return {
426
+ CreateDomainStmt: vresult
427
+ };
428
+ };
429
+ export const CreateEnumStmt = ({ typeName, vals }) => {
430
+ let vresult = {};
431
+ vresult = jsonSet(vresult, 'typeName', typeName);
432
+ vresult = jsonSet(vresult, 'vals', vals);
433
+ return {
434
+ CreateEnumStmt: vresult
435
+ };
436
+ };
437
+ export const CreateExtensionStmt = ({ extname, options, if_not_exists }) => {
438
+ let vresult = {};
439
+ vresult = jsonSet(vresult, 'extname', extname);
440
+ vresult = jsonSet(vresult, 'options', options);
441
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
442
+ return {
443
+ CreateExtensionStmt: vresult
444
+ };
445
+ };
446
+ export const CreateFunctionStmt = ({ replace, funcname, parameters, returnType, options }) => {
447
+ let vresult = {};
448
+ vresult = jsonSet(vresult, 'replace', replace);
449
+ vresult = jsonSet(vresult, 'funcname', funcname);
450
+ vresult = jsonSet(vresult, 'parameters', parameters);
451
+ vresult = jsonSet(vresult, 'returnType', returnType);
452
+ vresult = jsonSet(vresult, 'options', options);
453
+ return {
454
+ CreateFunctionStmt: vresult
455
+ };
456
+ };
457
+ export const FunctionParameter = ({ name, argType, mode, defexpr }) => {
458
+ let vresult = {};
459
+ vresult = jsonSet(vresult, 'name', name);
460
+ vresult = jsonSet(vresult, 'argType', argType);
461
+ vresult = jsonSet(vresult, 'mode', mode);
462
+ vresult = jsonSet(vresult, 'defexpr', defexpr);
463
+ return {
464
+ FunctionParameter: vresult
465
+ };
466
+ };
467
+ export const TransactionStmt = ({ kind, options, gid }) => {
468
+ let vresult = {};
469
+ vresult = jsonSet(vresult, 'kind', kind);
470
+ vresult = jsonSet(vresult, 'options', options);
471
+ vresult = jsonSet(vresult, 'gid', gid);
472
+ return {
473
+ TransactionStmt: vresult
474
+ };
475
+ };
476
+ export const IndexStmt = ({ idxname, relation, accessMethod, indexParams, concurrent, unique, whereClause, options, if_not_exists }) => {
477
+ let vresult = {};
478
+ vresult = jsonSet(vresult, 'idxname', idxname);
479
+ vresult = jsonSet(vresult, 'relation', relation);
480
+ vresult = jsonSet(vresult, 'accessMethod', accessMethod);
481
+ vresult = jsonSet(vresult, 'indexParams', indexParams);
482
+ vresult = jsonSet(vresult, 'concurrent', concurrent);
483
+ vresult = jsonSet(vresult, 'unique', unique);
484
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
485
+ vresult = jsonSet(vresult, 'options', options);
486
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
487
+ return {
488
+ IndexStmt: vresult
489
+ };
490
+ };
491
+ export const IndexElem = ({ name, ordering, nulls_ordering, expr, opclass, collation }) => {
492
+ let vresult = {};
493
+ vresult = jsonSet(vresult, 'name', name);
494
+ vresult = jsonSet(vresult, 'ordering', ordering);
495
+ vresult = jsonSet(vresult, 'nulls_ordering', nulls_ordering);
496
+ vresult = jsonSet(vresult, 'expr', expr);
497
+ vresult = jsonSet(vresult, 'opclass', opclass);
498
+ vresult = jsonSet(vresult, 'collation', collation);
499
+ return {
500
+ IndexElem: vresult
501
+ };
502
+ };
503
+ export const NullTest = ({ arg, nulltesttype }) => {
504
+ let vresult = {};
505
+ vresult = jsonSet(vresult, 'arg', arg);
506
+ vresult = jsonSet(vresult, 'nulltesttype', nulltesttype);
507
+ return {
508
+ NullTest: vresult
509
+ };
510
+ };
511
+ export const ParamRef = ({ number }) => {
512
+ let vresult = {};
513
+ vresult = jsonSet(vresult, 'number', number);
514
+ return {
515
+ ParamRef: vresult
516
+ };
517
+ };
518
+ export const CreatePolicyStmt = ({ policy_name, table, cmd_name, permissive, roles, qual, with_check }) => {
519
+ let vresult = {};
520
+ vresult = jsonSet(vresult, 'policy_name', policy_name);
521
+ vresult = jsonSet(vresult, 'table', table);
522
+ vresult = jsonSet(vresult, 'cmd_name', cmd_name);
523
+ vresult = jsonSet(vresult, 'permissive', permissive);
524
+ vresult = jsonSet(vresult, 'roles', roles);
525
+ vresult = jsonSet(vresult, 'qual', qual);
526
+ vresult = jsonSet(vresult, 'with_check', with_check);
527
+ return {
528
+ CreatePolicyStmt: vresult
529
+ };
530
+ };
531
+ export const RangeSubselect = ({ subquery, alias, lateral }) => {
532
+ let vresult = {};
533
+ vresult = jsonSet(vresult, 'subquery', subquery);
534
+ vresult = jsonSet(vresult, 'alias', alias);
535
+ vresult = jsonSet(vresult, 'lateral', lateral);
536
+ return {
537
+ RangeSubselect: vresult
538
+ };
539
+ };
540
+ export const A_Indirection = ({ arg, indirection }) => {
541
+ let vresult = {};
542
+ vresult = jsonSet(vresult, 'arg', arg);
543
+ vresult = jsonSet(vresult, 'indirection', indirection);
544
+ return {
545
+ A_Indirection: vresult
546
+ };
547
+ };
548
+ export const RowExpr = ({ args, row_format }) => {
549
+ let vresult = {};
550
+ vresult = jsonSet(vresult, 'args', args);
551
+ vresult = jsonSet(vresult, 'row_format', row_format);
552
+ return {
553
+ RowExpr: vresult
554
+ };
555
+ };
556
+ export const CreateRoleStmt = ({ stmt_type, role, options }) => {
557
+ let vresult = {};
558
+ vresult = jsonSet(vresult, 'stmt_type', stmt_type);
559
+ vresult = jsonSet(vresult, 'role', role);
560
+ vresult = jsonSet(vresult, 'options', options);
561
+ return {
562
+ CreateRoleStmt: vresult
563
+ };
564
+ };
565
+ export const GrantRoleStmt = ({ granted_roles, grantee_roles, is_grant, behavior, admin_opt }) => {
566
+ let vresult = {};
567
+ vresult = jsonSet(vresult, 'granted_roles', granted_roles);
568
+ vresult = jsonSet(vresult, 'grantee_roles', grantee_roles);
569
+ vresult = jsonSet(vresult, 'is_grant', is_grant);
570
+ vresult = jsonSet(vresult, 'behavior', behavior);
571
+ vresult = jsonSet(vresult, 'admin_opt', admin_opt);
572
+ return {
573
+ GrantRoleStmt: vresult
574
+ };
575
+ };
576
+ export const RuleStmt = ({ relation, rulename, event, instead, actions, whereClause, replace }) => {
577
+ let vresult = {};
578
+ vresult = jsonSet(vresult, 'relation', relation);
579
+ vresult = jsonSet(vresult, 'rulename', rulename);
580
+ vresult = jsonSet(vresult, 'event', event);
581
+ vresult = jsonSet(vresult, 'instead', instead);
582
+ vresult = jsonSet(vresult, 'actions', actions);
583
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
584
+ vresult = jsonSet(vresult, 'replace', replace);
585
+ return {
586
+ RuleStmt: vresult
587
+ };
588
+ };
589
+ export const UpdateStmt = ({ relation, targetList, whereClause, returningList, fromClause, withClause }) => {
590
+ let vresult = {};
591
+ vresult = jsonSet(vresult, 'relation', relation);
592
+ vresult = jsonSet(vresult, 'targetList', targetList);
593
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
594
+ vresult = jsonSet(vresult, 'returningList', returningList);
595
+ vresult = jsonSet(vresult, 'fromClause', fromClause);
596
+ vresult = jsonSet(vresult, 'withClause', withClause);
597
+ return {
598
+ UpdateStmt: vresult
599
+ };
600
+ };
601
+ export const DeleteStmt = ({ relation, whereClause, usingClause, returningList, withClause }) => {
602
+ let vresult = {};
603
+ vresult = jsonSet(vresult, 'relation', relation);
604
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
605
+ vresult = jsonSet(vresult, 'usingClause', usingClause);
606
+ vresult = jsonSet(vresult, 'returningList', returningList);
607
+ vresult = jsonSet(vresult, 'withClause', withClause);
608
+ return {
609
+ DeleteStmt: vresult
610
+ };
611
+ };
612
+ export const InsertStmt = ({ relation, selectStmt, override, cols, onConflictClause, returningList, withClause }) => {
613
+ let vresult = {};
614
+ vresult = jsonSet(vresult, 'relation', relation);
615
+ vresult = jsonSet(vresult, 'selectStmt', selectStmt);
616
+ vresult = jsonSet(vresult, 'override', override);
617
+ vresult = jsonSet(vresult, 'cols', cols);
618
+ vresult = jsonSet(vresult, 'onConflictClause', onConflictClause);
619
+ vresult = jsonSet(vresult, 'returningList', returningList);
620
+ vresult = jsonSet(vresult, 'withClause', withClause);
621
+ return {
622
+ InsertStmt: vresult
623
+ };
624
+ };
625
+ export const CreateSeqStmt = ({ sequence, options, if_not_exists }) => {
626
+ let vresult = {};
627
+ vresult = jsonSet(vresult, 'sequence', sequence);
628
+ vresult = jsonSet(vresult, 'options', options);
629
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
630
+ return {
631
+ CreateSeqStmt: vresult
632
+ };
633
+ };
634
+ export const OnConflictClause = ({ action, infer, targetList, whereClause }) => {
635
+ let vresult = {};
636
+ vresult = jsonSet(vresult, 'action', action);
637
+ vresult = jsonSet(vresult, 'infer', infer);
638
+ vresult = jsonSet(vresult, 'targetList', targetList);
639
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
640
+ return {
641
+ OnConflictClause: vresult
642
+ };
643
+ };
644
+ export const InferClause = ({ indexElems, conname, whereClause }) => {
645
+ let vresult = {};
646
+ vresult = jsonSet(vresult, 'indexElems', indexElems);
647
+ vresult = jsonSet(vresult, 'conname', conname);
648
+ vresult = jsonSet(vresult, 'whereClause', whereClause);
649
+ return {
650
+ InferClause: vresult
651
+ };
652
+ };
653
+ export const MultiAssignRef = ({ source, colno, ncolumns }) => {
654
+ let vresult = {};
655
+ vresult = jsonSet(vresult, 'source', source);
656
+ vresult = jsonSet(vresult, 'colno', colno);
657
+ vresult = jsonSet(vresult, 'ncolumns', ncolumns);
658
+ return {
659
+ MultiAssignRef: vresult
660
+ };
661
+ };
662
+ export const SetToDefault = ({}) => {
663
+ const vresult = {};
664
+ return {
665
+ SetToDefault: vresult
666
+ };
667
+ };
668
+ export const MinMaxExpr = ({ op, args }) => {
669
+ let vresult = {};
670
+ vresult = jsonSet(vresult, 'op', op);
671
+ vresult = jsonSet(vresult, 'args', args);
672
+ return {
673
+ MinMaxExpr: vresult
674
+ };
675
+ };
676
+ export const DropStmt = ({ objects, removeType, behavior, missing_ok, concurrent }) => {
677
+ let vresult = {};
678
+ vresult = jsonSet(vresult, 'objects', objects);
679
+ vresult = jsonSet(vresult, 'removeType', removeType);
680
+ vresult = jsonSet(vresult, 'behavior', behavior);
681
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
682
+ vresult = jsonSet(vresult, 'concurrent', concurrent);
683
+ return {
684
+ DropStmt: vresult
685
+ };
686
+ };
687
+ export const CreateTrigStmt = ({ trigname, relation, funcname, row, timing, events, args, columns, whenClause, transitionRels, isconstraint, deferrable, initdeferred }) => {
688
+ let vresult = {};
689
+ vresult = jsonSet(vresult, 'trigname', trigname);
690
+ vresult = jsonSet(vresult, 'relation', relation);
691
+ vresult = jsonSet(vresult, 'funcname', funcname);
692
+ vresult = jsonSet(vresult, 'row', row);
693
+ vresult = jsonSet(vresult, 'timing', timing);
694
+ vresult = jsonSet(vresult, 'events', events);
695
+ vresult = jsonSet(vresult, 'args', args);
696
+ vresult = jsonSet(vresult, 'columns', columns);
697
+ vresult = jsonSet(vresult, 'whenClause', whenClause);
698
+ vresult = jsonSet(vresult, 'transitionRels', transitionRels);
699
+ vresult = jsonSet(vresult, 'isconstraint', isconstraint);
700
+ vresult = jsonSet(vresult, 'deferrable', deferrable);
701
+ vresult = jsonSet(vresult, 'initdeferred', initdeferred);
702
+ return {
703
+ CreateTrigStmt: vresult
704
+ };
705
+ };
706
+ export const TriggerTransition = ({ name, isNew, isTable }) => {
707
+ let vresult = {};
708
+ vresult = jsonSet(vresult, 'name', name);
709
+ vresult = jsonSet(vresult, 'isNew', isNew);
710
+ vresult = jsonSet(vresult, 'isTable', isTable);
711
+ return {
712
+ TriggerTransition: vresult
713
+ };
714
+ };
715
+ export const CompositeTypeStmt = ({ typevar, coldeflist }) => {
716
+ let vresult = {};
717
+ vresult = jsonSet(vresult, 'typevar', typevar);
718
+ vresult = jsonSet(vresult, 'coldeflist', coldeflist);
719
+ return {
720
+ CompositeTypeStmt: vresult
721
+ };
722
+ };
723
+ export const ExplainStmt = ({ query, options }) => {
724
+ let vresult = {};
725
+ vresult = jsonSet(vresult, 'query', query);
726
+ vresult = jsonSet(vresult, 'options', options);
727
+ return {
728
+ ExplainStmt: vresult
729
+ };
730
+ };
731
+ export const ViewStmt = ({ view, query, withCheckOption, replace, aliases, options }) => {
732
+ let vresult = {};
733
+ vresult = jsonSet(vresult, 'view', view);
734
+ vresult = jsonSet(vresult, 'query', query);
735
+ vresult = jsonSet(vresult, 'withCheckOption', withCheckOption);
736
+ vresult = jsonSet(vresult, 'replace', replace);
737
+ vresult = jsonSet(vresult, 'aliases', aliases);
738
+ vresult = jsonSet(vresult, 'options', options);
739
+ return {
740
+ ViewStmt: vresult
741
+ };
742
+ };
743
+ export const CollateClause = ({ arg, collname }) => {
744
+ let vresult = {};
745
+ vresult = jsonSet(vresult, 'arg', arg);
746
+ vresult = jsonSet(vresult, 'collname', collname);
747
+ return {
748
+ CollateClause: vresult
749
+ };
750
+ };
751
+ export const DefineStmt = ({ kind, defnames, args, definition, oldstyle }) => {
752
+ let vresult = {};
753
+ vresult = jsonSet(vresult, 'kind', kind);
754
+ vresult = jsonSet(vresult, 'defnames', defnames);
755
+ vresult = jsonSet(vresult, 'args', args);
756
+ vresult = jsonSet(vresult, 'definition', definition);
757
+ vresult = jsonSet(vresult, 'oldstyle', oldstyle);
758
+ return {
759
+ DefineStmt: vresult
760
+ };
761
+ };
762
+ export const DropRoleStmt = ({ roles, missing_ok }) => {
763
+ let vresult = {};
764
+ vresult = jsonSet(vresult, 'roles', roles);
765
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
766
+ return {
767
+ DropRoleStmt: vresult
768
+ };
769
+ };
770
+ export const AlterOwnerStmt = ({ objectType, object, newowner }) => {
771
+ let vresult = {};
772
+ vresult = jsonSet(vresult, 'objectType', objectType);
773
+ vresult = jsonSet(vresult, 'object', object);
774
+ vresult = jsonSet(vresult, 'newowner', newowner);
775
+ return {
776
+ AlterOwnerStmt: vresult
777
+ };
778
+ };
779
+ export const AlterObjectSchemaStmt = ({ objectType, object, newschema, relation, missing_ok }) => {
780
+ let vresult = {};
781
+ vresult = jsonSet(vresult, 'objectType', objectType);
782
+ vresult = jsonSet(vresult, 'object', object);
783
+ vresult = jsonSet(vresult, 'newschema', newschema);
784
+ vresult = jsonSet(vresult, 'relation', relation);
785
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
786
+ return {
787
+ AlterObjectSchemaStmt: vresult
788
+ };
789
+ };
790
+ export const CreateConversionStmt = ({ conversion_name, for_encoding_name, to_encoding_name, func_name, def }) => {
791
+ let vresult = {};
792
+ vresult = jsonSet(vresult, 'conversion_name', conversion_name);
793
+ vresult = jsonSet(vresult, 'for_encoding_name', for_encoding_name);
794
+ vresult = jsonSet(vresult, 'to_encoding_name', to_encoding_name);
795
+ vresult = jsonSet(vresult, 'func_name', func_name);
796
+ vresult = jsonSet(vresult, 'def', def);
797
+ return {
798
+ CreateConversionStmt: vresult
799
+ };
800
+ };
801
+ export const CreateFdwStmt = ({ fdwname, func_options, options }) => {
802
+ let vresult = {};
803
+ vresult = jsonSet(vresult, 'fdwname', fdwname);
804
+ vresult = jsonSet(vresult, 'func_options', func_options);
805
+ vresult = jsonSet(vresult, 'options', options);
806
+ return {
807
+ CreateFdwStmt: vresult
808
+ };
809
+ };
810
+ export const CreateForeignServerStmt = ({ servername, fdwname, options, servertype, version }) => {
811
+ let vresult = {};
812
+ vresult = jsonSet(vresult, 'servername', servername);
813
+ vresult = jsonSet(vresult, 'fdwname', fdwname);
814
+ vresult = jsonSet(vresult, 'options', options);
815
+ vresult = jsonSet(vresult, 'servertype', servertype);
816
+ vresult = jsonSet(vresult, 'version', version);
817
+ return {
818
+ CreateForeignServerStmt: vresult
819
+ };
820
+ };
821
+ export const CreatePLangStmt = ({ plname, plhandler }) => {
822
+ let vresult = {};
823
+ vresult = jsonSet(vresult, 'plname', plname);
824
+ vresult = jsonSet(vresult, 'plhandler', plhandler);
825
+ return {
826
+ CreatePLangStmt: vresult
827
+ };
828
+ };
829
+ export const CreateOpFamilyStmt = ({ opfamilyname, amname }) => {
830
+ let vresult = {};
831
+ vresult = jsonSet(vresult, 'opfamilyname', opfamilyname);
832
+ vresult = jsonSet(vresult, 'amname', amname);
833
+ return {
834
+ CreateOpFamilyStmt: vresult
835
+ };
836
+ };
837
+ export const CreateOpClassStmt = ({ opclassname, amname, datatype, items, isDefault }) => {
838
+ let vresult = {};
839
+ vresult = jsonSet(vresult, 'opclassname', opclassname);
840
+ vresult = jsonSet(vresult, 'amname', amname);
841
+ vresult = jsonSet(vresult, 'datatype', datatype);
842
+ vresult = jsonSet(vresult, 'items', items);
843
+ vresult = jsonSet(vresult, 'isDefault', isDefault);
844
+ return {
845
+ CreateOpClassStmt: vresult
846
+ };
847
+ };
848
+ export const CreateOpClassItem = ({ itemtype, storedtype, name, number, class_args, order_family }) => {
849
+ let vresult = {};
850
+ vresult = jsonSet(vresult, 'itemtype', itemtype);
851
+ vresult = jsonSet(vresult, 'storedtype', storedtype);
852
+ vresult = jsonSet(vresult, 'name', name);
853
+ vresult = jsonSet(vresult, 'number', number);
854
+ vresult = jsonSet(vresult, 'class_args', class_args);
855
+ vresult = jsonSet(vresult, 'order_family', order_family);
856
+ return {
857
+ CreateOpClassItem: vresult
858
+ };
859
+ };
860
+ export const AlterOpFamilyStmt = ({ opfamilyname, amname, items, isDrop }) => {
861
+ let vresult = {};
862
+ vresult = jsonSet(vresult, 'opfamilyname', opfamilyname);
863
+ vresult = jsonSet(vresult, 'amname', amname);
864
+ vresult = jsonSet(vresult, 'items', items);
865
+ vresult = jsonSet(vresult, 'isDrop', isDrop);
866
+ return {
867
+ AlterOpFamilyStmt: vresult
868
+ };
869
+ };
870
+ export const AlterOperatorStmt = ({ opername, options }) => {
871
+ let vresult = {};
872
+ vresult = jsonSet(vresult, 'opername', opername);
873
+ vresult = jsonSet(vresult, 'options', options);
874
+ return {
875
+ AlterOperatorStmt: vresult
876
+ };
877
+ };
878
+ export const VacuumStmt = ({ options, relation, va_cols }) => {
879
+ let vresult = {};
880
+ vresult = jsonSet(vresult, 'options', options);
881
+ vresult = jsonSet(vresult, 'relation', relation);
882
+ vresult = jsonSet(vresult, 'va_cols', va_cols);
883
+ return {
884
+ VacuumStmt: vresult
885
+ };
886
+ };
887
+ export const CreateTableAsStmt = ({ query, into, relkind, if_not_exists }) => {
888
+ let vresult = {};
889
+ vresult = jsonSet(vresult, 'query', query);
890
+ vresult = jsonSet(vresult, 'into', into);
891
+ vresult = jsonSet(vresult, 'relkind', relkind);
892
+ vresult = jsonSet(vresult, 'if_not_exists', if_not_exists);
893
+ return {
894
+ CreateTableAsStmt: vresult
895
+ };
896
+ };
897
+ export const IntoClause = ({ rel, onCommit, colNames, skipData, options }) => {
898
+ let vresult = {};
899
+ vresult = jsonSet(vresult, 'rel', rel);
900
+ vresult = jsonSet(vresult, 'onCommit', onCommit);
901
+ vresult = jsonSet(vresult, 'colNames', colNames);
902
+ vresult = jsonSet(vresult, 'skipData', skipData);
903
+ vresult = jsonSet(vresult, 'options', options);
904
+ return {
905
+ IntoClause: vresult
906
+ };
907
+ };
908
+ export const CaseExpr = ({ args, defresult, arg }) => {
909
+ let vresult = {};
910
+ vresult = jsonSet(vresult, 'args', args);
911
+ vresult = jsonSet(vresult, 'defresult', defresult);
912
+ vresult = jsonSet(vresult, 'arg', arg);
913
+ return {
914
+ CaseExpr: vresult
915
+ };
916
+ };
917
+ export const CaseWhen = ({ expr, result }) => {
918
+ let vresult = {};
919
+ vresult = jsonSet(vresult, 'expr', expr);
920
+ vresult = jsonSet(vresult, 'result', result);
921
+ return {
922
+ CaseWhen: vresult
923
+ };
924
+ };
925
+ export const BooleanTest = ({ arg, booltesttype }) => {
926
+ let vresult = {};
927
+ vresult = jsonSet(vresult, 'arg', arg);
928
+ vresult = jsonSet(vresult, 'booltesttype', booltesttype);
929
+ return {
930
+ BooleanTest: vresult
931
+ };
932
+ };
933
+ export const AlterFunctionStmt = ({ func, actions }) => {
934
+ let vresult = {};
935
+ vresult = jsonSet(vresult, 'func', func);
936
+ vresult = jsonSet(vresult, 'actions', actions);
937
+ return {
938
+ AlterFunctionStmt: vresult
939
+ };
940
+ };
941
+ export const TruncateStmt = ({ relations, behavior, restart_seqs }) => {
942
+ let vresult = {};
943
+ vresult = jsonSet(vresult, 'relations', relations);
944
+ vresult = jsonSet(vresult, 'behavior', behavior);
945
+ vresult = jsonSet(vresult, 'restart_seqs', restart_seqs);
946
+ return {
947
+ TruncateStmt: vresult
948
+ };
949
+ };
950
+ export const A_Indices = ({ is_slice, lidx, uidx }) => {
951
+ let vresult = {};
952
+ vresult = jsonSet(vresult, 'is_slice', is_slice);
953
+ vresult = jsonSet(vresult, 'lidx', lidx);
954
+ vresult = jsonSet(vresult, 'uidx', uidx);
955
+ return {
956
+ A_Indices: vresult
957
+ };
958
+ };
959
+ export const NotifyStmt = ({ conditionname }) => {
960
+ let vresult = {};
961
+ vresult = jsonSet(vresult, 'conditionname', conditionname);
962
+ return {
963
+ NotifyStmt: vresult
964
+ };
965
+ };
966
+ export const ListenStmt = ({ conditionname }) => {
967
+ let vresult = {};
968
+ vresult = jsonSet(vresult, 'conditionname', conditionname);
969
+ return {
970
+ ListenStmt: vresult
971
+ };
972
+ };
973
+ export const UnlistenStmt = ({ conditionname }) => {
974
+ let vresult = {};
975
+ vresult = jsonSet(vresult, 'conditionname', conditionname);
976
+ return {
977
+ UnlistenStmt: vresult
978
+ };
979
+ };
980
+ export const BitString = ({ str }) => {
981
+ let vresult = {};
982
+ vresult = jsonSet(vresult, 'str', str);
983
+ return {
984
+ BitString: vresult
985
+ };
986
+ };
987
+ export const CoalesceExpr = ({ args }) => {
988
+ let vresult = {};
989
+ vresult = jsonSet(vresult, 'args', args);
990
+ return {
991
+ CoalesceExpr: vresult
992
+ };
993
+ };
994
+ export const ClusterStmt = ({ relation, indexname }) => {
995
+ let vresult = {};
996
+ vresult = jsonSet(vresult, 'relation', relation);
997
+ vresult = jsonSet(vresult, 'indexname', indexname);
998
+ return {
999
+ ClusterStmt: vresult
1000
+ };
1001
+ };
1002
+ export const TableLikeClause = ({ relation, options }) => {
1003
+ let vresult = {};
1004
+ vresult = jsonSet(vresult, 'relation', relation);
1005
+ vresult = jsonSet(vresult, 'options', options);
1006
+ return {
1007
+ TableLikeClause: vresult
1008
+ };
1009
+ };
1010
+ export const WithClause = ({ ctes, recursive }) => {
1011
+ let vresult = {};
1012
+ vresult = jsonSet(vresult, 'ctes', ctes);
1013
+ vresult = jsonSet(vresult, 'recursive', recursive);
1014
+ return {
1015
+ WithClause: vresult
1016
+ };
1017
+ };
1018
+ export const CommonTableExpr = ({ ctename, aliascolnames, ctequery }) => {
1019
+ let vresult = {};
1020
+ vresult = jsonSet(vresult, 'ctename', ctename);
1021
+ vresult = jsonSet(vresult, 'aliascolnames', aliascolnames);
1022
+ vresult = jsonSet(vresult, 'ctequery', ctequery);
1023
+ return {
1024
+ CommonTableExpr: vresult
1025
+ };
1026
+ };
1027
+ export const CreateRangeStmt = ({ typeName, params }) => {
1028
+ let vresult = {};
1029
+ vresult = jsonSet(vresult, 'typeName', typeName);
1030
+ vresult = jsonSet(vresult, 'params', params);
1031
+ return {
1032
+ CreateRangeStmt: vresult
1033
+ };
1034
+ };
1035
+ export const DeclareCursorStmt = ({ portalname, options, query }) => {
1036
+ let vresult = {};
1037
+ vresult = jsonSet(vresult, 'portalname', portalname);
1038
+ vresult = jsonSet(vresult, 'options', options);
1039
+ vresult = jsonSet(vresult, 'query', query);
1040
+ return {
1041
+ DeclareCursorStmt: vresult
1042
+ };
1043
+ };
1044
+ export const FetchStmt = ({ direction, howMany, portalname, ismove }) => {
1045
+ let vresult = {};
1046
+ vresult = jsonSet(vresult, 'direction', direction);
1047
+ vresult = jsonSet(vresult, 'howMany', howMany);
1048
+ vresult = jsonSet(vresult, 'portalname', portalname);
1049
+ vresult = jsonSet(vresult, 'ismove', ismove);
1050
+ return {
1051
+ FetchStmt: vresult
1052
+ };
1053
+ };
1054
+ export const LockingClause = ({ strength, waitPolicy, lockedRels }) => {
1055
+ let vresult = {};
1056
+ vresult = jsonSet(vresult, 'strength', strength);
1057
+ vresult = jsonSet(vresult, 'waitPolicy', waitPolicy);
1058
+ vresult = jsonSet(vresult, 'lockedRels', lockedRels);
1059
+ return {
1060
+ LockingClause: vresult
1061
+ };
1062
+ };
1063
+ export const CreateAmStmt = ({ amname, handler_name, amtype }) => {
1064
+ let vresult = {};
1065
+ vresult = jsonSet(vresult, 'amname', amname);
1066
+ vresult = jsonSet(vresult, 'handler_name', handler_name);
1067
+ vresult = jsonSet(vresult, 'amtype', amtype);
1068
+ return {
1069
+ CreateAmStmt: vresult
1070
+ };
1071
+ };
1072
+ export const CreateCastStmt = ({ sourcetype, targettype, context, inout, func }) => {
1073
+ let vresult = {};
1074
+ vresult = jsonSet(vresult, 'sourcetype', sourcetype);
1075
+ vresult = jsonSet(vresult, 'targettype', targettype);
1076
+ vresult = jsonSet(vresult, 'context', context);
1077
+ vresult = jsonSet(vresult, 'inout', inout);
1078
+ vresult = jsonSet(vresult, 'func', func);
1079
+ return {
1080
+ CreateCastStmt: vresult
1081
+ };
1082
+ };
1083
+ export const ReindexStmt = ({ kind, relation, options, name }) => {
1084
+ let vresult = {};
1085
+ vresult = jsonSet(vresult, 'kind', kind);
1086
+ vresult = jsonSet(vresult, 'relation', relation);
1087
+ vresult = jsonSet(vresult, 'options', options);
1088
+ vresult = jsonSet(vresult, 'name', name);
1089
+ return {
1090
+ ReindexStmt: vresult
1091
+ };
1092
+ };
1093
+ export const DropOwnedStmt = ({ roles, behavior }) => {
1094
+ let vresult = {};
1095
+ vresult = jsonSet(vresult, 'roles', roles);
1096
+ vresult = jsonSet(vresult, 'behavior', behavior);
1097
+ return {
1098
+ DropOwnedStmt: vresult
1099
+ };
1100
+ };
1101
+ export const ReassignOwnedStmt = ({ roles, newrole }) => {
1102
+ let vresult = {};
1103
+ vresult = jsonSet(vresult, 'roles', roles);
1104
+ vresult = jsonSet(vresult, 'newrole', newrole);
1105
+ return {
1106
+ ReassignOwnedStmt: vresult
1107
+ };
1108
+ };
1109
+ export const AlterSeqStmt = ({ sequence, options, missing_ok }) => {
1110
+ let vresult = {};
1111
+ vresult = jsonSet(vresult, 'sequence', sequence);
1112
+ vresult = jsonSet(vresult, 'options', options);
1113
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
1114
+ return {
1115
+ AlterSeqStmt: vresult
1116
+ };
1117
+ };
1118
+ export const AlterDomainStmt = ({ subtype, typeName, behavior, def, name, missing_ok }) => {
1119
+ let vresult = {};
1120
+ vresult = jsonSet(vresult, 'subtype', subtype);
1121
+ vresult = jsonSet(vresult, 'typeName', typeName);
1122
+ vresult = jsonSet(vresult, 'behavior', behavior);
1123
+ vresult = jsonSet(vresult, 'def', def);
1124
+ vresult = jsonSet(vresult, 'name', name);
1125
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
1126
+ return {
1127
+ AlterDomainStmt: vresult
1128
+ };
1129
+ };
1130
+ export const PrepareStmt = ({ name, query, argtypes }) => {
1131
+ let vresult = {};
1132
+ vresult = jsonSet(vresult, 'name', name);
1133
+ vresult = jsonSet(vresult, 'query', query);
1134
+ vresult = jsonSet(vresult, 'argtypes', argtypes);
1135
+ return {
1136
+ PrepareStmt: vresult
1137
+ };
1138
+ };
1139
+ export const ExecuteStmt = ({ name, params }) => {
1140
+ let vresult = {};
1141
+ vresult = jsonSet(vresult, 'name', name);
1142
+ vresult = jsonSet(vresult, 'params', params);
1143
+ return {
1144
+ ExecuteStmt: vresult
1145
+ };
1146
+ };
1147
+ export const AlterEnumStmt = ({ typeName, newVal, newValIsAfter, newValNeighbor, skipIfNewValExists }) => {
1148
+ let vresult = {};
1149
+ vresult = jsonSet(vresult, 'typeName', typeName);
1150
+ vresult = jsonSet(vresult, 'newVal', newVal);
1151
+ vresult = jsonSet(vresult, 'newValIsAfter', newValIsAfter);
1152
+ vresult = jsonSet(vresult, 'newValNeighbor', newValNeighbor);
1153
+ vresult = jsonSet(vresult, 'skipIfNewValExists', skipIfNewValExists);
1154
+ return {
1155
+ AlterEnumStmt: vresult
1156
+ };
1157
+ };
1158
+ export const CreateEventTrigStmt = ({ trigname, eventname, funcname, whenclause }) => {
1159
+ let vresult = {};
1160
+ vresult = jsonSet(vresult, 'trigname', trigname);
1161
+ vresult = jsonSet(vresult, 'eventname', eventname);
1162
+ vresult = jsonSet(vresult, 'funcname', funcname);
1163
+ vresult = jsonSet(vresult, 'whenclause', whenclause);
1164
+ return {
1165
+ CreateEventTrigStmt: vresult
1166
+ };
1167
+ };
1168
+ export const AlterEventTrigStmt = ({ trigname, tgenabled }) => {
1169
+ let vresult = {};
1170
+ vresult = jsonSet(vresult, 'trigname', trigname);
1171
+ vresult = jsonSet(vresult, 'tgenabled', tgenabled);
1172
+ return {
1173
+ AlterEventTrigStmt: vresult
1174
+ };
1175
+ };
1176
+ export const CreateUserMappingStmt = ({ user, servername, options }) => {
1177
+ let vresult = {};
1178
+ vresult = jsonSet(vresult, 'user', user);
1179
+ vresult = jsonSet(vresult, 'servername', servername);
1180
+ vresult = jsonSet(vresult, 'options', options);
1181
+ return {
1182
+ CreateUserMappingStmt: vresult
1183
+ };
1184
+ };
1185
+ export const AlterRoleStmt = ({ role, options, action }) => {
1186
+ let vresult = {};
1187
+ vresult = jsonSet(vresult, 'role', role);
1188
+ vresult = jsonSet(vresult, 'options', options);
1189
+ vresult = jsonSet(vresult, 'action', action);
1190
+ return {
1191
+ AlterRoleStmt: vresult
1192
+ };
1193
+ };
1194
+ export const AlterPolicyStmt = ({ policy_name, table, qual }) => {
1195
+ let vresult = {};
1196
+ vresult = jsonSet(vresult, 'policy_name', policy_name);
1197
+ vresult = jsonSet(vresult, 'table', table);
1198
+ vresult = jsonSet(vresult, 'qual', qual);
1199
+ return {
1200
+ AlterPolicyStmt: vresult
1201
+ };
1202
+ };
1203
+ export const AlterFdwStmt = ({ fdwname, func_options, options }) => {
1204
+ let vresult = {};
1205
+ vresult = jsonSet(vresult, 'fdwname', fdwname);
1206
+ vresult = jsonSet(vresult, 'func_options', func_options);
1207
+ vresult = jsonSet(vresult, 'options', options);
1208
+ return {
1209
+ AlterFdwStmt: vresult
1210
+ };
1211
+ };
1212
+ export const AlterForeignServerStmt = ({ servername, version, options, has_version }) => {
1213
+ let vresult = {};
1214
+ vresult = jsonSet(vresult, 'servername', servername);
1215
+ vresult = jsonSet(vresult, 'version', version);
1216
+ vresult = jsonSet(vresult, 'options', options);
1217
+ vresult = jsonSet(vresult, 'has_version', has_version);
1218
+ return {
1219
+ AlterForeignServerStmt: vresult
1220
+ };
1221
+ };
1222
+ export const AlterUserMappingStmt = ({ user, servername, options }) => {
1223
+ let vresult = {};
1224
+ vresult = jsonSet(vresult, 'user', user);
1225
+ vresult = jsonSet(vresult, 'servername', servername);
1226
+ vresult = jsonSet(vresult, 'options', options);
1227
+ return {
1228
+ AlterUserMappingStmt: vresult
1229
+ };
1230
+ };
1231
+ export const DropUserMappingStmt = ({ user, servername, missing_ok }) => {
1232
+ let vresult = {};
1233
+ vresult = jsonSet(vresult, 'user', user);
1234
+ vresult = jsonSet(vresult, 'servername', servername);
1235
+ vresult = jsonSet(vresult, 'missing_ok', missing_ok);
1236
+ return {
1237
+ DropUserMappingStmt: vresult
1238
+ };
1239
+ };
1240
+ export const CreateForeignTableStmt = ({ base, servername, options }) => {
1241
+ let vresult = {};
1242
+ vresult = jsonSet(vresult, 'base', base);
1243
+ vresult = jsonSet(vresult, 'servername', servername);
1244
+ vresult = jsonSet(vresult, 'options', options);
1245
+ return {
1246
+ CreateForeignTableStmt: vresult
1247
+ };
1248
+ };
1249
+ export const ImportForeignSchemaStmt = ({ server_name, remote_schema, local_schema, list_type, table_list, options }) => {
1250
+ let vresult = {};
1251
+ vresult = jsonSet(vresult, 'server_name', server_name);
1252
+ vresult = jsonSet(vresult, 'remote_schema', remote_schema);
1253
+ vresult = jsonSet(vresult, 'local_schema', local_schema);
1254
+ vresult = jsonSet(vresult, 'list_type', list_type);
1255
+ vresult = jsonSet(vresult, 'table_list', table_list);
1256
+ vresult = jsonSet(vresult, 'options', options);
1257
+ return {
1258
+ ImportForeignSchemaStmt: vresult
1259
+ };
1260
+ };
1261
+ export const ConstraintsSetStmt = ({ deferred }) => {
1262
+ let vresult = {};
1263
+ vresult = jsonSet(vresult, 'deferred', deferred);
1264
+ return {
1265
+ ConstraintsSetStmt: vresult
1266
+ };
1267
+ };
1268
+ export const GroupingFunc = ({ args }) => {
1269
+ let vresult = {};
1270
+ vresult = jsonSet(vresult, 'args', args);
1271
+ return {
1272
+ GroupingFunc: vresult
1273
+ };
1274
+ };
1275
+ export const GroupingSet = ({ kind, content }) => {
1276
+ let vresult = {};
1277
+ vresult = jsonSet(vresult, 'kind', kind);
1278
+ vresult = jsonSet(vresult, 'content', content);
1279
+ return {
1280
+ GroupingSet: vresult
1281
+ };
1282
+ };
1283
+ export const WindowDef = ({ orderClause, frameOptions, partitionClause, name, startOffset, endOffset }) => {
1284
+ let vresult = {};
1285
+ vresult = jsonSet(vresult, 'orderClause', orderClause);
1286
+ vresult = jsonSet(vresult, 'frameOptions', frameOptions);
1287
+ vresult = jsonSet(vresult, 'partitionClause', partitionClause);
1288
+ vresult = jsonSet(vresult, 'name', name);
1289
+ vresult = jsonSet(vresult, 'startOffset', startOffset);
1290
+ vresult = jsonSet(vresult, 'endOffset', endOffset);
1291
+ return {
1292
+ WindowDef: vresult
1293
+ };
1294
+ };
1295
+ export const DiscardStmt = ({ target }) => {
1296
+ let vresult = {};
1297
+ vresult = jsonSet(vresult, 'target', target);
1298
+ return {
1299
+ DiscardStmt: vresult
1300
+ };
1301
+ };
1302
+ export const LockStmt = ({ relations, mode, nowait }) => {
1303
+ let vresult = {};
1304
+ vresult = jsonSet(vresult, 'relations', relations);
1305
+ vresult = jsonSet(vresult, 'mode', mode);
1306
+ vresult = jsonSet(vresult, 'nowait', nowait);
1307
+ return {
1308
+ LockStmt: vresult
1309
+ };
1310
+ };
1311
+ export const AlterRoleSetStmt = ({ role, setstmt }) => {
1312
+ let vresult = {};
1313
+ vresult = jsonSet(vresult, 'role', role);
1314
+ vresult = jsonSet(vresult, 'setstmt', setstmt);
1315
+ return {
1316
+ AlterRoleSetStmt: vresult
1317
+ };
1318
+ };
1319
+ export const RefreshMatViewStmt = ({ relation, concurrent, skipData }) => {
1320
+ let vresult = {};
1321
+ vresult = jsonSet(vresult, 'relation', relation);
1322
+ vresult = jsonSet(vresult, 'concurrent', concurrent);
1323
+ vresult = jsonSet(vresult, 'skipData', skipData);
1324
+ return {
1325
+ RefreshMatViewStmt: vresult
1326
+ };
1327
+ };
1328
+ export const CreateTransformStmt = ({ type_name, lang, fromsql, tosql }) => {
1329
+ let vresult = {};
1330
+ vresult = jsonSet(vresult, 'type_name', type_name);
1331
+ vresult = jsonSet(vresult, 'lang', lang);
1332
+ vresult = jsonSet(vresult, 'fromsql', fromsql);
1333
+ vresult = jsonSet(vresult, 'tosql', tosql);
1334
+ return {
1335
+ CreateTransformStmt: vresult
1336
+ };
1337
+ };
1338
+ export const ClosePortalStmt = ({ portalname }) => {
1339
+ let vresult = {};
1340
+ vresult = jsonSet(vresult, 'portalname', portalname);
1341
+ return {
1342
+ ClosePortalStmt: vresult
1343
+ };
1344
+ };
1345
+ export const CurrentOfExpr = ({ cursor_name }) => {
1346
+ let vresult = {};
1347
+ vresult = jsonSet(vresult, 'cursor_name', cursor_name);
1348
+ return {
1349
+ CurrentOfExpr: vresult
1350
+ };
1351
+ };
1352
+ export const DeallocateStmt = ({ name }) => {
1353
+ let vresult = {};
1354
+ vresult = jsonSet(vresult, 'name', name);
1355
+ return {
1356
+ DeallocateStmt: vresult
1357
+ };
1358
+ };
1359
+ export const ReplicaIdentityStmt = ({ identity_type, name }) => {
1360
+ let vresult = {};
1361
+ vresult = jsonSet(vresult, 'identity_type', identity_type);
1362
+ vresult = jsonSet(vresult, 'name', name);
1363
+ return {
1364
+ ReplicaIdentityStmt: vresult
1365
+ };
1366
+ };
1367
+ export const RangeTableSample = ({ relation, method, args, repeatable }) => {
1368
+ let vresult = {};
1369
+ vresult = jsonSet(vresult, 'relation', relation);
1370
+ vresult = jsonSet(vresult, 'method', method);
1371
+ vresult = jsonSet(vresult, 'args', args);
1372
+ vresult = jsonSet(vresult, 'repeatable', repeatable);
1373
+ return {
1374
+ RangeTableSample: vresult
1375
+ };
1376
+ };
1377
+ export const SecLabelStmt = ({ objtype, object, label, provider }) => {
1378
+ let vresult = {};
1379
+ vresult = jsonSet(vresult, 'objtype', objtype);
1380
+ vresult = jsonSet(vresult, 'object', object);
1381
+ vresult = jsonSet(vresult, 'label', label);
1382
+ vresult = jsonSet(vresult, 'provider', provider);
1383
+ return {
1384
+ SecLabelStmt: vresult
1385
+ };
1386
+ };
1387
+ export const CopyStmt = ({ query, filename }) => {
1388
+ let vresult = {};
1389
+ vresult = jsonSet(vresult, 'query', query);
1390
+ vresult = jsonSet(vresult, 'filename', filename);
1391
+ return {
1392
+ CopyStmt: vresult
1393
+ };
1394
+ };
1395
+ export const AlterTSConfigurationStmt = ({ kind, cfgname, tokentype, dicts, override, replace }) => {
1396
+ let vresult = {};
1397
+ vresult = jsonSet(vresult, 'kind', kind);
1398
+ vresult = jsonSet(vresult, 'cfgname', cfgname);
1399
+ vresult = jsonSet(vresult, 'tokentype', tokentype);
1400
+ vresult = jsonSet(vresult, 'dicts', dicts);
1401
+ vresult = jsonSet(vresult, 'override', override);
1402
+ vresult = jsonSet(vresult, 'replace', replace);
1403
+ return {
1404
+ AlterTSConfigurationStmt: vresult
1405
+ };
1406
+ };
1407
+ export const XmlExpr = ({ op, args, name, xmloption, named_args }) => {
1408
+ let vresult = {};
1409
+ vresult = jsonSet(vresult, 'op', op);
1410
+ vresult = jsonSet(vresult, 'args', args);
1411
+ vresult = jsonSet(vresult, 'name', name);
1412
+ vresult = jsonSet(vresult, 'xmloption', xmloption);
1413
+ vresult = jsonSet(vresult, 'named_args', named_args);
1414
+ return {
1415
+ XmlExpr: vresult
1416
+ };
1417
+ };
1418
+ export const XmlSerialize = ({ xmloption, expr, typeName }) => {
1419
+ let vresult = {};
1420
+ vresult = jsonSet(vresult, 'xmloption', xmloption);
1421
+ vresult = jsonSet(vresult, 'expr', expr);
1422
+ vresult = jsonSet(vresult, 'typeName', typeName);
1423
+ return {
1424
+ XmlSerialize: vresult
1425
+ };
1426
+ };