Unverified Commit 9b20ddcb authored by Hong Minhee's avatar Hong Minhee
Browse files

Use explicit-typed binding

parent 6f9624d6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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.
+2 −2
Original line number Diff line number Diff line
import type { KvKey, KvStore, KvStoreSetOptions } from "@fedify/fedify";
import type { Sql } from "postgres";
import type { JSONValue, Sql } from "postgres";

/**
 * Options for the PostgreSQL key-value store.
@@ -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.json(value as JSONValue)},
        ${ttl}
      )
      ON CONFLICT (key)
+1 −1
Original line number Diff line number Diff line
@@ -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.json(message)},
        ${delay.toString()}
      );
    `;