🎨 Automatically fill in the filter result value when adding rows in the database table view https://github.com/siyuan-note/siyuan/issues/9905

This commit is contained in:
Daniel 2023-12-17 12:00:55 +08:00
parent a379e24b3b
commit 7ff4356316
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 49 additions and 4 deletions

View file

@ -313,6 +313,17 @@ func (av *AttributeView) GetBlockKeyValues() (ret *KeyValues) {
return
}
func (av *AttributeView) GetKeyValues(keyID string) (ret *KeyValues, err error) {
for _, kv := range av.KeyValues {
if kv.Key.ID == keyID {
ret = kv
return
}
}
err = ErrKeyNotFound
return
}
func (av *AttributeView) GetBlockKey() (ret *Key) {
for _, kv := range av.KeyValues {
if KeyTypeBlock == kv.Key.Type {

View file

@ -160,6 +160,18 @@ func (value *Value) ToJSONString() string {
return string(data)
}
func (value *Value) Clone() (ret *Value) {
data, err := gulu.JSON.MarshalJSON(value)
if nil != err {
return
}
err = gulu.JSON.UnmarshalJSON(data, &ret)
if nil != err {
return
}
return
}
type ValueBlock struct {
ID string `json:"id"`
Content string `json:"content"`