Skip to content

Commit d33d664

Browse files
committed
feat: add key-value store service with CRUD operations
- Implemented set, get, del, exists, and keys functions for managing key-value pairs in the KV store. - Added error handling for each function to ensure robustness. - Utilized jsonb for value storage, allowing for flexible data types. - Created a new migration snapshot for the database schema including the kv table.
1 parent 4554a8c commit d33d664

14 files changed

Lines changed: 3157 additions & 11 deletions

migrations/0001_equal_mandroid.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE "kv" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"key" uuid,
4+
"value" json
5+
);

migrations/0002_high_rage.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE "kv" ALTER COLUMN "key" SET DATA TYPE text;--> statement-breakpoint
2+
ALTER TABLE "kv" ALTER COLUMN "key" SET NOT NULL;--> statement-breakpoint
3+
ALTER TABLE "kv" ADD CONSTRAINT "kv_key_unique" UNIQUE("key");

migrations/0003_flimsy_ezekiel.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "kv" ALTER COLUMN "value" SET DATA TYPE jsonb;

0 commit comments

Comments
 (0)