Use big-endian utility function fromencoding/binary to store the type scaffolding from its ID so that these are stored in the correct order inside the IAVL
Example with proposal here: https://github.com/cosmos/cosmos-sdk/blob/master/x/gov/keeper/proposal.go
We can also use uint64 instead of string for the id type id depends how convenient it is for the developer