♻️ Refactor av data structure

This commit is contained in:
Daniel 2023-07-13 10:44:47 +08:00
parent f123a9a210
commit 870c238ed6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 4 deletions

View file

@ -82,9 +82,10 @@ type KeySelectOption struct {
}
type Value struct {
ID string `json:"id"`
KeyID string `json:"keyID"`
BlockID string `json:"blockID"`
ID string `json:"id"`
KeyID string `json:"keyID"`
BlockID string `json:"blockID"`
Type KeyType `json:"type"`
Block *ValueBlock `json:"block,omitempty"`
Text *ValueText `json:"text,omitempty"`

View file

@ -694,12 +694,13 @@ func updateAttributeViewCell(operation *Operation, tx *Transaction) (err error)
for _, value := range keyValues.Values {
if operation.ID == value.ID {
val = value
val.Type = keyValues.Key.Type
break
}
}
if nil == val {
val = &av.Value{ID: operation.ID, KeyID: keyValues.Key.ID, BlockID: operation.RowID}
val = &av.Value{ID: operation.ID, KeyID: keyValues.Key.ID, BlockID: operation.RowID, Type: keyValues.Key.Type}
keyValues.Values = append(keyValues.Values, val)
}
break