@nestjsi/typeorm-pg
v0.2.3
Published
Additions for class validator
Downloads
318
Readme
typeorm-pg
TypeORM PostgreSQL declarations and utilities.
Examples
Safe naming strategy for TypeORM
import { SafeNamingStrategy } from '@nestjsi/typeorm-pg';
@Global()
@Module({
imports: [
TypeOrmModule.forRootAsync({
useFactory: async () =>
Object.assign(await getConnectionOptions(), {
namingStrategy: new SafeNamingStrategy(),
} as TypeOrmModuleAsyncOptions),
}),
],
})
export class AppModule {}
TypeORM column primary type
import { ColumnPrimaryType } from '@nestjsi/typeorm-pg';
enum ColumnPrimaryType {
BigInteger = "bigint",
Decimal = "decimal",
Integer = "integer",
SmallInteger = "smallint",
UUID = "uuid",
}
TypeORM column type
import { ColumnType } from '@nestjsi/typeorm-pg';
enum ColumnType {
BigInteger = "bigint",
Boolean = "boolean",
Decimal = "decimal",
DoublePrecision = "double precision",
Enum = "enum",
Float = "float",
Integer = "integer",
JSON = "json",
JSONB = "jsonb",
SmallInteger = "smallint",
Text = "text",
TimeStampWithTimeZone = "timestamp with time zone",
UUID = "uuid",
// and more…
}
Decorators
import {
Checks,
IndexColumns,
UniqueColumns,
} from '@nestjsi/typeorm-pg';
Useful constants
import {
EMAIL_LENGTH_MAX,
EMAIL_LENGTH_MIN,
// and more…
} from '@nestjsi/typeorm-pg';