mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
0446aeb1c6
commit
2b753ac16f
1 changed files with 12 additions and 2 deletions
|
|
@ -45,8 +45,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) {
|
||||||
err := SetAttributeViewGroup(operation.AvID, operation.BlockID, operation.Data.(*av.ViewGroup))
|
data, err := gulu.JSON.MarshalJSON(operation.Data)
|
||||||
if err != nil {
|
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 &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue