I have a table defined as the following:
struct [[ eosio::table, eosio::contract("voting") ]] identity
{
uint64_t key;
key256 identityHash;
time_point_sec createdAt;
uint64_t primary_key() const { return key; }
key256 by_hash() const { return identityHash; }
};
typedef multi_index<"identity"_n, identity,
indexed_by< "by_hash"_n, const_mem_fun<identity, key256, &identity::by_hash> >
> identity_index;
I now want to use .find
on the table using the secondary index but I am unable to do so. I am trying the following:
voting::identity_index identities(_self, _self.value);
auto itr = identities.find(out);
eosio_assert(itr == identities.end(), "User already registered to vote!");
But the above code just searches on the primary key. Is there a way to search on the secondary key?