RESPValue

public enum RESPValue

A representation of a Redis Serialization Protocol (RESP) primitive value.

This enum representation should be used only as a temporary intermediate representation of values, and should be sent to a Redis server or converted to Swift types as soon as possible.

Redis servers expect a single message packed into an .array, with all elements being .bulkString representations of values. As such, all initializers convert to .bulkString representations, as well as default conformances for RESPValueConvertible.

Each case of this type is a different listing in the RESP specification, and several computed properties are available to consistently convert values into Swift types.

See: https://redis.io/topics/protocol

  • See CustomStringConvertible.description

    Declaration

    Swift

    public var description: String { get }
  • The unwrapped value for .array representations.

    Note

    This is a shorthand for Array<RESPValue>.init(fromRESP:)

    Declaration

    Swift

    public var array: [RESPValue]? { get }
  • int

    The unwrapped value as an Int.

    Note

    This is a shorthand for Int(fromRESP:).

    Declaration

    Swift

    public var int: Int? { get }
  • Returns true if the unwrapped value is .null.

    Declaration

    Swift

    public var isNull: Bool { get }
  • The unwrapped RedisError that was returned from Redis.

    Note

    This is a shorthand for RedisError(fromRESP:).

    Declaration

    Swift

    public var error: RedisError? { get }
  • The unwrapped NIO.ByteBuffer for .simpleString or .bulkString representations.

    Declaration

    Swift

    public var byteBuffer: ByteBuffer? { get }