deno.land / x / denodb@v1.4.0 / tests / connection.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { config } from "https://deno.land/x/dotenv/mod.ts";import { Database } from "../mod.ts";
const env = config();
const defaultMySQLOptions = { database: "test", host: "127.0.0.1", username: env.DB_USER, password: env.DB_PASS, port: Number(env.DB_PORT),};
const defaultSQLiteOptions = { filepath: "test.sqlite",};
const getMySQLConnection = (options = {}, debug = true): Database => { const connection: Database = new Database( { dialect: "mysql", debug }, { ...defaultMySQLOptions, ...options, }, );
return connection;};
const getSQLiteConnection = (options = {}, debug = true): Database => { const connection: Database = new Database( { dialect: "sqlite3", debug }, { ...defaultSQLiteOptions, ...options, }, );
return connection;};
export { getMySQLConnection, getSQLiteConnection };
denodb

Version Info

Tagged at
a year ago