Skip to content

Instantly share code, notes, and snippets.

@mattbajorek
Last active September 5, 2021 00:01
Show Gist options
  • Save mattbajorek/013df1ff6cb496942ddd8af77c926fef to your computer and use it in GitHub Desktop.
Save mattbajorek/013df1ff6cb496942ddd8af77c926fef to your computer and use it in GitHub Desktop.
Account balance with decimal transformer
import { Column, Entity } from 'typeorm';
import { DecimalTransformer } from './decimal.transformer';
@Entity('account')
export class AccountEntity {
@Column({ name: 'balance', type: 'decimal', precision: 10, scale: 2, default: 0.0, transformer: new DecimalTransformer() })
public balance: Decimal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment