Skip to content

Commit

Permalink
Use explicit-typed binding
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Nov 18, 2024
1 parent 6f9624d commit 5a62145
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Changelog

To be released.

- Use the explicitly typed binding instead of an implicit one to work
around the stringification issue.

### Version 0.2.1

Released on November 3, 2024.
Expand Down
2 changes: 1 addition & 1 deletion src/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class PostgresKvStore implements KvStore {
INSERT INTO ${this.#sql(this.#tableName)} (key, value, ttl)
VALUES (
${key},
(${{ value } as unknown as string}::jsonb) -> 'value',
${this.#sql.typed(value, 3802)},
${ttl}
)
ON CONFLICT (key)
Expand Down
2 changes: 1 addition & 1 deletion src/mq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class PostgresMessageQueue implements MessageQueue {
await this.#sql`
INSERT INTO ${this.#sql(this.#tableName)} (message, delay)
VALUES (
(${{ message } as unknown as string}::jsonb) -> 'message',
${this.#sql.typed(message, 3802)},
${delay.toString()}
);
`;
Expand Down

0 comments on commit 5a62145

Please sign in to comment.