1.7.0 • Published 12 months ago

@galenjs/typeorm-models v1.7.0

Weekly downloads
66
License
ISC
Repository
github
Last release
12 months ago

typeorm-models

galenjs typeorm entity schema

Usage

const createTypeOrmModels = require('@galenjs/typeorm-models')

const bootstrap = async () => {
  const {
    models, connections
  } = await createTypeOrmModels(schemas, {
    default: {
      host: '127.0.0.1',
      username: 'root',
      password: 'alfieri',
      database: 'test'
    },
    clients: {
      main: {}
    }
  })

  // TODO: find camelCase
  const data = await connections.get('main').getRepository(models.User).find({
    nick_name: 'test'
  })
  console.log(JSON.stringify(data, null, 2))
}

bootstrap()

支持配置多实例

{
  default: {
    host: '127.0.0.1',
    user: 'root',
    password: 'alfieri',
    database: 'test'
  },
  clients: {
    main: {},
    test: {
      database: 'test1'
    }
  }
}
  • default为默认配置可以为空对象
  • clients则是需要配置的配置实例的信息

separating-entity-definition example

1.7.0

12 months ago

1.4.0

3 years ago

1.0.17

3 years ago

1.0.0

4 years ago

0.7.27

4 years ago

0.7.14

4 years ago

0.7.8

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.14

4 years ago

0.5.16

4 years ago

0.6.0

4 years ago

0.5.11

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago