Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Jun 24, 2024
2 parents 2f32a12 + 81a1ab1 commit 1e0d489
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
packages/injector/ \
packages/logger/ \
packages/template/ \
packages/sql/ \
packages/stopwatch/ \
packages/workflow/ \
packages/type/
Expand Down
17 changes: 8 additions & 9 deletions packages/sql/tests/sql-query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,21 @@ test('skip property', () => {

test('QueryToSql', () => {
class User {
id!: number;
id!: number & PrimaryKey;
username!: string;
password!: string;
disabled!: boolean;
created!: Date;
}

const queryToSql = new SQLFilterBuilder(ReflectionClass.from(User), quoteId('user'), serializer, new SqlPlaceholderStrategy(), new class extends DefaultPlatform {
schemaParserType = MySchemaParser;
quoteIdentifier(id: string): string {
return quoteId(id);
const localAdapter: PreparedAdapter = {
...adapter,
platform: new class extends MyPlatform {
quoteIdentifier = quoteId;
}
quoteValue(value: any): string {
return escape(value);
}
});
};

const queryToSql = new SQLFilterBuilder(localAdapter, ReflectionClass.from(User), quoteId('user'), serializer, new SqlPlaceholderStrategy());

expect(queryToSql.convert({ id: 123 })).toBe(`user.id = ?`);
expect(queryToSql.convert({ id: '$id' })).toBe(`user.id = user.id`);
Expand Down

0 comments on commit 1e0d489

Please sign in to comment.