Skip to content

Commit 5a62145

Browse files
committed
Use explicit-typed binding
1 parent 6f9624d commit 5a62145

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Changelog
6868

6969
To be released.
7070

71+
- Use the explicitly typed binding instead of an implicit one to work
72+
around the stringification issue.
73+
7174
### Version 0.2.1
7275

7376
Released on November 3, 2024.

src/kv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class PostgresKvStore implements KvStore {
8484
INSERT INTO ${this.#sql(this.#tableName)} (key, value, ttl)
8585
VALUES (
8686
${key},
87-
(${{ value } as unknown as string}::jsonb) -> 'value',
87+
${this.#sql.typed(value, 3802)},
8888
${ttl}
8989
)
9090
ON CONFLICT (key)

src/mq.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class PostgresMessageQueue implements MessageQueue {
8686
await this.#sql`
8787
INSERT INTO ${this.#sql(this.#tableName)} (message, delay)
8888
VALUES (
89-
(${{ message } as unknown as string}::jsonb) -> 'message',
89+
${this.#sql.typed(message, 3802)},
9090
${delay.toString()}
9191
);
9292
`;

0 commit comments

Comments
 (0)