Skip to content

DataType

marstone edited this page Mar 24, 2020 · 8 revisions

Example

数据图

DataType Example

  • 绿色边:Master-Detail关系(一对多)
  • 紫色边:Lookup关系(多对一)

配置文件

data:
# 数据类型1:活动室
- name: Gym
  text: 活动室 
  description: 各种
  # 此数据类型的字段定义 
  fields:
  - name: id
    type: ID
    text: 活动室主键 
    modifiers: 
    - NotNull
  - name: name
    text: 活动室名称   # type不给出默认是String 
  - name: type
    type: GymType
    text: 活动室类型
  - name: admin
    text: 活动室管理员 
    type: User 
  - name: equipment
    type: Equipment
    modifiers:
    - List
  attributes:
    # 可分页类型,说明外层有Connection/Node的包装 
    paginition: true 
  # 定义环境及数据来源
  environment:
  # 定义生产环境 
  - kind: production 
    sources: 
    # 数据来自网关的 Provider 服务的 Gym 类型
    - uri: "canvasbus://me/Gym" 

# 数据类型2: 设备 
- name: Equipment 
  text: 设备 
  fields:
  - name: id
    type: ID 
    modifiers: [ "NotNull" ]
  - name: admin 
    text: 设备管理员  
    type: User 
  # 定义环境及数据来源
  environment:
  # 生产环境 
  - kind: production 
    sources: 
    # 数据来自网关的 Provider 服务的 Equipment 类型
    - uri: "canvasbus://me/Equipment" 

# 数据类型3:用户 
- name: User
  text: 用户 
  fields:
  - name: id
    type: ID 
    modifiers: [ "NotNull" ]
  - name: account 
    text: 用户账号 
  # 环境与来源
  environment:
  - kind: production 
    sources: 
    # 数据来自网关内置服务的 User 类型
    - uri: "canvasbus://builtin/User" 


# 数据类型4:活动室类型(枚举) 
- name: GymType
  text: 活动室类型 
  fields:
  - name: code
  - name: text 
  # 环境与来源
  environment:
  - kind: production 
    sources: 
    # 常量,直接定义
    - uri: > constants://[
         { "code": "1",  "text": "篮球馆" },
         { "code": "2",  "text": "网球场" }
    ]


Clone this wiki locally