• Nathan Harris's avatar
    Add type-safe representation of Redis keys · ea6f4279
    Nathan Harris authored
    Motivation:
    
    Inspired by Swift by Sundell's article on type-safe identifers, the goal of this commit is to have the compiler
    assist in preventing incorrect Redis key values from being used in API calls.
    
    See https://www.swiftbysundell.com/articles/type-safe-identifiers-in-swift/ for the inspiration.
    
    Modifications:
    
    - Add new `RedisKey` struct that wraps around a single `String` value that conforms to several expected protocols
      (Hashable, Comparable, Codable, etc.)
    - Change all command APIs to require `RedisKey` rather than plain strings
    
    Result:
    
    When encountering an API requiring a RedisKey, it should be much more apparant at the use site what form a value should take.
    ea6f4279
Code owners : Nathan Harris
RESPValueConvertible.swift 7.6 KB