MikroOrmDialect
Defined in: packages/ddd-mikro-orm/src/errors/mikro-orm.dialect.ts:107
The MikroORM persistence dialect: it reads the violated unique constraint of a
UniqueConstraintViolationException through the ORM’s entity metadata, so a
repository maps it by entity property and never names a constraint or column.
- PostgreSQL reports the constraint name; it is matched against the names in
the mapping (
unique: 'name'on a property,uniques[].name) or, when none is declared, the naming strategy’sindexName. - SQLite and libSQL report the
table.columnlist; it is matched against the columns of each constraint.
Any other error, an entity without metadata, or an unknown constraint yields
undefined, so the decorator rethrows the original error.
Throws
Section titled “Throws”On construction, when a multi-property unique constraint has no name, or two constraints of one entity cover the same columns.
Example
Section titled “Example”const orm = await MikroORM.init(options);setPersistenceDialect(new MikroOrmDialect(orm));Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MikroOrmDialect(
orm):MikroOrmDialect
Defined in: packages/ddd-mikro-orm/src/errors/mikro-orm.dialect.ts:114
Parameters
Section titled “Parameters”Pick<MikroORM, "getMetadata" | "config">
Returns
Section titled “Returns”MikroOrmDialect
Methods
Section titled “Methods”uniqueViolation()
Section titled “uniqueViolation()”uniqueViolation(
error,entity):string|undefined
Defined in: packages/ddd-mikro-orm/src/errors/mikro-orm.dialect.ts:125
The key of the unique constraint error violated while writing entity:
the entity property it covers, or the declared name of a multi-column
constraint. undefined when error is not a unique violation, or names a
constraint the dialect does not know.
Parameters
Section titled “Parameters”unknown
entity
Section titled “entity”object
Returns
Section titled “Returns”string | undefined