ffxiv-entity
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

ffxiv-entity

LICENSE NPM version

开箱即用的Typeorm实体类,与ffxiv-db-sync搭配使用,帮助你更方便的构建ffxiv相关的web应用

数据结构参考自ffxiv-datamining-cn

使用

安装

pnpm add ffxiv-entity

配置

import { DataSource } from 'typeorm'
import entities from 'ffxiv-entity'

const AppDataSource = new DataSource({
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: '',
  password: '',
  database: 'ffxiv',
  synchronize: true,
  logging: false,
  entities,
})

在你的应用中使用实体类

import { Injectable } from '@nestjs/common'
import { ClassJobCategoryEntity } from 'ffxiv-entity'
import { InjectRepository } from '@nestjs/typeorm'
import type { Repository } from 'typeorm'

@Injectable()
export class ClassJobCategoryService {
  constructor(
    @InjectRepository(ClassJobCategoryEntity)
    private classJobCategoryRepository: Repository<ClassJobCategoryEntity>,
  )

  async findAll(): Promise<ClassJobCategoryEntity[]> {
    return await this.classJobCategoryRepository.find()
  }
}

License

MIT License © 2022 Karasu Shin

Readme

Keywords

none

Package Sidebar

Install

npm i ffxiv-entity

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

39.4 kB

Total Files

6

Last publish

Collaborators

  • karasu.shin