UNPKG

@sqb/connect

Version:

Multi-dialect database connection framework written with TypeScript

13 lines (12 loc) 584 B
import { EntityMetadata } from '../model/entity-metadata.js'; export function Embedded(type, options) { return (target, propertyKey) => { if (typeof propertyKey !== 'string') throw new Error('Symbol properties are not accepted'); type = type || Reflect.getMetadata('design:type', target, propertyKey); if (typeof type !== 'function') throw new Error('"type" must be defined'); const entity = EntityMetadata.define(target.constructor); EntityMetadata.defineEmbeddedField(entity, propertyKey, type, options); }; }