|
|
|
|
|
|
|
|
## 1. 客户端工具下载
|
|
|
|
|
|
### 1.1 版本 v0.1.0
|
|
|
|
|
|
https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20201228/object/1609137707_XsBEXcRxJscRHCzQmxeseTAEQXTH7A7Z.zip
|
|
|
|
|
|
|
|
|
|
|
|
## 2. 账号登录
|
|
|
|
|
|
|
|
|
|
|
|
账号需要向平台服务申请,用户名为 申请人手机号 默认密码 mmm123456
|
|
|
|
|
|
![image-20201231152315657](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504740_smhbM5mmBrHjpytcydMNs2xm4AKjA2xY.png)
|
|
|
|
|
|
|
|
|
|
|
|
## 3. 项目初始化
|
|
|
|
|
|
|
|
|
|
|
|
设置项目/描述文件路径
|
|
|
|
|
|
![image-20201231152940513](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504746_eTAEQXTH7A7ZK6z4FzZ2YeDwX3KwcGdD.png)
|
|
|
|
|
|
|
|
|
|
|
|
## 4. 应用描述文件生成
|
|
|
|
|
|
### 4.1 添加属性描述 (attribute)
|
|
|
|
|
|
![image-20201231153445643](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504750_tEYHSbtbSdasD2PM4QGX3yZtx33xATYN.png)
|
|
|
|
|
|
属性是描述文件的最小单元
|
|
|
|
|
|
attibute名称
|
|
|
|
|
|
```
|
|
|
例如此处 taskId
|
|
|
属性名称会影响到描述文件的文件名称,这边会生成的描述文件
|
|
|
|
|
|
taskId.yaml
|
|
|
```
|
|
|
|
|
|
attribute类型 包含
|
|
|
|
|
|
```
|
|
|
primitive: 原始类型,包括:string,boolean,int,int32,int64,uint,uint32,uint64,float32,float64,datetime,bytes
|
|
|
array: 原始类型数组,或者自定义模式数组,例子:string或者task
|
|
|
schema: 自定义模式,Schema描述的name字段,例子:task
|
|
|
```
|
|
|
|
|
|
attribute 所在文件名称
|
|
|
|
|
|
```
|
|
|
例如此处 task
|
|
|
生成的描述文件就会保存在 /task/taskId.yaml
|
|
|
```
|
|
|
|
|
|
文件内容如下
|
|
|
|
|
|
```
|
|
|
version: v1
|
|
|
kind: Attribute
|
|
|
metadata:
|
|
|
name: taskId
|
|
|
description: 任务编号
|
|
|
type:
|
|
|
primitive: int64
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 4.2 添加结构描述(schema)
|
|
|
|
|
|
|
|
|
|
|
|
![image-20201231155037423](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504756_dFnFtQKEHHxJknQFEAK5rmXDfSrhxjA7.png)
|
|
|
|
|
|
生成描述文件 /schemas/task.yaml
|
|
|
|
|
|
```
|
|
|
version: v1
|
|
|
kind: Schema
|
|
|
metadata:
|
|
|
name: task
|
|
|
description: 任务实体
|
|
|
attributes:
|
|
|
- ref: taskId
|
|
|
required: true
|
|
|
- ref: taskName
|
|
|
required: true
|
|
|
- name: taskDescription
|
|
|
description: 任务描述-(这边写入自定义属性的描述)
|
|
|
type:
|
|
|
primitive: string
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 4.3 添加服务描述 (service)
|
|
|
|
|
|
|
|
|
|
|
|
![image-20201231155415791](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504761_er4FArQSQfbbxQPBPnFDeRabpJ3k7kzS.png)
|
|
|
|
|
|
method名称 :指定CURD 工具会自动生成服务方法 create、get、list、remove、update
|
|
|
|
|
|
```
|
|
|
F:\eggcode\dsl\godevp\services\task\methods\createTask.yaml
|
|
|
F:\eggcode\dsl\godevp\services\task\methods\getTask.yaml
|
|
|
F:\eggcode\dsl\godevp\services\task\methods\listTask.yaml
|
|
|
F:\eggcode\dsl\godevp\services\task\methods\removeTask.yaml
|
|
|
F:\eggcode\dsl\godevp\services\task\methods\updateTask.yaml
|
|
|
F:\eggcode\dsl\godevp\services\task\service.yaml
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 4.4 添加接口描述(api)
|
|
|
|
|
|
![image-20201231161927395](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504767_6tbPWDQksxsJKR5Gneb5AYJTABjkNEAG.png)
|
|
|
|
|
|
|
|
|
|
|
|
生成描述文件 /http/task.yaml
|
|
|
|
|
|
```
|
|
|
version: v1
|
|
|
kind: HttpApi
|
|
|
metadata:
|
|
|
service: task
|
|
|
path: /tasks
|
|
|
endpoints:
|
|
|
- method: createTask
|
|
|
route:
|
|
|
post: /
|
|
|
- method: updateTask
|
|
|
route:
|
|
|
put: /{taskId} ##注意这边需要手动加上task
|
|
|
- method: getTask
|
|
|
route:
|
|
|
get: /{taskId} ##注意这边需要手动加上task
|
|
|
- method: removeTask
|
|
|
route:
|
|
|
delete: /{taskId} ##注意这边需要手动加上task
|
|
|
- method: listTask
|
|
|
route:
|
|
|
get: /
|
|
|
params:
|
|
|
- name: offset
|
|
|
- name: limit
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 5. 生成项目代码
|
|
|
|
|
|
### 5.1 生成项目脚手架 (基础文件)
|
|
|
|
|
|
指定web框架、数据库
|
|
|
|
|
|
![image-20201231162224099](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504772_dbtZePks2hW2nNAhX4CRCmwczeFaK5Gz.png)
|
|
|
|
|
|
|
|
|
|
|
|
### 5.2 生成领域模型 (domain相关文件)
|
|
|
|
|
|
![image-20201231163250901](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504777_EnmnrTR7kA34XNFMPGeRFYJfcJ7pysry.png)
|
|
|
|
|
|
|
|
|
|
|
|
### 5.3 生成应用服务 (application)
|
|
|
|
|
|
![image-20201231163332731](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504782_MXKXHYEbKsRskTyRGYkmFrdwfRHEMc33.png)
|
|
|
|
|
|
|
|
|
|
|
|
### 5.4 生成http服务文件(路由控制器)
|
|
|
|
|
|
![image-20201231163433314](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504787_XC4dtwzeBhkCDt6CDF3QPJb2TMTBJyxc.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 6. 生成文档
|
|
|
|
|
|
![image-20201231163458590](https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210113/object/1610504792_DKThDyRJmAk3mt7j6ypM3BYxceC7AWzX.png) |
|
|
\ No newline at end of file |
...
|
...
|
|