🎨 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-15 20:05:14 +08:00
parent 0547f27839
commit fca3bf6855
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 215 additions and 5 deletions

View file

@ -50,6 +50,8 @@ type Value struct {
Created *ValueCreated `json:"created,omitempty"`
Updated *ValueUpdated `json:"updated,omitempty"`
Checkbox *ValueCheckbox `json:"checkbox,omitempty"`
Relation *ValueRelation `json:"relation,omitempty"`
Rollup *ValueRollup `json:"rollup,omitempty"`
}
func (value *Value) String() string {
@ -135,6 +137,16 @@ func (value *Value) String() string {
return "√"
}
return ""
case KeyTypeRelation:
if nil == value.Relation {
return ""
}
return value.Relation.Content
case KeyTypeRollup:
if nil == value.Rollup {
return ""
}
return strings.Join(value.Rollup.Contents, " ")
default:
return ""
}
@ -433,3 +445,12 @@ func NewFormattedValueUpdated(content, content2 int64, format UpdatedFormat) (re
type ValueCheckbox struct {
Checked bool `json:"checked"`
}
type ValueRelation struct {
Content string `json:"content"`
BlockIDs []string `json:"blockIDs"`
}
type ValueRollup struct {
Contents []string `json:"contents"`
}