mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 03:48:48 +01:00
🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958
This commit is contained in:
parent
93dc9f5c22
commit
0ce8b58a79
3 changed files with 110 additions and 13 deletions
|
|
@ -49,6 +49,16 @@ type KeyValues struct {
|
|||
Values []*Value `json:"values,omitempty"` // 属性视图属性列值
|
||||
}
|
||||
|
||||
func (kValues *KeyValues) GetValue(blockID string) (ret *Value) {
|
||||
for _, v := range kValues.Values {
|
||||
if v.BlockID == blockID {
|
||||
ret = v
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type KeyType string
|
||||
|
||||
const (
|
||||
|
|
@ -306,6 +316,20 @@ func (av *AttributeView) GetCurrentView() (ret *View, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (av *AttributeView) GetValue(keyID, blockID string) (ret *Value) {
|
||||
for _, kv := range av.KeyValues {
|
||||
if kv.Key.ID == keyID {
|
||||
for _, v := range kv.Values {
|
||||
if v.BlockID == blockID {
|
||||
ret = v
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (av *AttributeView) GetKey(keyID string) (ret *Key, err error) {
|
||||
for _, kv := range av.KeyValues {
|
||||
if kv.Key.ID == keyID {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue