Browse Source

[Elysia] Use Bun's SQL API (#9572)

* Use Bun's SQL API for Elysia

* Upgrade bun to 1.2
Nick Winans 5 months ago
parent
commit
6a4f7034e9

+ 1 - 1
frameworks/TypeScript/elysia/elysia-compiled.dockerfile

@@ -1,4 +1,4 @@
-FROM oven/bun:1.1
+FROM oven/bun:1.2
 
 EXPOSE 8080
 

+ 1 - 1
frameworks/TypeScript/elysia/elysia-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM oven/bun:1.1
+FROM oven/bun:1.2
 
 EXPOSE 8080
 

+ 1 - 1
frameworks/TypeScript/elysia/elysia-smol-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM oven/bun:1.1
+FROM oven/bun:1.2
 
 EXPOSE 8080
 

+ 1 - 1
frameworks/TypeScript/elysia/elysia.dockerfile

@@ -1,4 +1,4 @@
-FROM oven/bun:1.1
+FROM oven/bun:1.2
 
 EXPOSE 8080
 

+ 3 - 6
frameworks/TypeScript/elysia/src/postgres.ts

@@ -1,12 +1,9 @@
-import postgres from "postgres";
+import { SQL } from "bun";
 import { rand } from "./db-handlers";
 import type { Fortune, World } from "./types";
 
-const sql = postgres({
-	host: "tfb-database",
-	user: "benchmarkdbuser",
-	password: "benchmarkdbpass",
-	database: "hello_world",
+const sql = new SQL({
+	url: "postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world",
 	max: 1,
 });