Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964

Daniel2b753ac16f93
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 95f27f7fb3..711b870804 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -45,8 +45,18 @@ import (
)
func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) {
- err := SetAttributeViewGroup(operation.AvID, operation.BlockID, operation.Data.(*av.ViewGroup))
- if err != nil {
+ data, err := gulu.JSON.MarshalJSON(operation.Data)
+ if nil != err {
+ logging.LogErrorf("marshal operation data failed: %s", err)
+ return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
+ }
+ group := &av.ViewGroup{}
+ if err = gulu.JSON.UnmarshalJSON(data, &group); nil != err {
+ logging.LogErrorf("unmarshal operation data failed: %s", err)
+ return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
+ }
+
+ if err = SetAttributeViewGroup(operation.AvID, operation.BlockID, group); nil != err {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
return