-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: TJ Zhang <[email protected]>
- Loading branch information
TJ Zhang
committed
Jan 14, 2025
1 parent
15c4636
commit 38d5844
Showing
5 changed files
with
292 additions
and
0 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
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,43 @@ | ||
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 | ||
|
||
package options | ||
|
||
// This struct represents the optional arguments for the ZSCAN command. | ||
type ZScanOptions struct { | ||
BaseScanOptions | ||
noScores bool | ||
} | ||
|
||
func NewZScanOptionsBuilder() *ZScanOptions { | ||
return &ZScanOptions{} | ||
} | ||
|
||
/* | ||
If this value is set to true, the ZSCAN command will be called with NOSCORES option. | ||
In the NOSCORES option, scores are not included in the response. | ||
*/ | ||
func (zScanOptions *ZScanOptions) SetNoScores(noScores bool) *ZScanOptions { | ||
zScanOptions.noScores = noScores | ||
return zScanOptions | ||
} | ||
|
||
func (zScanOptions *ZScanOptions) SetMatch(match string) *ZScanOptions { | ||
zScanOptions.BaseScanOptions.SetMatch(match) | ||
return zScanOptions | ||
} | ||
|
||
func (zScanOptions *ZScanOptions) SetCount(count int64) *ZScanOptions { | ||
zScanOptions.BaseScanOptions.SetCount(count) | ||
return zScanOptions | ||
} | ||
|
||
func (options *ZScanOptions) ToArgs() ([]string, error) { | ||
args := []string{} | ||
baseArgs, err := options.BaseScanOptions.ToArgs() | ||
args = append(args, baseArgs...) | ||
|
||
if options.noScores { | ||
args = append(args, NoScores) | ||
} | ||
return args, err | ||
} |
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