The list of known connections to registers.
The new function.
import { createWithMSSQL } from "@egomobile/orm-mssql"
// `EntityConfigurations` objects, returned by functions
// exported as `default`s
import getDefaultEntityConfiguration from './entities/default'
import getTestEntityConfiguration from './entities/test'
const withMSSQL = createWithMSSQL({
"default": {
"client": null, // read `mssql` config from environment variables
"entities": getDefaultEntityConfiguration()
},
"test1": {
"client": 'Server=127.0.0.1;TrustServerCertificate=True;User Id=sa;Password=Abcd1234!#',
"entities": getTestEntityConfiguration()
}
})
// `defaultResult` === "FOO"
const defaultResult = await withMSSQL('default', async (defaultContext) => {
// do something with `default` connection in `defaultContext`
return "FOO"
})
// `test1Result` === "bar"
const test1Result = await withMSSQL('test1', async (test1Context) => {
// do something with `test1` connection in `test1Context`
return "bar"
})
Generated using TypeDoc
Creates a function, which runs itself an action inside an open MSSQL connection.