diff options
author | gumi <git@gumi.ca> | 2020-05-16 17:18:17 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2020-05-16 17:18:17 -0400 |
commit | 25a3c3fefae87d55da172f2aaef6a27987f439fd (patch) | |
tree | c410cdfd73c7cf9101f7f6dab1c8fa1772dd05c9 /server/frob/sql.ts | |
parent | 1af05ee74d0b2ec4e132617ab71bedd30fbfe753 (diff) | |
download | tools-25a3c3fefae87d55da172f2aaef6a27987f439fd.tar.gz tools-25a3c3fefae87d55da172f2aaef6a27987f439fd.tar.bz2 tools-25a3c3fefae87d55da172f2aaef6a27987f439fd.tar.xz tools-25a3c3fefae87d55da172f2aaef6a27987f439fd.zip |
[frob] update for deno 1.0
Diffstat (limited to 'server/frob/sql.ts')
-rw-r--r-- | server/frob/sql.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/server/frob/sql.ts b/server/frob/sql.ts index 60c4bbe..a7ab414 100644 --- a/server/frob/sql.ts +++ b/server/frob/sql.ts @@ -1,11 +1,11 @@ -import { Client } from "https://deno.land/x/mysql/mod.ts"; +import { Client, Connection } from "https://deno.land/x/mysql/mod.ts"; class SQLHandler { - private client; - private hostname; - private username; - private password; - private backslash; + private client: Client; + private hostname: string; + private username: string; + private password: string; + private backslash: RegExp; constructor (hostname: string = "127.0.0.1", username: string = "evol", password: string = "evol") { this.client = new Client(); @@ -154,21 +154,21 @@ class SQLHandler { `); // some old parties have weird names } - escape (str) { + escape (str: string) { // for some reason the deno sql module doesn't escape backslashes return str.replace(this.backslash, "\\\\"); } - async transaction (fn) { - return await this.client.transaction(fn); + async transaction (processor: (c: Connection) => Promise<any>) { + return await this.client.transaction(processor); } - async query (...args) { - return await this.client.query(...args); + async query (sql: string, params?: any[]) { + return await this.client.query(sql, params); } - async do (...args) { - return await this.client.execute(...args); + async do (sql: string, params?: any[]) { + return await this.client.execute(sql, params); } |