forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed count to options, fixed small parts of the code
Signed-off-by: Edward Liang <[email protected]>
- Loading branch information
Showing
5 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 | ||
|
||
package options | ||
|
||
import ( | ||
"github.com/valkey-io/valkey-glide/go/glide/utils" | ||
) | ||
|
||
// Optional arguments for `ZMPop` and `BZMPop` in [SortedSetCommands] | ||
type ZMPopOptions struct { | ||
count int64 | ||
countIsSet bool | ||
} | ||
|
||
func NewZMPopOptions() *ZMPopOptions { | ||
return &ZMPopOptions{} | ||
} | ||
|
||
// Set the count. | ||
func (zmpo *ZMPopOptions) SetCount(count int64) *ZMPopOptions { | ||
zmpo.count = count | ||
zmpo.countIsSet = true | ||
return zmpo | ||
} | ||
|
||
func (zmpo *ZMPopOptions) ToArgs() ([]string, error) { | ||
var args []string | ||
|
||
if zmpo.countIsSet { | ||
args = append(args, "COUNT", utils.IntToString(zmpo.count)) | ||
} | ||
|
||
return args, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters