Skip to content

Add ScanType command to Scan with 'type' option #1595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2021
Merged

Add ScanType command to Scan with 'type' option #1595

merged 1 commit into from
Jan 9, 2021

Conversation

forain
Copy link
Contributor

@forain forain commented Jan 8, 2021

As of version 6.0 you can use this 'type' option to ask SCAN to only
return objects that match a given type, allowing you to
iterate through the database looking for keys of a specific type.

@rbg
Copy link
Contributor

rbg commented Jan 8, 2021

would it be more friendly to perhaps add a TScan command ?

@forain
Copy link
Contributor Author

forain commented Jan 8, 2021

would it be more friendly to perhaps add a TScan command ?

Good idea! Is "TScan" the best name for it? We already have SScan for REDIS sscan command and HScan for REDIS hscan command. Having TScan for REDIS "scan command with type option", I'm afraid it might cause confusion.

@rbg
Copy link
Contributor

rbg commented Jan 8, 2021

yeah -- TScan was just a suggestion, @vmihailenco i am sure will have a great suggestion :)

@rbg
Copy link
Contributor

rbg commented Jan 8, 2021

your change as it stands breaks the build so will need some lov; which is why i was suggesting an alternative command..

@forain
Copy link
Contributor Author

forain commented Jan 8, 2021

your change as it stands breaks the build so will need some lov; which is why i was suggesting an alternative command..

Fixed the build by updating tests accordingly. Let's wait for @vmihailenco to check if it'd be better to add it to existing Scan as I did or to create a new function with a different name (TScan? TypeScan? ScanWithType?).

As of version 6.0 you can use this 'type' option to ask SCAN to only
return objects that match a given type, allowing you to
iterate through the database looking for keys of a specific type.
@forain forain changed the title Add key 'type' option to Scan command Add ScanType command to Scan with 'type' option Jan 9, 2021
@forain
Copy link
Contributor Author

forain commented Jan 9, 2021

@rbg @vmihailenco I followed your instructions and reimplemented it as a new "ScanType" command. Also added command and example tests. Build tests passed. Let me know if I missed something!

@vmihailenco
Copy link
Collaborator

👍 thanks

@vmihailenco vmihailenco merged commit 8f37eeb into redis:master Jan 9, 2021
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.

3 participants