@proteinjs/db-driver-knex 1.0.28 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.1](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.1.0...@proteinjs/db-driver-knex@1.1.1) (2024-06-27)
7
+
8
+ **Note:** Version bump only for package @proteinjs/db-driver-knex
9
+
10
+
11
+
12
+
13
+
14
+ # [1.1.0](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.0.28...@proteinjs/db-driver-knex@1.1.0) (2024-06-27)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * use the same version of moment ([62ffa76](https://github.com/proteinjs/db/commit/62ffa765a84ee0325f7ff5194fc898f74f43cfd8))
20
+
21
+
22
+ ### Features
23
+
24
+ * add case sensitivity control to condition ([#4](https://github.com/proteinjs/db/issues/4)) ([13da747](https://github.com/proteinjs/db/commit/13da7477be6216d4449311ad3a68ef3cde246d45))
25
+
26
+
27
+
28
+
29
+
6
30
  ## [1.0.28](https://github.com/proteinjs/db/compare/@proteinjs/db-driver-knex@1.0.27...@proteinjs/db-driver-knex@1.0.28) (2024-06-24)
7
31
 
8
32
  **Note:** Version bump only for package @proteinjs/db-driver-knex
@@ -24,7 +24,7 @@ require("moment");
24
24
  require("mysql");
25
25
  require("uuid");
26
26
  /** Generate Source Graph */
27
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"KNEX\",\"type\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"config\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexConfig\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexConfig\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"getKnex\",\"returnType\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"getDbName\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createDbIfNotExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"dbExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<boolean>\",\"filePath\":null,\"qualifiedName\":\"/Promise<boolean>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"databaseName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"start\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"stop\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"setMaxAllowedPacketSize\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"getTableManager\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableManager\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableManager\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"runQuery\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SerializedRecord[]>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SerializedRecord[]>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runDml\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<number>\",\"filePath\":null,\"qualifiedName\":\"/Promise<number>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DbDriver\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexSchemaOperations\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexDriver\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"alterTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createColumn\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"column\",\"type\":{\"packageName\":\"\",\"name\":\"Column<any, any>\",\"filePath\":null,\"qualifiedName\":\"/Column<any, any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableBuilder\",\"type\":{\"packageName\":\"\",\"name\":\"knex.TableBuilder\",\"filePath\":null,\"qualifiedName\":\"/knex.TableBuilder\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"SchemaOperations\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/SchemaOperations\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/SchemaOperations\"}],\"edges\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"w\":\"@proteinjs/db/DbDriver\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"w\":\"@proteinjs/db/SchemaOperations\",\"value\":\"implements interface\"}]}";
27
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"KNEX\",\"type\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"config\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexConfig\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexConfig\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"getTable\",\"type\":{\"packageName\":\"\",\"name\":\"((name: string) => Table<any>) | undefined\",\"filePath\":null,\"qualifiedName\":\"/((name: string) => Table<any>) | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getKnex\",\"returnType\":{\"packageName\":\"\",\"name\":\"knex\",\"filePath\":null,\"qualifiedName\":\"/knex\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"getDbName\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createDbIfNotExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"dbExists\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<boolean>\",\"filePath\":null,\"qualifiedName\":\"/Promise<boolean>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"databaseName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"start\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"stop\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"setMaxAllowedPacketSize\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"getTableManager\",\"returnType\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableManager\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableManager\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"handleCaseSensitivity\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"tableName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"columnName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"caseSensitive\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runQuery\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SerializedRecord[]>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SerializedRecord[]>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverQueryStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverQueryStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"runDml\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<number>\",\"filePath\":null,\"qualifiedName\":\"/Promise<number>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"generateStatement\",\"type\":{\"packageName\":\"\",\"name\":\"(config: DbDriverDmlStatementConfig) => Statement\",\"filePath\":null,\"qualifiedName\":\"/(config: DbDriverDmlStatementConfig) => Statement\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"DbDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/DbDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/DbDriver\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"value\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexSchemaOperations\",\"filePath\":\"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts\",\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"knexDriver\",\"type\":{\"packageName\":\"@proteinjs/db-driver-knex\",\"name\":\"KnexDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-driver-knex/KnexDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"alterTable\",\"returnType\":null,\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"createColumn\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"column\",\"type\":{\"packageName\":\"\",\"name\":\"Column<any, any>\",\"filePath\":null,\"qualifiedName\":\"/Column<any, any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableBuilder\",\"type\":{\"packageName\":\"\",\"name\":\"knex.TableBuilder\",\"filePath\":null,\"qualifiedName\":\"/knex.TableBuilder\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"tableChanges\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"TableChanges\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableChanges\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"SchemaOperations\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/SchemaOperations\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/SchemaOperations\"}],\"edges\":[{\"v\":\"@proteinjs/db-driver-knex/KnexDriver\",\"w\":\"@proteinjs/db/DbDriver\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-driver-knex/KnexSchemaOperations\",\"w\":\"@proteinjs/db/SchemaOperations\",\"value\":\"implements interface\"}]}";
28
28
  /** Generate Source Links */
29
29
  var KnexDriver_1 = require("../src/KnexDriver");
30
30
  var KnexSchemaOperations_1 = require("../src/KnexSchemaOperations");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,iCAA+B;AAC/B,2BAAyB;AACzB,gBAAc;AACd,kBAAgB;AAChB,iBAAe;AACf,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,4yQAA4yQ,CAAC;AAGj0Q,4BAA4B;AAE5B,gDAA+C;AAC/C,oEAAmE;AAEnE,IAAM,WAAW,GAAG;IACnB,sCAAsC,EAAE,uBAAU;IAClD,gDAAgD,EAAE,2CAAoB;CACtE,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,+BAA6B;AAC7B,iCAA+B;AAC/B,2BAAyB;AACzB,gBAAc;AACd,kBAAgB;AAChB,iBAAe;AACf,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,y8SAAy8S,CAAC;AAG99S,4BAA4B;AAE5B,gDAA+C;AAC/C,oEAAmE;AAEnE,IAAM,WAAW,GAAG;IACnB,sCAAsC,EAAE,uBAAU;IAClD,gDAAgD,EAAE,2CAAoB;CACtE,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
@@ -1,5 +1,5 @@
1
1
  import knex from 'knex';
2
- import { DbDriver, DbDriverStatementConfig, SerializedRecord, TableManager } from '@proteinjs/db';
2
+ import { DbDriver, DbDriverQueryStatementConfig, DbDriverDmlStatementConfig, SerializedRecord, Table, TableManager } from '@proteinjs/db';
3
3
  import { KnexConfig } from './KnexConfig';
4
4
  import { Statement } from '@proteinjs/db-query';
5
5
  export declare class KnexDriver implements DbDriver {
@@ -7,7 +7,8 @@ export declare class KnexDriver implements DbDriver {
7
7
  private logger;
8
8
  private config;
9
9
  private knexConfig;
10
- constructor(config: KnexConfig);
10
+ getTable: ((name: string) => Table<any>) | undefined;
11
+ constructor(config: KnexConfig, getTable?: (name: string) => Table<any>);
11
12
  getKnex(): knex;
12
13
  getDbName(): string;
13
14
  createDbIfNotExists(): Promise<void>;
@@ -16,7 +17,13 @@ export declare class KnexDriver implements DbDriver {
16
17
  stop(): Promise<void>;
17
18
  private setMaxAllowedPacketSize;
18
19
  getTableManager(): TableManager;
19
- runQuery(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<SerializedRecord[]>;
20
- runDml(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<number>;
20
+ /**
21
+ * MariaDB is case insensitive by default.
22
+ * If we want to query with case sensitivity, prepend the column name with the `BINARY` keyword.
23
+ * @returns identifier to be used in SQL statement, may contain modifier if using case sensitivity
24
+ */
25
+ handleCaseSensitivity(tableName: string, columnName: string, caseSensitive: boolean): string;
26
+ runQuery(generateStatement: (config: DbDriverQueryStatementConfig) => Statement): Promise<SerializedRecord[]>;
27
+ runDml(generateStatement: (config: DbDriverDmlStatementConfig) => Statement): Promise<number>;
21
28
  }
22
29
  //# sourceMappingURL=KnexDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnexDriver.d.ts","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAE,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AI,EAAE,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;gBAEhD,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC;IAavE,OAAO,IAAI,IAAI;IAQf,SAAS;IAIH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;YAQ5B,QAAQ;IAWhB,KAAK;IAIL,IAAI;YAII,uBAAuB;IAOrC,eAAe,IAAI,YAAY;IAM/B;;;;OAIG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,MAAM;IAsBtF,QAAQ,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAc7G,MAAM,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAIpG"}
@@ -46,7 +46,7 @@ var util_1 = require("@proteinjs/util");
46
46
  var KnexSchemaOperations_1 = require("./KnexSchemaOperations");
47
47
  var KnexColumnTypeFactory_1 = require("./KnexColumnTypeFactory");
48
48
  var KnexDriver = /** @class */ (function () {
49
- function KnexDriver(config) {
49
+ function KnexDriver(config, getTable) {
50
50
  this.logger = new util_1.Logger(this.constructor.name);
51
51
  this.config = config;
52
52
  this.knexConfig = {
@@ -57,6 +57,7 @@ var KnexDriver = /** @class */ (function () {
57
57
  password: this.config.password,
58
58
  },
59
59
  };
60
+ this.getTable = getTable;
60
61
  }
61
62
  KnexDriver.prototype.getKnex = function () {
62
63
  if (!KnexDriver.KNEX) {
@@ -149,13 +150,38 @@ var KnexDriver = /** @class */ (function () {
149
150
  var schemaOperations = new KnexSchemaOperations_1.KnexSchemaOperations(this);
150
151
  return new db_1.TableManager(this, columnTypeFactory, schemaOperations);
151
152
  };
153
+ /**
154
+ * MariaDB is case insensitive by default.
155
+ * If we want to query with case sensitivity, prepend the column name with the `BINARY` keyword.
156
+ * @returns identifier to be used in SQL statement, may contain modifier if using case sensitivity
157
+ */
158
+ KnexDriver.prototype.handleCaseSensitivity = function (tableName, columnName, caseSensitive) {
159
+ if (!caseSensitive) {
160
+ return columnName;
161
+ }
162
+ var table = this.getTable ? this.getTable(tableName) : (0, db_1.tableByName)(tableName);
163
+ var column = Object.values(table.columns).find(function (col) { return col.name === columnName; });
164
+ if (!column) {
165
+ throw new Error("Column ".concat(columnName, " does not exist in table ").concat(table.name));
166
+ }
167
+ var stringColTypes = ['char', 'varchar', 'longtext'];
168
+ var isStringColType = stringColTypes.includes(new KnexColumnTypeFactory_1.KnexColumnTypeFactory().getType(column));
169
+ if (isStringColType) {
170
+ return "BINARY ".concat(columnName);
171
+ }
172
+ return columnName;
173
+ };
152
174
  KnexDriver.prototype.runQuery = function (generateStatement) {
153
175
  return __awaiter(this, void 0, void 0, function () {
154
176
  var _a, sql, params, error_1;
155
177
  return __generator(this, function (_b) {
156
178
  switch (_b.label) {
157
179
  case 0:
158
- _a = generateStatement({ useParams: true, prefixTablesWithDb: true }), sql = _a.sql, params = _a.params;
180
+ _a = generateStatement({
181
+ useParams: true,
182
+ prefixTablesWithDb: true,
183
+ handleCaseSensitivity: this.handleCaseSensitivity.bind(this),
184
+ }), sql = _a.sql, params = _a.params;
159
185
  _b.label = 1;
160
186
  case 1:
161
187
  _b.trys.push([1, 3, , 4]);
@@ -1 +1 @@
1
- {"version":3,"file":"KnexDriver.js","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,oCAAkG;AAElG,wCAAyC;AAEzC,+DAA8D;AAC9D,iEAAgE;AAEhE;IAME,oBAAY,MAAkB;QAJtB,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,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AAqB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;yBAC7D,CAAC,EAJM,GAAG,SAAA,EAAE,MAAM,YAAA,CAIhB;;;;wBAEO,qBAAM,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,MAAa,CAAC,EAAA;4BAApD,sBAAO,CAAC,SAA4C,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,oEAAoE;;;wBAE9H,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAgC,GAAG,CAAE,CAAC,CAAC;wBACzD,MAAM,OAAK,CAAC;;;;;KAEf;IAEK,2BAAM,GAAZ,UAAa,iBAAoE;;;;;4BACrD,qBAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAA;;wBAAxD,YAAY,GAAK,CAAC,SAAsC,CAAQ,aAApD;wBACpB,sBAAO,YAAY,EAAC;;;;KACrB;IACH,iBAAC;AAAD,CAAC,AArHD,IAqHC;AArHY,gCAAU"}
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var db_1 = require("@proteinjs/db");
40
40
  var KnexDriver_1 = require("../src/KnexDriver");
41
- var dropTable = function (table) { return __awaiter(void 0, void 0, void 0, function () {
41
+ var dropTable = function (knexDriver, table) { return __awaiter(void 0, void 0, void 0, function () {
42
42
  return __generator(this, function (_a) {
43
43
  switch (_a.label) {
44
44
  case 0: return [4 /*yield*/, knexDriver.getKnex().schema.withSchema(knexDriver.getDbName()).hasTable(table.name)];
@@ -52,12 +52,18 @@ var dropTable = function (table) { return __awaiter(void 0, void 0, void 0, func
52
52
  }
53
53
  });
54
54
  }); };
55
- var knexDriver = new KnexDriver_1.KnexDriver({
55
+ var knexDriverColumnTypesTests = new KnexDriver_1.KnexDriver({
56
56
  host: 'localhost',
57
57
  user: 'root',
58
58
  password: '',
59
59
  dbName: 'test',
60
- });
61
- describe('Column Type Tests', (0, db_1.columnTypeTests)(knexDriver, dropTable));
62
- describe('CRUD Tests', (0, db_1.crudTests)(knexDriver, dropTable));
60
+ }, db_1.getColTypeTestTable);
61
+ describe('Column Type Tests', (0, db_1.columnTypeTests)(knexDriverColumnTypesTests, function (table) { return dropTable(knexDriverColumnTypesTests, table); }));
62
+ var knexDriverCrudTests = new KnexDriver_1.KnexDriver({
63
+ host: 'localhost',
64
+ user: 'root',
65
+ password: '',
66
+ dbName: 'test',
67
+ }, db_1.getCrudTestTable);
68
+ describe('CRUD Tests', (0, db_1.crudTests)(knexDriverCrudTests, function (table) { return dropTable(knexDriverCrudTests, table); }));
63
69
  //# sourceMappingURL=Crud.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Crud.test.js","sourceRoot":"","sources":["../../test/Crud.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAkE;AAClE,gDAA+C;AAE/C,IAAM,SAAS,GAAG,UAAO,KAAiB;;;oBACpC,qBAAM,UAAU,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAA;;qBAAzF,SAAyF,EAAzF,wBAAyF;gBAC3F,qBAAM,UAAU,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAA;;gBAA1F,SAA0F,CAAC;;;;;KAE9F,CAAC;AAEF,IAAM,UAAU,GAAG,IAAI,uBAAU,CAAC;IAChC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,MAAM;CACf,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE,IAAA,oBAAe,EAAC,UAAU,EAAE,SA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AC,mBAAmB,EAAE,UAAC,KAAK,IAAK,OAAA,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAArC,CAAqC,CAAC,CACjF,CAAC"}
@@ -12,7 +12,7 @@ import 'uuid';
12
12
  /** Generate Source Graph */
13
13
 
14
14
  const sourceGraph =
15
- '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-driver-knex/KnexDriver","value":{"packageName":"@proteinjs/db-driver-knex","name":"KnexDriver","filePath":"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts","qualifiedName":"@proteinjs/db-driver-knex/KnexDriver","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"KNEX","type":{"packageName":"","name":"knex","filePath":null,"qualifiedName":"/knex","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"private"},{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"config","type":{"packageName":"@proteinjs/db-driver-knex","name":"KnexConfig","filePath":null,"qualifiedName":"@proteinjs/db-driver-knex/KnexConfig","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"knexConfig","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"getKnex","returnType":{"packageName":"","name":"knex","filePath":null,"qualifiedName":"/knex","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"getDbName","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"createDbIfNotExists","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"dbExists","returnType":{"packageName":"","name":"Promise<boolean>","filePath":null,"qualifiedName":"/Promise<boolean>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"databaseName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"start","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"stop","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"setMaxAllowedPacketSize","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]},{"name":"getTableManager","returnType":{"packageName":"@proteinjs/db","name":"TableManager","filePath":null,"qualifiedName":"@proteinjs/db/TableManager","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"runQuery","returnType":{"packageName":"","name":"Promise<SerializedRecord[]>","filePath":null,"qualifiedName":"/Promise<SerializedRecord[]>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"generateStatement","type":{"packageName":"","name":"(config: DbDriverStatementConfig) => Statement","filePath":null,"qualifiedName":"/(config: DbDriverStatementConfig) => Statement","typeParameters":null,"directParents":null}}]},{"name":"runDml","returnType":{"packageName":"","name":"Promise<number>","filePath":null,"qualifiedName":"/Promise<number>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"generateStatement","type":{"packageName":"","name":"(config: DbDriverStatementConfig) => Statement","filePath":null,"qualifiedName":"/(config: DbDriverStatementConfig) => Statement","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db","name":"DbDriver","filePath":null,"qualifiedName":"@proteinjs/db/DbDriver","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db/DbDriver"},{"v":"@proteinjs/db-driver-knex/KnexSchemaOperations","value":{"packageName":"@proteinjs/db-driver-knex","name":"KnexSchemaOperations","filePath":"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts","qualifiedName":"@proteinjs/db-driver-knex/KnexSchemaOperations","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"knexDriver","type":{"packageName":"@proteinjs/db-driver-knex","name":"KnexDriver","filePath":null,"qualifiedName":"@proteinjs/db-driver-knex/KnexDriver","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"createTable","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}}]},{"name":"alterTable","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}},{"name":"tableChanges","type":{"packageName":"@proteinjs/db","name":"TableChanges","filePath":null,"qualifiedName":"@proteinjs/db/TableChanges","typeParameters":null,"directParents":null}}]},{"name":"createColumn","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"column","type":{"packageName":"","name":"Column<any, any>","filePath":null,"qualifiedName":"/Column<any, any>","typeParameters":null,"directParents":null}},{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}},{"name":"tableBuilder","type":{"packageName":"","name":"knex.TableBuilder","filePath":null,"qualifiedName":"/knex.TableBuilder","typeParameters":null,"directParents":null}},{"name":"tableChanges","type":{"packageName":"@proteinjs/db","name":"TableChanges","filePath":null,"qualifiedName":"@proteinjs/db/TableChanges","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db","name":"SchemaOperations","filePath":null,"qualifiedName":"@proteinjs/db/SchemaOperations","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db/SchemaOperations"}],"edges":[{"v":"@proteinjs/db-driver-knex/KnexDriver","w":"@proteinjs/db/DbDriver","value":"implements interface"},{"v":"@proteinjs/db-driver-knex/KnexSchemaOperations","w":"@proteinjs/db/SchemaOperations","value":"implements interface"}]}';
15
+ '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-driver-knex/KnexDriver","value":{"packageName":"@proteinjs/db-driver-knex","name":"KnexDriver","filePath":"/home/runner/work/db/db/packages/drivers/knex/src/KnexDriver.ts","qualifiedName":"@proteinjs/db-driver-knex/KnexDriver","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"KNEX","type":{"packageName":"","name":"knex","filePath":null,"qualifiedName":"/knex","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"private"},{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"config","type":{"packageName":"@proteinjs/db-driver-knex","name":"KnexConfig","filePath":null,"qualifiedName":"@proteinjs/db-driver-knex/KnexConfig","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"knexConfig","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"getTable","type":{"packageName":"","name":"((name: string) => Table<any>) | undefined","filePath":null,"qualifiedName":"/((name: string) => Table<any>) | undefined","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"getKnex","returnType":{"packageName":"","name":"knex","filePath":null,"qualifiedName":"/knex","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"getDbName","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"createDbIfNotExists","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"dbExists","returnType":{"packageName":"","name":"Promise<boolean>","filePath":null,"qualifiedName":"/Promise<boolean>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"databaseName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"start","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"stop","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"setMaxAllowedPacketSize","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]},{"name":"getTableManager","returnType":{"packageName":"@proteinjs/db","name":"TableManager","filePath":null,"qualifiedName":"@proteinjs/db/TableManager","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"handleCaseSensitivity","returnType":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"tableName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"columnName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"caseSensitive","type":{"packageName":"","name":"boolean","filePath":null,"qualifiedName":"/boolean","typeParameters":null,"directParents":null}}]},{"name":"runQuery","returnType":{"packageName":"","name":"Promise<SerializedRecord[]>","filePath":null,"qualifiedName":"/Promise<SerializedRecord[]>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"generateStatement","type":{"packageName":"","name":"(config: DbDriverQueryStatementConfig) => Statement","filePath":null,"qualifiedName":"/(config: DbDriverQueryStatementConfig) => Statement","typeParameters":null,"directParents":null}}]},{"name":"runDml","returnType":{"packageName":"","name":"Promise<number>","filePath":null,"qualifiedName":"/Promise<number>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"generateStatement","type":{"packageName":"","name":"(config: DbDriverDmlStatementConfig) => Statement","filePath":null,"qualifiedName":"/(config: DbDriverDmlStatementConfig) => Statement","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db","name":"DbDriver","filePath":null,"qualifiedName":"@proteinjs/db/DbDriver","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db/DbDriver"},{"v":"@proteinjs/db-driver-knex/KnexSchemaOperations","value":{"packageName":"@proteinjs/db-driver-knex","name":"KnexSchemaOperations","filePath":"/home/runner/work/db/db/packages/drivers/knex/src/KnexSchemaOperations.ts","qualifiedName":"@proteinjs/db-driver-knex/KnexSchemaOperations","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"knexDriver","type":{"packageName":"@proteinjs/db-driver-knex","name":"KnexDriver","filePath":null,"qualifiedName":"@proteinjs/db-driver-knex/KnexDriver","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"createTable","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}}]},{"name":"alterTable","returnType":null,"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}},{"name":"tableChanges","type":{"packageName":"@proteinjs/db","name":"TableChanges","filePath":null,"qualifiedName":"@proteinjs/db/TableChanges","typeParameters":null,"directParents":null}}]},{"name":"createColumn","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"column","type":{"packageName":"","name":"Column<any, any>","filePath":null,"qualifiedName":"/Column<any, any>","typeParameters":null,"directParents":null}},{"name":"table","type":{"packageName":"","name":"Table<any>","filePath":null,"qualifiedName":"/Table<any>","typeParameters":null,"directParents":null}},{"name":"tableBuilder","type":{"packageName":"","name":"knex.TableBuilder","filePath":null,"qualifiedName":"/knex.TableBuilder","typeParameters":null,"directParents":null}},{"name":"tableChanges","type":{"packageName":"@proteinjs/db","name":"TableChanges","filePath":null,"qualifiedName":"@proteinjs/db/TableChanges","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db","name":"SchemaOperations","filePath":null,"qualifiedName":"@proteinjs/db/SchemaOperations","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db/SchemaOperations"}],"edges":[{"v":"@proteinjs/db-driver-knex/KnexDriver","w":"@proteinjs/db/DbDriver","value":"implements interface"},{"v":"@proteinjs/db-driver-knex/KnexSchemaOperations","w":"@proteinjs/db/SchemaOperations","value":"implements interface"}]}';
16
16
 
17
17
  /** Generate Source Links */
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/db-driver-knex",
3
- "version": "1.0.28",
3
+ "version": "1.1.1",
4
4
  "description": "Db driver for Knex",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,12 +22,12 @@
22
22
  "test": "jest"
23
23
  },
24
24
  "dependencies": {
25
- "@proteinjs/db": "^1.0.29",
26
- "@proteinjs/db-query": "^1.0.15",
25
+ "@proteinjs/db": "^1.1.0",
26
+ "@proteinjs/db-query": "^1.1.0",
27
27
  "@proteinjs/reflection": "1.1.5",
28
28
  "@proteinjs/util": "1.1.2",
29
29
  "knex": "0.21.5",
30
- "moment": "2.27.0",
30
+ "moment": "2.29.4",
31
31
  "mysql": "2.18.1",
32
32
  "uuid": "8.3.0"
33
33
  },
@@ -48,5 +48,5 @@
48
48
  },
49
49
  "main": "./dist/generated/index.js",
50
50
  "types": "./dist/generated/index.d.ts",
51
- "gitHead": "0e50559db01b7b9de2454c13199dafdadbc2f986"
51
+ "gitHead": "c73b31903893e892be2c2aabf8f15a494c184365"
52
52
  }
package/src/KnexDriver.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import knex from 'knex';
2
- import { DbDriver, DbDriverStatementConfig, SerializedRecord, TableManager } from '@proteinjs/db';
2
+ import {
3
+ DbDriver,
4
+ DbDriverQueryStatementConfig,
5
+ DbDriverDmlStatementConfig,
6
+ SerializedRecord,
7
+ Table,
8
+ TableManager,
9
+ tableByName,
10
+ } from '@proteinjs/db';
3
11
  import { KnexConfig } from './KnexConfig';
4
12
  import { Logger } from '@proteinjs/util';
5
13
  import { Statement } from '@proteinjs/db-query';
@@ -11,8 +19,9 @@ export class KnexDriver implements DbDriver {
11
19
  private logger = new Logger(this.constructor.name);
12
20
  private config: KnexConfig;
13
21
  private knexConfig: any;
22
+ public getTable: ((name: string) => Table<any>) | undefined;
14
23
 
15
- constructor(config: KnexConfig) {
24
+ constructor(config: KnexConfig, getTable?: (name: string) => Table<any>) {
16
25
  this.config = config;
17
26
  this.knexConfig = {
18
27
  client: 'mysql',
@@ -22,6 +31,7 @@ export class KnexDriver implements DbDriver {
22
31
  password: this.config.password,
23
32
  },
24
33
  };
34
+ this.getTable = getTable;
25
35
  }
26
36
 
27
37
  getKnex(): knex {
@@ -76,8 +86,39 @@ export class KnexDriver implements DbDriver {
76
86
  return new TableManager(this, columnTypeFactory, schemaOperations);
77
87
  }
78
88
 
79
- async runQuery(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<SerializedRecord[]> {
80
- const { sql, params } = generateStatement({ useParams: true, prefixTablesWithDb: true });
89
+ /**
90
+ * MariaDB is case insensitive by default.
91
+ * If we want to query with case sensitivity, prepend the column name with the `BINARY` keyword.
92
+ * @returns identifier to be used in SQL statement, may contain modifier if using case sensitivity
93
+ */
94
+ handleCaseSensitivity(tableName: string, columnName: string, caseSensitive: boolean): string {
95
+ if (!caseSensitive) {
96
+ return columnName;
97
+ }
98
+
99
+ const table = this.getTable ? this.getTable(tableName) : tableByName(tableName);
100
+ const column = Object.values(table.columns).find((col) => col.name === columnName);
101
+
102
+ if (!column) {
103
+ throw new Error(`Column ${columnName} does not exist in table ${table.name}`);
104
+ }
105
+
106
+ const stringColTypes = ['char', 'varchar', 'longtext'];
107
+ const isStringColType = stringColTypes.includes(new KnexColumnTypeFactory().getType(column));
108
+
109
+ if (isStringColType) {
110
+ return `BINARY ${columnName}`;
111
+ }
112
+
113
+ return columnName;
114
+ }
115
+
116
+ async runQuery(generateStatement: (config: DbDriverQueryStatementConfig) => Statement): Promise<SerializedRecord[]> {
117
+ const { sql, params } = generateStatement({
118
+ useParams: true,
119
+ prefixTablesWithDb: true,
120
+ handleCaseSensitivity: this.handleCaseSensitivity.bind(this),
121
+ });
81
122
  try {
82
123
  return (await this.getKnex().raw(sql, params as any))[0]; // returns 2 arrays, first is records, second is metadata per record
83
124
  } catch (error: any) {
@@ -86,7 +127,7 @@ export class KnexDriver implements DbDriver {
86
127
  }
87
128
  }
88
129
 
89
- async runDml(generateStatement: (config: DbDriverStatementConfig) => Statement): Promise<number> {
130
+ async runDml(generateStatement: (config: DbDriverDmlStatementConfig) => Statement): Promise<number> {
90
131
  const { affectedRows } = (await this.runQuery(generateStatement)) as any;
91
132
  return affectedRows;
92
133
  }
package/test/Crud.test.ts CHANGED
@@ -1,19 +1,38 @@
1
- import { Table, columnTypeTests, crudTests } from '@proteinjs/db';
1
+ import { Table, columnTypeTests, crudTests, getColTypeTestTable, getCrudTestTable } from '@proteinjs/db';
2
2
  import { KnexDriver } from '../src/KnexDriver';
3
3
 
4
- const dropTable = async (table: Table<any>) => {
4
+ const dropTable = async (knexDriver: KnexDriver, table: Table<any>) => {
5
5
  if (await knexDriver.getKnex().schema.withSchema(knexDriver.getDbName()).hasTable(table.name)) {
6
6
  await knexDriver.getKnex().schema.withSchema(knexDriver.getDbName()).dropTable(table.name);
7
7
  }
8
8
  };
9
9
 
10
- const knexDriver = new KnexDriver({
11
- host: 'localhost',
12
- user: 'root',
13
- password: '',
14
- dbName: 'test',
15
- });
10
+ const knexDriverColumnTypesTests = new KnexDriver(
11
+ {
12
+ host: 'localhost',
13
+ user: 'root',
14
+ password: '',
15
+ dbName: 'test',
16
+ },
17
+ getColTypeTestTable
18
+ );
16
19
 
17
- describe('Column Type Tests', columnTypeTests(knexDriver, dropTable));
20
+ describe(
21
+ 'Column Type Tests',
22
+ columnTypeTests(knexDriverColumnTypesTests, (table) => dropTable(knexDriverColumnTypesTests, table))
23
+ );
18
24
 
19
- describe('CRUD Tests', crudTests(knexDriver, dropTable));
25
+ const knexDriverCrudTests = new KnexDriver(
26
+ {
27
+ host: 'localhost',
28
+ user: 'root',
29
+ password: '',
30
+ dbName: 'test',
31
+ },
32
+ getCrudTestTable
33
+ );
34
+
35
+ describe(
36
+ 'CRUD Tests',
37
+ crudTests(knexDriverCrudTests, (table) => dropTable(knexDriverCrudTests, table))
38
+ );