Skip to content

Conversation

@iwecon
Copy link

@iwecon iwecon commented Dec 8, 2025

Details: #135

Because zadd defaults to (RESPValue, Double), scoreIsFirst is set to false by default.

zadd function:

@inlinable
public func zadd<Value: RESPValueConvertible>(
    _ elements: [(element: Value, score: Double)],
    to key: RedisKey,
    inserting insertBehavior: RedisZaddInsertBehavior = .allElements,
    returning returnBehavior: RedisZaddReturnBehavior = .insertedElementsCount
) -> EventLoopFuture<Int> {
    var args: [RESPValue] = [.init(from: key)]

    args.append(convertingContentsOf: [insertBehavior.string, returnBehavior.string].compactMap({ $0 }))
    args.add(contentsOf: elements, overestimatedCountBeingAdded: elements.count * 2) { (array, next) in
        array.append(.init(bulk: next.score.description))
        array.append(next.element.convertedToRESPValue())
    }

    return self.send(command: "ZADD", with: args)
        .tryConverting()
}

@iwecon
Copy link
Author

iwecon commented Dec 8, 2025

@fabianfett @0xTim pls review! :)

@iwecon
Copy link
Author

iwecon commented Jan 16, 2026

Has this project been forgotten?
@Joannis @fabianfett @Mordil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant