xls2ddl/docs/dbtable.md
2025-12-05 17:51:50 +08:00

48 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 数据库表定义规范
数据库表用一个json格式文件或数据来定义具体规范如下
{
"summary":[ # 仅一条记录
{
"name" # 表名
"title" # 表标题
"primary" # 主键,等于"id"所有表的主键均为id
"catelog" # 可选项entity relation dimession indication
}
]
"fields":[ # 字段
{
"name"
"title"
"type" #可选项有str char short long llong date time timestamp float double ddouble decimal text
"length"
"dec"
"nullable" # 可选项yes no
"default"
"comments" # 注释
}
]
"indexes":[
{
"name" # 每个索引一个idxname不能重复一个表中
"idxtype" # unique or index
"idxfields" # 字段名或字段名数组[f1,f1]
}
]
“codes":[ # 如果一个字段数据可以从其他表中获得,可以通过下面的模式定义选择输入逻辑
{
"field" # 字段的名字
"table" # 数据来源表
"valuefield" # 数据来源表值字段
"textfield" # 数据来源表显示字段
"cond" # 检索条件
}
]
]
说明:
id字段全部使用str 32类型
字典中的length如果type是str char float double ddouble decimal中的一个则必为>0的数字
字典中的dec: 如果type是float double ddouble decimal中的一个则必须是>0的数字