UNPKG

@mikro-orm/core

Version:

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.

19 lines (18 loc) 605 B
import { Utils } from '../utils/Utils.js'; /** * Wrapper class for polymorphic relation reference data. * Holds the discriminator value (type identifier) and the primary key value(s). * Used internally to track polymorphic FK values before hydration. */ export class PolymorphicRef { discriminator; id; constructor(discriminator, id) { this.discriminator = discriminator; this.id = id; } /** Returns `[discriminator, ...idValues]` tuple suitable for column-level expansion. */ toTuple() { return [this.discriminator, ...Utils.asArray(this.id)]; } }