UNPKG

@sqb/connect

Version:

Multi-dialect database connection framework written with TypeScript

10 lines (9 loc) 415 B
import { EntityMetadata } from '../model/entity-metadata.js'; export function ForeignKey(type, targetKey) { return function (target, propertyKey) { if (typeof propertyKey !== 'string') throw new Error('Symbol properties are not accepted'); const entity = EntityMetadata.define(target.constructor); EntityMetadata.addForeignKey(entity, propertyKey, type, targetKey); }; }