import { FieldOptions , JoinColumn , JoinTable , Mapping , Relationship } from '../Mapping' ; import { EntityRepository } from '../EntityRepository' ; entity entity param { { } } options return { Mapping } export function entity ( options ? ) { return ( target ) => { Mapping . forEntity ( target ) . entity ( options ) ; } ; } return { Mapping } export function autoFields ( ) { return ( target ) => { Mapping . forEntity ( target ) . autoFields ( ) ; } ; } index index index index index param { Array | string } indexName param { Array | string } fields return { ( target : Object , property : string ) => void } export function index ( indexName ? , fields ? ) { return ( target , property ? ) : void => { if ( ! property ) { Mapping . forEntity ( target ) . index ( indexName , fields ) ; return ; } if ( indexName ) { Mapping . forEntity ( target ) . index ( indexName , property ) ; return ; } Mapping . forEntity ( target ) . index ( property ) ; } ; } uniqueConstraint uniqueConstraint uniqueConstraint uniqueConstraint uniqueConstraint param { Array | string } constraintName param { Array | string } fields return { ( target : Object , property : string ) => void } export function uniqueConstraint ( constraintName ? , fields ? ) { return ( target , property ? ) : void => { if ( ! property ) { Mapping . forEntity ( target ) . uniqueConstraint ( constraintName , fields ) ; return ; } if ( constraintName ) { Mapping . forEntity ( target ) . uniqueConstraint ( constraintName , property ) ; return ; } Mapping . forEntity ( target ) . uniqueConstraint ( property ) ; } ; } field field param { { } } options return { Mapping } export function field ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . field ( property , options ) ; } ; } return { Field } export function primary ( ) { return ( target , property ) => { Mapping . forEntity ( target ) . primary ( property ) ; } ; } returns { Mapping } export function autoPK ( ) { return ( target ) => { Mapping . forEntity ( target ) . autoPK ( ) ; } ; } returns { Mapping } export function autoCreatedAt ( ) { return ( target ) => { Mapping . forEntity ( target ) . autoCreatedAt ( ) ; } ; } returns { Mapping } export function autoUpdatedAt ( ) { return ( target ) => { Mapping . forEntity ( target ) . autoUpdatedAt ( ) ; } ; } param { string } type return { Field } export function generatedValue ( type ) { return ( target , property ) => { Mapping . forEntity ( target ) . generatedValue ( property , type ) ; } ; } param { string [ ] } cascades returns { Field } export function cascade ( cascades ) { return ( target , property ) => { Mapping . forEntity ( target ) . cascade ( property , cascades ) ; } ; } returns { Field } export function increments ( ) { return ( target , property ) => { Mapping . forEntity ( target ) . increments ( property ) ; } ; } param { Relationship } options returns { Field } export function oneToOne ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . oneToOne ( property , options ) ; } ; } param { Relationship } options returns { Field } export function oneToMany ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . oneToMany ( property , options ) ; } ; } param { Relationship } options returns { Field } export function manyToOne ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . manyToOne ( property , options ) ; } ; } param { Relationship } options returns { Field } export function manyToMany ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . manyToMany ( property , options ) ; } ; } param { JoinTable } options returns { Field } export function joinTable ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . joinTable ( property , options ) ; } ; } param { JoinTable } options returns { Field } export function joinColumn ( options ) { return ( target , property ) => { Mapping . forEntity ( target ) . joinColumn ( property , options ) ; } ; }