mikro-orm/mikro-orm

View on GitHub
packages/core/src/entity/EntityIdentifier.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import type { IPrimaryKey } from '../typings';

/**
 * @internal
 */
export class EntityIdentifier {

  constructor(private value?: IPrimaryKey) { }

  setValue(value: IPrimaryKey): void {
    this.value = value;
  }

  getValue<T extends IPrimaryKey = IPrimaryKey>(): T {
    return this.value as T;
  }

}