Index#update_or_create(key, value) added.
parent
eb50b5c433
commit
355f85d635
|
@ -93,6 +93,12 @@ class DODB::Index(V) < DODB::Indexer(V)
|
|||
@storage[key] = new_value
|
||||
end
|
||||
|
||||
def update_or_create(index : String, new_value : V)
|
||||
update index, new_value
|
||||
rescue MissingEntry
|
||||
@storage << new_value
|
||||
end
|
||||
|
||||
def delete(index : String)
|
||||
key = get_key index
|
||||
|
||||
|
|
Loading…
Reference in New Issue