Skip to content

Commit

Permalink
Have lte and gte take precedence over lt and gt
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Jan 30, 2022
1 parent e99a0af commit 937110d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,20 @@ struct BaseIterator {
// (lte_ != NULL && target.compare(*lte_) > 0));
// }

return ((lt_ != NULL && target.compare(*lt_) >= 0) ||
(lte_ != NULL && target.compare(*lte_) > 0) ||
(gt_ != NULL && target.compare(*gt_) <= 0) ||
(gte_ != NULL && target.compare(*gte_) < 0));
// The lte and gte options take precedence over lt and gt respectively
if (lte_ != NULL) {
if (target.compare(*lte_) > 0) return true;
} else if (lt_ != NULL) {
if (target.compare(*lt_) >= 0) return true;
}

if (gte_ != NULL) {
if (target.compare(*gte_) < 0) return true;
} else if (gt_ != NULL) {
if (target.compare(*gt_) <= 0) return true;
}

return false;
}

Database* database_;
Expand Down

0 comments on commit 937110d

Please sign in to comment.