0.1.2 • Published 6 years ago

typeorm-transformers v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

@anchan828/typeorm-transformers

npm NPM Maintainability Test Coverage

Description

Transformer collection for TypeORM

Installation

$ npm i --save @anchan828/typeorm-transformers

Quick Start

@Entity()
class BooleanTransformerTest extends BaseEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @Column({
    type: 'tinyint',
    width: 1,
    nullable: true,
    transformer: new BooleanTransformer(),
  })
  public bool!: boolean;
}
class TestJson {
  name!: string;
}
@Entity()
class JsonTransformerTest extends BaseEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @Column({
    type: 'varchar',
    width: 255,
    nullable: true,
    transformer: new JsonTransformer<TestJson>({ name: 'test' }),
  })
  public data!: TestJson;
}

License

MIT.