-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Dec 19, 2022
1 parent
6277b15
commit a207052
Showing
4 changed files
with
24 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
type JsonPrimitive = string | number | boolean | null; | ||
type JsonObject = { [key: string]: JsonValue }; | ||
type JsonArray = JsonValue[]; | ||
type JsonValue = JsonPrimitive | JsonArray | JsonObject; | ||
|
||
type TemplateValue = JsonValue | SqlQuery | TemplateValue[]; | ||
type TemplateValue = unknown | SqlQuery; | ||
|
||
type SqlQuery = { | ||
readonly text: string, | ||
readonly values: JsonArray[] | ||
readonly values: Array<unknown> | ||
}; | ||
|
||
declare function sql(strings: TemplateStringsArray, ...v: TemplateValue[]): SqlQuery; | ||
declare function sql(strings: TemplateStringsArray | string, ...v: TemplateValue[]): SqlQuery; | ||
declare namespace sql { | ||
function raw(s: string): string; | ||
function id(s: string): string; | ||
function insertObjs(s: JsonObject[]): SqlQuery; | ||
function updateObj(s: JsonObject): SqlQuery; | ||
function id(s: string): SqlQuery; | ||
function join(s: TemplateValue[], separator?: string): SqlQuery; | ||
} | ||
|
||
export = sql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters