Secondary Indices
Step 1: Remove existing data from table
cleos push action addressbook erase '["alice"]' -p alice@activecleos push action addressbook erase '["bob"]' -p bob@activeStep 2: Add new index member and getter
uint64_t age;
uint64_t get_secondary_1() const { return age;}Step 3: Add secondary index to addresses table configuration
addresses table configurationusing address_index = eosio::multi_index<"people"_n, person,
indexed_by<"byage"_n, const_mem_fun<person, uint64_t, &person::get_secondary_1>>
>;Step 4: Modify code
Step 5: Compile and Deploy
Step 6: Test it
Wrapping Up
What's Next?
Last updated