EntityProperty 实体属性
1. 结构声明
- TS Declaration
- JSON Schema
class EntityProperty extends BaseNode {
name: string = '';
uuid: uuid;
columnName: string;
label: string;
description: string;
typeAnnotation: TypeAnnotation;
databaseTypeAnnotation?: DatabaseTypeAnnotation;
required?: boolean;
defaultValue?: string;
primaryKey?: boolean;
relationNamespace?: string;
relationEntity?: string;
relationProperty?: string;
deleteRule?: 'protect' | 'cascade';
display: Map<string, boolean> = ({
inDetail: true,
inFilter: true,
inForm: true,
inTable: true
} as any);
rules: Array<string>;
generationRule: 'auto' | 'autoIncrement' | 'manual' = 'auto';
sequence?: string;
}
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"uuid": {
"$ref": "#/definitions/uuid"
},
"columnName": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"databaseTypeAnnotation": {
"$ref": "#/definitions/DatabaseTypeAnnotation"
},
"required": {
"type": "boolean"
},
"defaultValue": {
"type": "string"
},
"primaryKey": {
"type": "boolean"
},
"relationNamespace": {
"type": "string"
},
"relationEntity": {
"type": "string"
},
"relationProperty": {
"type": "string"
},
"deleteRule": {
"type": "string",
"enum": [
"protect",
"cascade"
]
},
"display": {
"type": "object",
"properties": {
"size": {
"type": "number"
}
},
"required": [
"size"
],
"additionalProperties": false
},
"rules": {
"type": "array",
"items": {
"type": "string"
}
},
"generationRule": {
"type": "string",
"enum": [
"auto",
"autoIncrement",
"manual"
]
},
"sequence": {
"type": "string"
}
},
"required": [
"name",
"uuid",
"columnName",
"label",
"description",
"typeAnnotation",
"display",
"rules",
"generationRule"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "EntityProperty",
"name": "status",
"uuid": "b1a9e167277e4f73b6b218eb7ede43ad",
"label": "",
"description": "",
"columnName": "status",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.enums",
"typeName": "ProductStatus",
"inferred": false,
"ruleMap": {}
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "manual"
}
concept: EntityProperty
name: status
uuid: b1a9e167277e4f73b6b218eb7ede43ad
label: ""
description: ""
columnName: status
typeAnnotation:
concept: TypeAnnotation
typeKind: reference
typeNamespace: app.enums
typeName: ProductStatus
inferred: false
ruleMap: {}
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: manual
(2) 带关联关系的
AST 如下:
- JSON
- YAML
{
"concept": "EntityProperty",
"name": "productId",
"uuid": "b1a9e167277e4f73b6b218eb7ede43ad",
"label": "",
"description": "",
"columnName": "productId",
"relationNamespace": "app.dataSources.defaultDS",
"relationEntity": "Product",
"relationProperty": "id",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "manual"
}
concept: EntityProperty
name: productId
uuid: b1a9e167277e4f73b6b218eb7ede43ad
label: ""
description: ""
columnName: productId
relationNamespace: app.dataSources.defaultDS
relationEntity: Product
relationProperty: id
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: manual