v0.13.0
Changes:
- [breaking change] improve
select/3
API formin_key
/max_key
inclusiveness
Details:
The previous API had a few shortcomings:
-
Corner cases when
min_key
/max_key
was set tonil
or to tuples like{123, :included}
needed special handling and were error prone. -
Misspelling
:included
or:excluded
inmin_key
/max_key
would silently fail or lead to unexpected results -
The API was a bit cumbersome in general
The new API introduces a breaking change, but is much clearer, and removes the shortcomings listed above:
# Exclusive ranges:
## Old API:
{:ok, result} = CubDB.select(db,
min_key: :foo,
max_key: {:bar, :excluded}
)
## New API:
{:ok, result} = CubDB.select(db,
min_key: :foo,
max_key: :bar,
max_key_inclusive: false
)
# Open-ended ranges:
## Old API:
{:ok, result} = CubDB.select(db,
min_key: :foo,
max_key: nil
)
## New API:
{:ok, result} = CubDB.select(db,
min_key: :foo
)
# Setting min/max key to `nil`:
## Old API:
{:ok, result} = CubDB.select(db,
min_key: {nil, :included},
max_key: :bar
)
# New API:
{:ok, result} = CubDB.select(db,
min_key: nil,
max_key: :bar
)