Skip to content

Commit

Permalink
cleanup and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
halvardssm committed Apr 21, 2024
1 parent 1dfba2b commit 52112b9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"db:stop": "docker compose down --remove-orphans --volumes"
},
"imports": {
"@halvardm/sqlx": "../deno-sqlx/mod.ts",
"@halvardm/sqlx/testing": "../deno-sqlx/lib/testing.ts",
"@halvardm/sqlx": "jsr:@halvardm/sqlx@0.0.0-11",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/async": "jsr:@std/async@^0.221.0",
"@std/crypto": "jsr:@std/crypto@^0.221.0",
Expand Down
4 changes: 2 additions & 2 deletions lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class MysqlQueriable extends SqlxBase implements
readonly queryOptions: MysqlQueryOptions;

get connected(): boolean {
throw new Error("Method not implemented.");
return this.connection.connected;
}

constructor(
Expand Down Expand Up @@ -181,9 +181,9 @@ export class MysqlPrepared extends SqlxBase implements
) {
super();
this.connection = connection;
this.#queriable = new MysqlQueriable(connection);
this.sql = sql;
this.queryOptions = options;
this.#queriable = new MysqlQueriable(connection, this.queryOptions);
}

execute(
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SqlxError } from "@halvardm/sqlx";
import { isSqlxError, SqlxError } from "@halvardm/sqlx";

export class MysqlError extends SqlxError {
constructor(msg: string) {
Expand Down Expand Up @@ -46,5 +46,5 @@ export class MysqlTransactionError extends MysqlError {
* Check if an error is a MysqlError
*/
export function isMysqlError(err: unknown): err is MysqlError {
return err instanceof MysqlError;
return isSqlxError(err) && err instanceof MysqlError;
}
4 changes: 2 additions & 2 deletions lib/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getLogger } from "@std/log";
import { getLogger, type Logger } from "@std/log";
import { MODULE_NAME } from "./meta.ts";

/**
Expand All @@ -7,6 +7,6 @@ import { MODULE_NAME } from "./meta.ts";
*
* @see {@link https://deno.land/std/log/mod.ts}
*/
export function logger() {
export function logger(): Logger {
return getLogger(MODULE_NAME);
}
2 changes: 1 addition & 1 deletion lib/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function replaceParams(
})`;
}
case "string":
return `"${escapeString(val)}"`;
return `"${escapeString(val as string)}"`;
case "undefined":
return "NULL";
case "number":
Expand Down

0 comments on commit 52112b9

Please sign in to comment.