Skip to content
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

[Feature]: Add RefKeys() method to collections MultiIterator #21091

Open
oren-lava opened this issue Jul 26, 2024 · 3 comments · May be fixed by #21496
Open

[Feature]: Add RefKeys() method to collections MultiIterator #21091

oren-lava opened this issue Jul 26, 2024 · 3 comments · May be fixed by #21496

Comments

@oren-lava
Copy link
Contributor

Summary

Add a RefKeys() method to collections MultiIterator to allow iteration over reference keys without explicitly knowing their value.

Problem Definition

Assume that an indexed map is created for BaseAccount as described in the Cosmos docs.
Now, instead of using an account number as a unique index, we use a multi index which is the origin country of the account.

Normally, many account can share an origin country so the multi index fits perfectly. Now, assume I wish to perform some processing on accounts that share the same country index. Since it's no an integer index, there is no clear set of strings that I can iterate over to check which countries exist in my collection.

If there was a method for a MultiIterator to fetch all the existing reference keys, I could iterate over them, use the MatchExact method and get all the account of a specific country.

Proposed Feature

I propose adding a method called RefKeys() to MultiIterator that will have an almost identical implementation of the PrimaryKeys() method but instead will return a list of the reference keys.

@oren-lava
Copy link
Contributor Author

Hi @JulianToledano,
Are you working on this? I'll gladly take this on me :)

@JulianToledano
Copy link
Contributor

Hi @JulianToledano, Are you working on this? I'll gladly take this on me :)

sure thing, go ahead!! 👍

@oren-lava
Copy link
Contributor Author

oren-lava commented Sep 1, 2024

Done working on it. Eager to see your review @JulianToledano :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

3 participants