How to use the getConnection function from typeorm

Find comprehensive JavaScript typeorm.getConnection code examples handpicked from public code repositorys.

18
19
20
21
22
23
24
25
26
  await (new UserSeed().run())
  await (new CredentialSeed().run())

}).then(async () => {

  await getConnection().close()
  console.log('done')

}).catch(async reason => {
fork icon3
star icon9
watch icon4

+ 31 other calls in file

34
35
36
37
38
39
40
41
42

  await new CredentialFactory().create({ user })

}).then(() => {

  getConnection().close()
  console.log('done')

}).catch(reason => {
fork icon3
star icon9
watch icon4

+ 31 other calls in file

112
113
114
115
116
117
118
119
120
121
if (config.get('DEPLOY_CONTRACTS')) {
    logger.info(`Deploying local contracts`);

    const deployedContracts = await test_net_utils.setupLocalTestNetContracts(
        { LOAD: LATEST_LOAD, ShipToken: LATEST_SHIPTOKEN, NOTARY: LATEST_NOTARY },
        await typeorm.getConnection().getRepository(Wallet).find(),
        contractMetaData,
    );

    network = deployedContracts.LOAD.network.title;
fork icon1
star icon14
watch icon9

+ 9 other calls in file

12
13
14
15
16
17
18
19
20
21
const xf_user_upgrade_active = require("./../models/xf_upgrade").xf_user_upgrade_active;
const xf_user_group = require("./../models/xf_group").xf_user_group;
const xf_user_upgrade = require("./../models/xf_user_upgrade").xf_user_upgrade;
const {converttotimestamp,addtotimestampdays,convertfromtimestamp} = require("./../dates/date");
async function getusergroups(username)  {
    const connection = typeorm.getConnection();
    const userRepository = connection.getRepository(backend);
    const user = await userRepository.findOne({
      where: {
          username: username,
fork icon1
star icon4
watch icon1

+ 5 other calls in file

15
16
17
18
19
20
21
22
23
24
25
26
  entities: [
    new EntitySchema(Users)
  ]
}).then(() => {


  const dbConnection = typeorm.getConnection('mysql')


  const repo = dbConnection.getRepository("Users")
  return repo
}).then((repo) => {
fork icon0
star icon0
watch icon0

22
23
24
25
26
27
28
29
30
31
32
33
34


})


router.post('/', async (req, res, next) => {
  try {
    const mongoConnection = typeorm.getConnection('mysql')
    const repo = mongoConnection.getRepository("Users")


    const user = {}
    user.name = req.body.name
fork icon0
star icon0
watch icon0