You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
735 B
25 lines
735 B
import { DbQueryWrapper, dbCollection } from './basedb'; |
|
import { NeDbQueryWrapper } from './nedb'; |
|
import { MongoDbQueryWrapper } from './mongodb'; |
|
|
|
import { HASTIC_DB_CONNECTION_TYPE } from '../../config'; |
|
|
|
export enum DBType { |
|
nedb = 'nedb', |
|
mongodb = 'mongodb' |
|
}; |
|
|
|
export { NeDbQueryWrapper, MongoDbQueryWrapper, DbQueryWrapper, dbCollection }; |
|
|
|
export function getDbQueryWrapper(): DbQueryWrapper { |
|
if(HASTIC_DB_CONNECTION_TYPE === DBType.nedb) { |
|
return new NeDbQueryWrapper(); |
|
} |
|
if(HASTIC_DB_CONNECTION_TYPE === DBType.mongodb) { |
|
return new MongoDbQueryWrapper(); |
|
} |
|
|
|
throw new Error( |
|
`"${HASTIC_DB_CONNECTION_TYPE}" HASTIC_DB_CONNECTION_TYPE is not supported. Possible values: "nedb", "mongodb"` |
|
); |
|
}
|
|
|