From 24b7862262f888df32d082a0f73f9b650f0efca8 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 20 Apr 2024 12:14:45 +0800 Subject: [PATCH] :art: Rows non-bound in the database support `Add to Database` https://github.com/siyuan-note/siyuan/issues/11093 --- kernel/model/attribute_view.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 797b6fca0..f9adb800f 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2165,7 +2165,16 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) { } func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr) { - err := AddAttributeViewBlock(tx, operation.Srcs, operation.AvID, operation.BlockID, operation.PreviousID, operation.IsDetached, operation.IgnoreFillFilterVal) + var srcs []map[string]interface{} + if 0 < len(operation.Srcs) { + srcs = operation.Srcs + } else { + for _, srcID := range operation.SrcIDs { + srcs = append(srcs, map[string]interface{}{"id": srcID}) + } + } + + err := AddAttributeViewBlock(tx, srcs, operation.AvID, operation.BlockID, operation.PreviousID, operation.IsDetached, operation.IgnoreFillFilterVal) if nil != err { return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()} }