deno.land / x / bld@v0.0.1 / helpers.ts

نووسراو ببینە
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
export function valuePlaceholders(values: unknown[], count: number) { const placeholders = values .map((value) => { if (value === undefined) return "NULL"; else return `$${count++}`; }) .join(", ");
return `(${placeholders})`;}
export function toSQLValueType(value: unknown): string { if (typeof value === "string") { return `'${value}'`; } if (value == true) { return "TRUE"; } if (value == false) { return "FALSE"; }
return `${value}`;}
export function toSQLKeyValuePair(key: string, value: unknown): string { return `${key} = ${toSQLValueType(value)}`;}
// TODO: Find better nameexport function objectToKeyValueArrays<T>( data: T,): [keys: string[], values: unknown[]] { const keys = Object.keys(data as Record<string, unknown>); const values = Object.values(data as Record<string, unknown>); return [keys, values];}
bld
DocumentationDocumentation
GitHub Repositorywralith/bld
GitHub Stars
0

Version Info

Tagged at
2 months ago

External Dependencies

No external dependencies 🎉