Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/tutorial/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ sidebar_position: 50

- 更新了字段类型定义,移除了过时的ID类型
- 添加了新的字段类型:Time、JSON、Enum、Relation
- 字段类型 `Relation` 重命名为 `ModelRef`,与 `EnumRef` 语义对齐
- 更新了字段属性定义,添加了identity、modelName等属性
- 添加了索引定义的详细说明
- 完善了 FML 脚本语法规范和示例
Expand Down
34 changes: 17 additions & 17 deletions docs/tutorial/features/modeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ Flexmodel 支持三种模型类型:

实体字段支持以下数据类型:

| 类型 | 说明 |
|----------|------|
| String | 字符串,可配置长度 |
| Int | 32 位整数 |
| Long | 64 位长整数 |
| 类型 | 说明 |
|----------|--------------------------------|
| String | 字符串,可配置长度 |
| Int | 32 位整数 |
| Long | 64 位长整数 |
| Float | 精确的小数类型,常用于财务数据 |
| Boolean | 布尔值,仅能存储 true 或 false |
| DateTime | 日期时间 |
| Date | 日期,不包含时间 |
| Time | 时间,不包含日期 |
| JSON | JSON 对象 |
| EnumRef | 枚举引用 |
| Relation | 模型引用(关联关系) |
| DateTime | 日期时间 |
| Date | 日期,不包含时间 |
| Time | 时间,不包含日期 |
| JSON | JSON 对象 |
| EnumRef | 枚举引用 |
| ModelRef | 模型引用(关联关系) |

### 字段公共属性

Expand Down Expand Up @@ -101,7 +101,7 @@ Flexmodel 支持三种模型类型:
| multiple | Boolean | 是 | 是否多条,默认值为 `false` |
| from | String | 否 | 枚举从哪里来,从枚举定义中获取 |

**Relation**
**ModelRef**

| 属性 | 类型 | 可选 | 描述 |
|------|------|------|------|
Expand Down Expand Up @@ -181,7 +181,7 @@ FML 语法中常用的字段修饰符(注解):
```json
{
"name": "UserGender",
"type": "ENUM",
"type": "Enum",
"elements": [
"UNKNOWN",
"MALE",
Expand Down Expand Up @@ -222,7 +222,7 @@ FML 语法中常用的字段修饰符(注解):
```json
{
"name": "分组查询",
"type": "NATIVE_QUERY",
"type": "NativeQuery",
"statement": "select count(id) as total, gender, max(age) as ageSum from Student group by gender"
}
```
Expand All @@ -242,7 +242,7 @@ FML 语法中常用的字段修饰符(注解):

### JSON Schema 配置

支持通过 JSON 格式定义模型,对象分为 `ENTITY`、`ENUM` 和 `NATIVE_QUERY` 三种类型。
支持通过 JSON 格式定义模型,对象分为 `Entity`、`Enum` 和 `NativeQuery` 三种类型。

**实体配置示例:**

Expand Down Expand Up @@ -305,7 +305,7 @@ FML 语法中常用的字段修饰符(注解):
},
{
"name": "studentDetail",
"type": "Relation",
"type": "ModelRef",
"modelName": "Student",
"unique": false,
"nullable": true,
Expand Down Expand Up @@ -350,7 +350,7 @@ FML 语法中常用的字段修饰符(注解):
"nullable": true
},
{
"type": "Relation",
"type": "ModelRef",
"name": "student",
"comment": "班级",
"modelName": "StudentDetail",
Expand Down