Repository navigation
Expand file tree
/
Copy pathsql-writing.ts
More file actions
43 lines (42 loc) · 1.53 KB
/
Copy pathsql-writing.ts
File metadata and controls
43 lines (42 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
EXACT_DECIMAL_TYPE_NAMES,
FLOAT64_TYPE_NAMES,
identifierDoubleQuoted,
INSTANT_TYPE_NAMES,
literalStandard,
NO_BARE_SPELLING,
NOTHING_STANDS_ALONE,
NULL_NON_FINITE,
STANDARD_DDL_TYPES,
STANDARD_TYPE_VOCABULARY,
unquoteStandard,
} from "@/lib/db/sql-writing/shared";
import { binaryStandardHex } from "@/lib/db/sql-writing/export-shared";
import type { SqlWritingSpec } from "@/lib/db/sql-writing/types";
/** How a generated statement spells a literal, a name and a bind for Kubernetes. */
export const KUBERNETES_SQL_WRITING: SqlWritingSpec = {
// No generator calls `quoteLiteral` for Kubernetes: a kubectl statement names objects by their own names, which need
// no quoting; the row is the inert answer Oxia's is.
escapeLiteral: literalStandard,
unescapeLiteral: unquoteStandard,
// The SQL standard form, which this engine's generators fall back to.
quoteIdentifier: identifierDoubleQuoted,
placeholder: null,
temporalLiteral: null,
inlineEdit: {
instantTypeNames: INSTANT_TYPE_NAMES,
exactDecimalTypeNames: EXACT_DECIMAL_TYPE_NAMES,
float64TypeNames: FLOAT64_TYPE_NAMES,
},
export: {
ddlTypes: STANDARD_DDL_TYPES,
// Kubernetes has no statement form for an export.
standsAlone: NOTHING_STANDS_ALONE,
bareSpelling: NO_BARE_SPELLING,
typeVocabulary: STANDARD_TYPE_VOCABULARY,
// Kubernetes has no statement language for a value either; the inert default, as Oxia's.
binaryLiteral: binaryStandardHex,
nonFinite: NULL_NON_FINITE,
insertForm: "values",
},
};