@@ -1874,6 +1874,257 @@ func (client *baseClient) XLen(key string) (int64, error) {
18741874 return handleIntResponse (result )
18751875}
18761876
1877+ // Transfers ownership of pending stream entries that match the specified criteria.
1878+ //
1879+ // Since:
1880+ //
1881+ // Valkey 6.2.0 and above.
1882+ //
1883+ // See [valkey.io] for more details.
1884+ //
1885+ // Parameters:
1886+ //
1887+ // key - The key of the stream.
1888+ // group - The consumer group name.
1889+ // consumer - The group consumer.
1890+ // minIdleTime - The minimum idle time for the message to be claimed.
1891+ // start - Filters the claimed entries to those that have an ID equal or greater than the specified value.
1892+ //
1893+ // Return value:
1894+ //
1895+ // An object containing the following elements:
1896+ // - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
1897+ // equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if
1898+ // the entire stream was scanned.
1899+ // - A map of the claimed entries.
1900+ // - If you are using Valkey 7.0.0 or above, the response will also include an array containing
1901+ // the message IDs that were in the Pending Entries List but no longer exist in the stream.
1902+ // These IDs are deleted from the Pending Entries List.
1903+ //
1904+ // Example:
1905+ //
1906+ // result, err := client.XAutoClaim("myStream", "myGroup", "myConsumer", 42, "0-0")
1907+ // result:
1908+ // // &{
1909+ // // "1609338788321-0" // value to be used as `start` argument for the next `xautoclaim` call
1910+ // // map[
1911+ // // "1609338752495-0": [ // claimed entries
1912+ // // ["field 1", "value 1"]
1913+ // // ["field 2", "value 2"]
1914+ // // ]
1915+ // // ]
1916+ // // [
1917+ // // "1594324506465-0", // array of IDs of deleted messages,
1918+ // // "1594568784150-0" // included in the response only on valkey 7.0.0 and above
1919+ // // ]
1920+ // // }
1921+ //
1922+ // [valkey.io]: https://valkey.io/commands/xautoclaim/
1923+ func (client * baseClient ) XAutoClaim (
1924+ key string ,
1925+ group string ,
1926+ consumer string ,
1927+ minIdleTime int64 ,
1928+ start string ,
1929+ ) (XAutoClaimResponse , error ) {
1930+ return client .XAutoClaimWithOptions (key , group , consumer , minIdleTime , start , nil )
1931+ }
1932+
1933+ // Transfers ownership of pending stream entries that match the specified criteria.
1934+ //
1935+ // Since:
1936+ //
1937+ // Valkey 6.2.0 and above.
1938+ //
1939+ // See [valkey.io] for more details.
1940+ //
1941+ // Parameters:
1942+ //
1943+ // key - The key of the stream.
1944+ // group - The consumer group name.
1945+ // consumer - The group consumer.
1946+ // minIdleTime - The minimum idle time for the message to be claimed.
1947+ // start - Filters the claimed entries to those that have an ID equal or greater than the specified value.
1948+ // options - Options detailing how to read the stream.
1949+ //
1950+ // Return value:
1951+ //
1952+ // An object containing the following elements:
1953+ // - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
1954+ // equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if
1955+ // the entire stream was scanned.
1956+ // - A map of the claimed entries.
1957+ // - If you are using Valkey 7.0.0 or above, the response will also include an array containing
1958+ // the message IDs that were in the Pending Entries List but no longer exist in the stream.
1959+ // These IDs are deleted from the Pending Entries List.
1960+ //
1961+ // Example:
1962+ //
1963+ // opts := options.NewXAutoClaimOptionsWithCount(1)
1964+ // result, err := client.XAutoClaimWithOptions("myStream", "myGroup", "myConsumer", 42, "0-0", opts)
1965+ // result:
1966+ // // &{
1967+ // // "1609338788321-0" // value to be used as `start` argument for the next `xautoclaim` call
1968+ // // map[
1969+ // // "1609338752495-0": [ // claimed entries
1970+ // // ["field 1", "value 1"]
1971+ // // ["field 2", "value 2"]
1972+ // // ]
1973+ // // ]
1974+ // // [
1975+ // // "1594324506465-0", // array of IDs of deleted messages,
1976+ // // "1594568784150-0" // included in the response only on valkey 7.0.0 and above
1977+ // // ]
1978+ // // }
1979+ //
1980+ // [valkey.io]: https://valkey.io/commands/xautoclaim/
1981+ func (client * baseClient ) XAutoClaimWithOptions (
1982+ key string ,
1983+ group string ,
1984+ consumer string ,
1985+ minIdleTime int64 ,
1986+ start string ,
1987+ options * options.XAutoClaimOptions ,
1988+ ) (XAutoClaimResponse , error ) {
1989+ args := []string {key , group , consumer , utils .IntToString (minIdleTime ), start }
1990+ if options != nil {
1991+ optArgs , err := options .ToArgs ()
1992+ if err != nil {
1993+ return XAutoClaimResponse {}, err
1994+ }
1995+ args = append (args , optArgs ... )
1996+ }
1997+ result , err := client .executeCommand (C .XAutoClaim , args )
1998+ if err != nil {
1999+ return XAutoClaimResponse {}, err
2000+ }
2001+ return handleXAutoClaimResponse (result )
2002+ }
2003+
2004+ // Transfers ownership of pending stream entries that match the specified criteria.
2005+ //
2006+ // Since:
2007+ //
2008+ // Valkey 6.2.0 and above.
2009+ //
2010+ // See [valkey.io] for more details.
2011+ //
2012+ // Parameters:
2013+ //
2014+ // key - The key of the stream.
2015+ // group - The consumer group name.
2016+ // consumer - The group consumer.
2017+ // minIdleTime - The minimum idle time for the message to be claimed.
2018+ // start - Filters the claimed entries to those that have an ID equal or greater than the specified value.
2019+ //
2020+ // Return value:
2021+ //
2022+ // An object containing the following elements:
2023+ // - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
2024+ // equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if
2025+ // the entire stream was scanned.
2026+ // - An array of IDs for the claimed entries.
2027+ // - If you are using Valkey 7.0.0 or above, the response will also include an array containing
2028+ // the message IDs that were in the Pending Entries List but no longer exist in the stream.
2029+ // These IDs are deleted from the Pending Entries List.
2030+ //
2031+ // Example:
2032+ //
2033+ // result, err := client.XAutoClaimJustId("myStream", "myGroup", "myConsumer", 42, "0-0")
2034+ // result:
2035+ // // &{
2036+ // // "1609338788321-0" // value to be used as `start` argument for the next `xautoclaim` call
2037+ // // [
2038+ // // "1609338752495-0", // claimed entries
2039+ // // "1609338752495-1"
2040+ // // ]
2041+ // // [
2042+ // // "1594324506465-0", // array of IDs of deleted messages,
2043+ // // "1594568784150-0" // included in the response only on valkey 7.0.0 and above
2044+ // // ]
2045+ // // }
2046+ //
2047+ // [valkey.io]: https://valkey.io/commands/xautoclaim/
2048+ func (client * baseClient ) XAutoClaimJustId (
2049+ key string ,
2050+ group string ,
2051+ consumer string ,
2052+ minIdleTime int64 ,
2053+ start string ,
2054+ ) (XAutoClaimJustIdResponse , error ) {
2055+ return client .XAutoClaimJustIdWithOptions (key , group , consumer , minIdleTime , start , nil )
2056+ }
2057+
2058+ // Transfers ownership of pending stream entries that match the specified criteria.
2059+ //
2060+ // Since:
2061+ //
2062+ // Valkey 6.2.0 and above.
2063+ //
2064+ // See [valkey.io] for more details.
2065+ //
2066+ // Parameters:
2067+ //
2068+ // key - The key of the stream.
2069+ // group - The consumer group name.
2070+ // consumer - The group consumer.
2071+ // minIdleTime - The minimum idle time for the message to be claimed.
2072+ // start - Filters the claimed entries to those that have an ID equal or greater than the specified value.
2073+ // options - Options detailing how to read the stream.
2074+ //
2075+ // Return value:
2076+ //
2077+ // An object containing the following elements:
2078+ // - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
2079+ // equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if
2080+ // the entire stream was scanned.
2081+ // - An array of IDs for the claimed entries.
2082+ // - If you are using Valkey 7.0.0 or above, the response will also include an array containing
2083+ // the message IDs that were in the Pending Entries List but no longer exist in the stream.
2084+ // These IDs are deleted from the Pending Entries List.
2085+ //
2086+ // Example:
2087+ //
2088+ // opts := options.NewXAutoClaimOptionsWithCount(1)
2089+ // result, err := client.XAutoClaimJustIdWithOptions("myStream", "myGroup", "myConsumer", 42, "0-0", opts)
2090+ // result:
2091+ // // &{
2092+ // // "1609338788321-0" // value to be used as `start` argument for the next `xautoclaim` call
2093+ // // [
2094+ // // "1609338752495-0", // claimed entries
2095+ // // "1609338752495-1"
2096+ // // ]
2097+ // // [
2098+ // // "1594324506465-0", // array of IDs of deleted messages,
2099+ // // "1594568784150-0" // included in the response only on valkey 7.0.0 and above
2100+ // // ]
2101+ // // }
2102+ //
2103+ // [valkey.io]: https://valkey.io/commands/xautoclaim/
2104+ func (client * baseClient ) XAutoClaimJustIdWithOptions (
2105+ key string ,
2106+ group string ,
2107+ consumer string ,
2108+ minIdleTime int64 ,
2109+ start string ,
2110+ options * options.XAutoClaimOptions ,
2111+ ) (XAutoClaimJustIdResponse , error ) {
2112+ args := []string {key , group , consumer , utils .IntToString (minIdleTime ), start }
2113+ if options != nil {
2114+ optArgs , err := options .ToArgs ()
2115+ if err != nil {
2116+ return XAutoClaimJustIdResponse {}, err
2117+ }
2118+ args = append (args , optArgs ... )
2119+ }
2120+ args = append (args , "JUSTID" )
2121+ result , err := client .executeCommand (C .XAutoClaim , args )
2122+ if err != nil {
2123+ return XAutoClaimJustIdResponse {}, err
2124+ }
2125+ return handleXAutoClaimJustIdResponse (result )
2126+ }
2127+
18772128// Removes the specified entries by id from a stream, and returns the number of entries deleted.
18782129//
18792130// See [valkey.io] for details.
@@ -2242,3 +2493,98 @@ func (client *baseClient) XGroupSetIdWithOptions(
22422493 }
22432494 return handleStringResponse (result )
22442495}
2496+
2497+ // Removes all elements in the sorted set stored at `key` with a lexicographical order
2498+ // between `rangeQuery.Start` and `rangeQuery.End`.
2499+ //
2500+ // See [valkey.io] for details.
2501+ //
2502+ // Parameters:
2503+ //
2504+ // key - The key of the sorted set.
2505+ // rangeQuery - The range query object representing the minimum and maximum bound of the lexicographical range.
2506+ // can be an implementation of [options.LexBoundary].
2507+ //
2508+ // Return value:
2509+ //
2510+ // The number of members removed from the sorted set.
2511+ // If `key` does not exist, it is treated as an empty sorted set, and the command returns `0`.
2512+ // If `rangeQuery.Start` is greater than `rangeQuery.End`, `0` is returned.
2513+ //
2514+ // Example:
2515+ //
2516+ // zRemRangeByLexResult, err := client.ZRemRangeByLex("key1", options.NewRangeByLexQuery("a", "b"))
2517+ // fmt.Println(zRemRangeByLexResult) // Output: 1
2518+ //
2519+ // [valkey.io]: https://valkey.io/commands/zremrangebylex/
2520+ func (client * baseClient ) ZRemRangeByLex (key string , rangeQuery options.RangeByLex ) (int64 , error ) {
2521+ result , err := client .executeCommand (
2522+ C .ZRemRangeByLex , append ([]string {key }, rangeQuery .ToArgsRemRange ()... ))
2523+ if err != nil {
2524+ return defaultIntResponse , err
2525+ }
2526+ return handleIntResponse (result )
2527+ }
2528+
2529+ // Removes all elements in the sorted set stored at `key` with a rank between `start` and `stop`.
2530+ //
2531+ // See [valkey.io] for details.
2532+ //
2533+ // Parameters:
2534+ //
2535+ // key - The key of the sorted set.
2536+ // start - The start rank.
2537+ // stop - The stop rank.
2538+ //
2539+ // Return value:
2540+ //
2541+ // The number of members removed from the sorted set.
2542+ // If `key` does not exist, it is treated as an empty sorted set, and the command returns `0`.
2543+ // If `start` is greater than `stop`, `0` is returned.
2544+ //
2545+ // Example:
2546+ //
2547+ // zRemRangeByRankResult, err := client.ZRemRangeByRank("key1", 0, 1)
2548+ // fmt.Println(zRemRangeByRankResult) // Output: 1
2549+ //
2550+ // [valkey.io]: https://valkey.io/commands/zremrangebyrank/
2551+ func (client * baseClient ) ZRemRangeByRank (key string , start int64 , stop int64 ) (int64 , error ) {
2552+ result , err := client .executeCommand (C .ZRemRangeByRank , []string {key , utils .IntToString (start ), utils .IntToString (stop )})
2553+ if err != nil {
2554+ return 0 , err
2555+ }
2556+ return handleIntResponse (result )
2557+ }
2558+
2559+ // Removes all elements in the sorted set stored at `key` with a score between `rangeQuery.Start` and `rangeQuery.End`.
2560+ //
2561+ // See [valkey.io] for details.
2562+ //
2563+ // Parameters:
2564+ //
2565+ // key - The key of the sorted set.
2566+ // rangeQuery - The range query object representing the minimum and maximum bound of the score range.
2567+ // can be an implementation of [options.RangeByScore].
2568+ //
2569+ // Return value:
2570+ //
2571+ // The number of members removed from the sorted set.
2572+ // If `key` does not exist, it is treated as an empty sorted set, and the command returns `0`.
2573+ // If `rangeQuery.Start` is greater than `rangeQuery.End`, `0` is returned.
2574+ //
2575+ // Example:
2576+ //
2577+ // zRemRangeByScoreResult, err := client.ZRemRangeByScore("key1", options.NewRangeByScoreBuilder(
2578+ // options.NewInfiniteScoreBoundary(options.NegativeInfinity),
2579+ // options.NewInfiniteScoreBoundary(options.PositiveInfinity),
2580+ // ))
2581+ // fmt.Println(zRemRangeByScoreResult) // Output: 1
2582+ //
2583+ // [valkey.io]: https://valkey.io/commands/zremrangebyscore/
2584+ func (client * baseClient ) ZRemRangeByScore (key string , rangeQuery options.RangeByScore ) (int64 , error ) {
2585+ result , err := client .executeCommand (C .ZRemRangeByScore , append ([]string {key }, rangeQuery .ToArgsRemRange ()... ))
2586+ if err != nil {
2587+ return 0 , err
2588+ }
2589+ return handleIntResponse (result )
2590+ }
0 commit comments