mirror of https://github.com/sveltejs/svelte
parent
e8adc9c0ab
commit
d6f0b69b72
@ -0,0 +1,15 @@
|
||||
import { Pool } from 'pg';
|
||||
|
||||
const { DATABASE_URL } = process.env;
|
||||
|
||||
export const DB = new Pool({
|
||||
connectionString: process.env.DATABASE_URL
|
||||
});
|
||||
|
||||
export function query(text, values=[]) {
|
||||
return DB.query(text, values).then(r => r.rows);
|
||||
}
|
||||
|
||||
export function find(text, values=[]) {
|
||||
return query(text, values).then(arr => arr[0]);
|
||||
}
|
Loading…
Reference in new issue