Skip to content

Commit

Permalink
Refactored client and improved connection
Browse files Browse the repository at this point in the history
  • Loading branch information
halvardssm committed Apr 15, 2024
1 parent 62225bd commit 4ce8069
Show file tree
Hide file tree
Showing 10 changed files with 1,005 additions and 974 deletions.
50 changes: 26 additions & 24 deletions lib/client.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
// import { MysqlClient } from "./client.ts";
// import { URL_TEST_CONNECTION } from "./utils/testing.ts";
// import { implementationTest } from "@halvardm/sqlx/testing";
import { MysqlClient } from "./client.ts";
import { URL_TEST_CONNECTION } from "./utils/testing.ts";
import { implementationTest } from "@halvardm/sqlx/testing";

// Deno.test("MysqlClient", async (t) => {
// await implementationTest({
// t,
// Client: MysqlClient,
// connectionUrl: URL_TEST_CONNECTION,
// connectionOptions: {},
// queries:{
// createTable: "CREATE TABLE IF NOT EXISTS sqlxtesttable (testcol TEXT)",
// dropTable: "DROP TABLE IF EXISTS sqlxtesttable",
// insertOneToTable: "INSERT INTO sqlxtesttable (testcol) VALUES (?)",
// insertManyToTable: "INSERT INTO sqlxtesttable (testcol) VALUES (?),(?),(?)",
// selectOneFromTable: "SELECT * FROM sqlxtesttable WHERE testcol = ? LIMIT 1",
// selectByMatchFromTable: "SELECT * FROM sqlxtesttable WHERE testcol = ?",
// selectManyFromTable: "SELECT * FROM sqlxtesttable",
// select1AsString: "SELECT '1' as result",
// select1Plus1AsNumber: "SELECT 1+1 as result",
// deleteByMatchFromTable: "DELETE FROM sqlxtesttable WHERE testcol = ?",
// deleteAllFromTable: "DELETE FROM sqlxtesttable",
// }
// });
// });
Deno.test("MysqlClient", async (t) => {
await implementationTest({
t,
Client: MysqlClient,
connectionUrl: URL_TEST_CONNECTION,
connectionOptions: {},
queries: {
createTable: "CREATE TABLE IF NOT EXISTS sqlxtesttable (testcol TEXT)",
dropTable: "DROP TABLE IF EXISTS sqlxtesttable",
insertOneToTable: "INSERT INTO sqlxtesttable (testcol) VALUES (?)",
insertManyToTable:
"INSERT INTO sqlxtesttable (testcol) VALUES (?),(?),(?)",
selectOneFromTable:
"SELECT * FROM sqlxtesttable WHERE testcol = ? LIMIT 1",
selectByMatchFromTable: "SELECT * FROM sqlxtesttable WHERE testcol = ?",
selectManyFromTable: "SELECT * FROM sqlxtesttable",
select1AsString: "SELECT '1' as result",
select1Plus1AsNumber: "SELECT 1+1 as result",
deleteByMatchFromTable: "DELETE FROM sqlxtesttable WHERE testcol = ?",
deleteAllFromTable: "DELETE FROM sqlxtesttable",
},
});
});
Loading

0 comments on commit 4ce8069

Please sign in to comment.