How to use the createConnection function from typeorm
Find comprehensive JavaScript typeorm.createConnection code examples handpicked from public code repositorys.
GitHub: lane711/sonicjs
376 377 378 379 380 381 382 383 384 385 386
connectionSettings.username = process.env.TYPEORM_USERNAME; connectionSettings.password = process.env.TYPEORM_PASSWORD; connectionSettings.database = process.env.TYPEORM_DATABASE; } typeorm.createConnection(connectionSettings).then((connection) => { console.log(logSymbols.success, "Successfully connected to Database!"); start(); }); }
76
377
0
14 15 16 17 18 19 20 21 22 23
synchronize: false, migrationsRun: false, dropSchema: false, logging: false, } const rootConnection = await createConnection({ ...config }) const rootQueryRunner = rootConnection.createQueryRunner() const database = 'graphql_typeorm_schema' try { // TypeORM doesn't currently have a way to dump an SQL schema without any database interaction[1],
7
38
9
+ 3 other calls in file
63 64 65 66 67 68 69 70 71 72
t.strictEqual(fastify.orm.con1.name, 'default') await fastify.close() }) test('custom client', async t => { const connection = await createConnection({ host: 'localhost', type: 'postgres', port: '5432', password: '',
6
23
6
+ 31 other calls in file
8 9 10 11 12 13 14 15 16
let connection if (options.connection) { connection = options.connection } else if (Object.keys(options).length) { connection = await createConnection(options) } else { connection = await createConnection() }
6
23
0
+ 27 other calls in file
2 3 4 5 6 7 8 9 10 11
const ormconfig = require('../../ormconfig'); const { createConnection } = require('typeorm'); describe('Auth 테스트', () => { beforeAll(async () => { await createConnection(ormconfig); await request(app).post('/api/auth/signup').send({ userName: 'auth-test', userEmail: 'test@naver.com', userPassword: 'test123test123'
4
16
3
+ 15 other calls in file
GitHub: os-js/osjs-database-auth
100 101 102 103 104 105 106 107 108 109
database: 'osjsv3', synchronize: true, entities: [UserSchema] }, options); return createConnection(settings); }; module.exports = { User,
4
3
3
+ 9 other calls in file
73 74 75 76 77 78 79 80 81 82
if (!initialJWT) { console.error(`Usage ${process.argv0} {JWT}`) process.exit(1) } const typeormConnection = await typeorm.createConnection(typeormConfig) const storage = new JolocomTypeormStorage(typeormConnection) const passwordStore = new FilePasswordStore(__dirname+'/password.txt') console.log('About to create JolocomSDK instance')
4
3
17
+ 13 other calls in file
60 61 62 63 64 65 66 67 68 69
const type = process.env.TO.includes("://") ? process.env.TO.split(":")[0]?.replace("+srv", "") : "sqlite"; const isSqlite = type.includes("sqlite"); // @ts-ignore const newDB = await createConnection({ type, url: isSqlite ? undefined : process.env.TO, database: isSqlite ? process.env.TO : undefined, entities,
0
1
1
87 88 89 90 91 92 93 94 95 96
// } // }); // // const upload = multer({ storage: storage }); // // const connection = createConnection({ // type: 'mysql', // host: 'localhost', // port: 3306, // username: 'root',
0
1
0
GitHub: VenusPR/Shopify_Richard
90 91 92 93 94 95 96 97 98 99
const entities = modelsLoader({}, { register: false }) if (projectConfig.database_type === "sqlite") { connectionType = "sqlite" const dbConnection = await createConnection({ type: "sqlite", database: projectConfig.database_database, synchronize: true, entities,
0
0
1
+ 135 other calls in file
18 19 20 21 22 23 24 25 26 27
...{ entities : [ require('./entity/UserEntity') ]} }; this.intitalazed = new Promise((resolve, reject) => { typeorm.createConnection(c).then((connection) => { this.connection = connection; resolve(); }) .catch(function(error) {
0
0
1
131 132 133 134 135 136 137 138 139 140
*/ async function generateBizplce() { // 1. Create DB connection const opts = parseOptions() const ormconfig = await getOrmConfig(opts.mode) createConnection({ ...ormconfig, logging: true }).then(async connection => { console.log(chalk.cyanBright.bold('Database connection established'))
0
0
8
+ 15 other calls in file
63 64 65 66 67 68 69 70 71 72
TestService.prototype.getSeats = function () { return __awaiter(this, void 0, void 0, function () { var connection, test; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, typeorm_1.createConnection(__assign(__assign({}, connectionOptions_1.connectionOptions), { name: 'test' + Date.now() }))]; case 1: connection = _a.sent(); return [4 /*yield*/, connection.getRepository(seat_entity_1.SeatEntity).find()]; case 2:
0
0
0
127 128 129 130 131 132 133 134 135 136
return __generator(this, function (_a) { switch (_a.label) { case 0: looger = new common_1.Logger('Manufacturer'); looger.debug('start'); return [4 /*yield*/, typeorm_1.createConnection(__assign(__assign({}, connectionOptions_1.connectionOptions), { name: 'test5' + Date.now() }))]; case 1: connection = _a.sent(); return [4 /*yield*/, connection.getRepository(manufacturer_entity_1.ManufacturerEntity).find({ transaction: false })]; case 2:
0
0
0
+ 3 other calls in file
typeorm.getCustomRepository is the most popular function in typeorm (5799 examples)