🎨 Add Relation and Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9888

This commit is contained in:
Daniel 2023-12-23 17:45:46 +08:00
parent c916cd0c23
commit 46c82acf6c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 72 additions and 24 deletions

View file

@ -89,12 +89,10 @@ type Key struct {
Template string `json:"template"` // 模板内容
// 关联列
RelationAvID string `json:"relationAvID"` // 关联的属性视图 ID
IsBiRelation bool `json:"isBiRelation"` // 是否双向关联
BackRelationKeyID string `json:"backRelationKeyID"` // 双向关联时回链关联列的 ID
Relation *Relation `json:"relation,omitempty"` // 关联信息
// 汇总列
RollupKeyID string `json:"rollupKeyID"` // 汇总列 ID
Rollup *Rollup `json:"rollup,omitempty"` // 汇总信息
}
func NewKey(id, name, icon string, keyType KeyType) *Key {
@ -106,6 +104,16 @@ func NewKey(id, name, icon string, keyType KeyType) *Key {
}
}
type Rollup struct {
KeyID string `json:"keyID"` // 汇总列 ID
}
type Relation struct {
AvID string `json:"avID"` // 关联的属性视图 ID
IsTwoWay bool `json:"isTwoWay"` // 是否双向关联
BackKeyID string `json:"backKeyID"` // 双向关联时回链关联列的 ID
}
type KeySelectOption struct {
Name string `json:"name"`
Color string `json:"color"`

View file

@ -651,9 +651,11 @@ type TableColumn struct {
// 以下是某些列类型的特有属性
Options []*KeySelectOption `json:"options,omitempty"` // 选项列表
NumberFormat NumberFormat `json:"numberFormat"` // 列数字格式化
Template string `json:"template"` // 模板内容
Options []*KeySelectOption `json:"options,omitempty"` // 选项列表
NumberFormat NumberFormat `json:"numberFormat"` // 列数字格式化
Template string `json:"template"` // 模板内容
Relation *Relation `json:"relation,omitempty"` // 关联列
Rollup *Rollup `json:"rollup,omitempty"` // 汇总列
}
type TableCell struct {