mirror of
https://github.com/MrUnknownDE/bierkasten-casino.git
synced 2026-04-19 06:43:46 +02:00
feat: Füge Typparser für PostgreSQL hinzu, um Dezimal- und Ganzzahlen korrekt zu verarbeiten
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { Pool } from "pg";
|
||||
import { Pool, types } from "pg"; // "types" importieren
|
||||
import { config } from "./config";
|
||||
|
||||
types.setTypeParser(1700, (val) => parseFloat(val));
|
||||
types.setTypeParser(20, (val) => parseInt(val, 10));
|
||||
|
||||
|
||||
export const pool = new Pool({
|
||||
connectionString: config.databaseUrl
|
||||
});
|
||||
@@ -9,4 +13,4 @@ export const pool = new Pool({
|
||||
export async function query<T = any>(text: string, params?: any[]): Promise<T[]> {
|
||||
const res = await pool.query(text, params);
|
||||
return res.rows as T[];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user