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

Support composite keys on secondary indexes (multi-index) #163

Closed
ethanfrey opened this issue Dec 9, 2020 · 0 comments · Fixed by #211
Closed

Support composite keys on secondary indexes (multi-index) #163

ethanfrey opened this issue Dec 9, 2020 · 0 comments · Fixed by #211
Assignees

Comments

@ethanfrey
Copy link
Member

Right now, keys is always Vec<u8>.

If I combine say (status, height) as one vector, I can not easily search over all heights for a given status (which I can on primary indices). This is due to combining them, then length-prefixing.

If we return say (U8Key, U64Key), then we could get a prefix on the first key (status) and range within it, just like on Map.

This example was the first time I came across this need (which I hacked by knowing the internals of storage-plus), but we will want this in the future as well as app complexity grow: https://github.com/CosmWasm/cosmwasm-plus/blob/7975aef08a8d44444742d7dc187d341f839a6039/contracts/cw3-flex-multisig/src/state.rs#L53-L83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants