diff --git a/src/dodb/partition.cr b/src/dodb/partition.cr index a7352ed..a640f5a 100644 --- a/src/dodb/partition.cr +++ b/src/dodb/partition.cr @@ -137,6 +137,14 @@ class DODB::Partition(V) < DODB::Indexer(V) r_value end + # Safe version of `#get_with_keys`. + # NOTE: returns an empty list on empty or non-existing partition. + def get_with_keys?(partition : String) : Array(Tuple(V, Int32)) + get_with_keys partition + rescue MissingEntry + Array(Tuple(V, Int32)).new + end + # Deletes all entries within the provided partition. # # ```