forked from metarhia/Example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use external database from metasql module
Refs: metarhia/impress#1282 PR-URL: metarhia#54
- Loading branch information
1 parent
612687d
commit 23fbb3e
Showing
4 changed files
with
5 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
async ({ countryId }) => { | ||
const fields = ['Id', 'Name']; | ||
const where = { countryId }; | ||
const data = await domain.database.example.select('City', fields, where); | ||
const data = await domain.db.select('City', fields, where); | ||
return { result: 'success', data }; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
async () => { | ||
const fields = ['Id', 'Name']; | ||
const data = await domain.database.example.select('Country', fields); | ||
const data = await domain.db.select('Country', fields); | ||
return { result: 'success', data }; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(async () => { | ||
console.debug('Connect to pg'); | ||
domain.database.example = new lib.pg.Database(config.database); | ||
const options = { ...config.database, logger: console }; | ||
domain.db = new npm.metasql.Database(options); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
}, | ||
"dependencies": { | ||
"impress": "^2.0.0-alpha.33", | ||
"metasql": "^0.3.0-alpha.0", | ||
"pg": "^8.4.2" | ||
} | ||
} |