-
-
Save uno-de-piera/d4bb3715419d7582546c4d9975b30427 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Client} from "https://deno.land/x/mysql/mod.ts"; | |
import "https://deno.land/x/dotenv/load.ts"; | |
export class Database { | |
client: Client; | |
constructor() { | |
this.client = new Client(); | |
this.client.connect({ | |
hostname: Deno.env.get('DATABASE_HOST'), | |
db: Deno.env.get('DATABASE_NAME'), | |
username: Deno.env.get('DATABASE_USER'), | |
password: Deno.env.get('DATABASE_PASSWORD'), | |
}); | |
} | |
async query(sql: string) { | |
return await this.client.query(sql); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment