Partitions gets a new get_with_keys? function, for consistency.

This commit is contained in:
Philippe PITTOLI 2024-05-22 05:34:36 +02:00
parent 255cfe4162
commit 7272b9fe6f

View File

@ -137,6 +137,14 @@ class DODB::Partition(V) < DODB::Indexer(V)
r_value r_value
end 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. # Deletes all entries within the provided partition.
# #
# ``` # ```