0.0.6 • Published 3 years ago

@iot9x.com/nestjs-tdengine-restful v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

NestJS TDengine 驱动插件

注意:仍在开发中,目前仅在内部使用

使用说明

外部人员仅供参考,请不要用于生产环境,因此导致的事故后果请自行承担。

支持环境

  • node >=14.x
  • NestJS === 8.x

安装

$ npm i @iot9x.com/nestjs-tdengine-restful

or
$ yarn add @iot9x.com/nestjs-tdengine-restful  # 推荐使用yarn

配置

同步方式

import { Module } from '@nestjs/common';
import { TDengineModule } from '@iot9x.com/nestjs-tdengine-restful'

@Module({
  imports: [
    TDengineModule.forRoot({
      url: 'http://127.0.0.1:6041',
      username: 'root',
      password: 'taosdata',
      logging: false
    }),
  ]
})
export class AppModule { }

异步方式

import { Module } from '@nestjs/common';
import { ConfigModule, ConfigType } from '@nestjs/config';
import { TDengineModule } from '@iot9x.com/nestjs-tdengine-restful'
import { TDengineConfigRegister } from './modules/config/registers/tdengine.register';
import { ConfigValidation } from './modules/config/validations/config.validation';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      validationSchema: ConfigValidation,
      validationOptions: {
        allowUnknown: true,
        abortEarly: true
      },
      load: [TDengineConfigRegister]
    }),
    TDengineModule.forRootAsync({
      useFactory: (tdengineConfig: ConfigType<typeof TDengineConfigRegister>) => tdengineConfig,
      inject: [TDengineConfigRegister.KEY]
    })
  ]
})
export class AppModule {}

文档地址

0.0.5

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago