-
Notifications
You must be signed in to change notification settings - Fork 2
/
field-options.ts
72 lines (61 loc) · 1.33 KB
/
field-options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { ITransformer } from './transformer'
import { IParameterlessConstructor } from '../../utils'
/**
* Field Types to encode/decode
*/
export type FieldType =
| 'string'
| 'number'
| 'decimal'
| 'boolean'
| 'unique'
| 'date'
| 'array'
| 'object'
/**
* Describe all field's options
*/
export interface IFieldOptions {
/**
* Field type. Must be one of the values from the FieldType
*/
type?: FieldType
/**
* Field name in JSON
*/
name?: string
/**
* Field type's length.
*/
length?: number
/**
* Indicates if field's value can not be set to null or undefined when marshall JSON
*/
isRequired?: boolean
/**
* Indicates if field's value is ignored when marshall JSON
*/
isVirtual?: boolean
/**
* Indicates the initial field's value
*/
default?: any
/**
* Indicates if field's value is read only
*/
readOnly?: boolean
/**
* The scale for a decimal (exact numeric) field (applies only for decimal field), which represents the number
* of digits to the right of the decimal point
*/
fixed?: number
/**
* Specifies a value transformer that is to be used to (un)marshal
* this field when (un)marshal.
*/
transformer?: ITransformer
/**
* Indicate the field's constructor class of target
*/
factory?: IParameterlessConstructor<any>
}