Skip to content

Revisit the SortedSet `zadd` command API

Nathan Harris requested to merge revisit-zadd into master

Motivation:

While reviewing the API, the current design does not read well, and still has room for misunderstanding the actual end result of a ZADD operation.

Modifications:

  • Rename RedisSortedSetAddOption to RedisZaddInsertBehavior and update cases to match desired use site syntax.
  • Add RedisZaddReturnBehavior enum to define how zadd should calculate the return value.
  • Update zadd and its overloads to support the two new enums in the form of zadd(_:to:inserting:returning:)

Result:

The more "Swifty" API will make it much more clear to developers at the call site what the actual behavior of the ZADD command will be.

Merge request reports