This repository was archived by the owner on Jul 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,13 @@ Changelog
6868
6969To be released.
7070
71+ ### Version 0.2.1
72+
73+ Released on November 3, 2024.
74+
75+ - Fixed a bug where some scalar values have failed to be stored in the
76+ database.
77+
7178### Version 0.2.0
7279
7380Released on November 3, 2024.
Original file line number Diff line number Diff line change @@ -56,6 +56,16 @@ Deno.test("PostgresKvStore", async (t) => {
5656 assertEquals ( result2 [ 0 ] . key , [ "foo" , "qux" ] ) ;
5757 assertEquals ( result2 [ 0 ] . value , "qux" ) ;
5858 assertEquals ( result2 [ 0 ] . ttl , "1 day" ) ;
59+
60+ await store . set ( [ "foo" , "quux" ] , true ) ;
61+ const result3 = await sql `
62+ SELECT * FROM ${ sql ( tableName ) }
63+ WHERE key = ${ [ "foo" , "quux" ] }
64+ ` ;
65+ assertEquals ( result3 . length , 1 ) ;
66+ assertEquals ( result3 [ 0 ] . key , [ "foo" , "quux" ] ) ;
67+ assertEquals ( result3 [ 0 ] . value , true ) ;
68+ assertEquals ( result3 [ 0 ] . ttl , null ) ;
5969 } ) ;
6070
6171 await t . step ( "delete()" , async ( ) => {
Original file line number Diff line number Diff line change @@ -82,7 +82,11 @@ export class PostgresKvStore implements KvStore {
8282 const ttl = options ?. ttl == null ? null : options . ttl . toString ( ) ;
8383 await this . #sql`
8484 INSERT INTO ${ this . #sql( this . #tableName) } (key, value, ttl)
85- VALUES (${ key } , ${ value as string } , ${ ttl } )
85+ VALUES (
86+ ${ key } ,
87+ (${ { value } as unknown as string } ::jsonb) -> 'value',
88+ ${ ttl }
89+ )
8690 ON CONFLICT (key)
8791 DO UPDATE SET value = EXCLUDED.value, ttl = EXCLUDED.ttl;
8892 ` ;
Original file line number Diff line number Diff line change @@ -85,7 +85,10 @@ export class PostgresMessageQueue implements MessageQueue {
8585 const delay = options ?. delay ?? Temporal . Duration . from ( { seconds : 0 } ) ;
8686 await this . #sql`
8787 INSERT INTO ${ this . #sql( this . #tableName) } (message, delay)
88- VALUES (${ message } , ${ delay . toString ( ) } );
88+ VALUES (
89+ (${ { message } as unknown as string } ::jsonb) -> 'message',
90+ ${ delay . toString ( ) }
91+ );
8992 ` ;
9093 await this . #sql. notify ( this . #channelName, delay . toString ( ) ) ;
9194 }
You can’t perform that action at this time.
0 commit comments