UNPKG

1.56 kBTypeScriptView Raw
1declare namespace FxOrmProperty {
2 /**
3 * @description key linked association type
4 * - 'primary': means this property is for column defined as 'primary'
5 * - 'hasOne': means this property is for column used as asscociated key in 'hasOne' assciation
6 */
7 type KlassType = 'primary' | 'hasOne'
8
9 interface CustomPropertyType extends FxOrmSqlDDLSync__Driver.CustomPropertyType {
10 datastoreType: {
11 (prop?: FxOrmProperty.NormalizedProperty): string
12 }
13 valueToProperty?: {
14 (value?: any, prop?: FxOrmProperty.NormalizedProperty): any
15 }
16 propertyToValue?: {
17 (value?: any, prop?: FxOrmProperty.NormalizedProperty): any
18 }
19 datastoreGet?: {
20 (prop?: FxOrmProperty.NormalizedProperty, helper?: FxSqlQuery.Class_Query): any
21 }
22 }
23
24 /**
25 * @description useful when pass property's option(such as type, big, ...etc) internally, useless for exposed api.
26 */
27 // interface NormalizedProperty extends FxOrmModel.ModelPropertyDefinition {
28 interface NormalizedProperty extends FxOrmSqlDDLSync__Column.Property {
29 // all fields inherited from `FxOrmModel.ModelPropertyDefinition` are still optional
30
31 key?: boolean
32 klass?: KlassType
33 lazyload?: boolean
34 alwaysValidate?: boolean
35 lazyname?: string
36 }
37
38 interface NormalizedPropertyHash {
39 [key: string]: NormalizedProperty
40 }
41
42 interface FieldToPropertyMapType {
43 [f_name: string]: NormalizedProperty
44 }
45}
\No newline at end of file