index#update(new_value) : index is automatically retrieved.
parent
4ba6c26a21
commit
e457a80399
|
@ -1,8 +1,9 @@
|
|||
name: dodb
|
||||
version: 0.2.1
|
||||
version: 0.2.2
|
||||
|
||||
authors:
|
||||
- Luka Vandervelden <lukc@upyum.com>
|
||||
- Philippe Pittoli <karchnu@karchnu.fr>
|
||||
|
||||
description: |
|
||||
Simple, embeddable Document-Oriented DataBase in Crystal.
|
||||
|
|
|
@ -87,6 +87,12 @@ class DODB::Index(V) < DODB::Indexer(V)
|
|||
{value, key}
|
||||
end
|
||||
|
||||
# in case new_value hasn't change its index
|
||||
def update(new_value : V)
|
||||
index = key_proc.call new_value
|
||||
update index, new_value
|
||||
end
|
||||
|
||||
def update(index : String, new_value : V)
|
||||
_, key = get_with_key index
|
||||
|
||||
|
|
Loading…
Reference in New Issue