struct arisen::indexed_by

Public Types




index_name { index_name = static_cast<uint64_t>(IndexName) }

typedef Extractor


Detailed Description

The indexed_by struct is used to instantiate the indices for the Multi-Index table. In ARISEN, up to 16 secondary indices can be specified.

IndexName - is the name of the index. The name must be provided as an ARISEN base32 encoded 64-bit integer and must conform to the ARISEN naming requirements of a maximum of 13 characters, the first twelve from the lowercase characters a-z, digits 1-5, and ".", and if there is a 13th character, it is restricted to lowercase characters a-p and ".".

Extractor - is a function call operator that takes a const reference to the table object type and returns either a secondary key type or a reference to a secondary key type. It is recommended to use the template, which is a type alias to the boost::multi_index::const_mem_fun. See the documentation for the Boost key extractor for more details.


#include <arisenlib/arisen.hpp>
using namespace arisen;
class mycontract: arisen::contract {
  struct record {
     uint64_t    primary;
     uint128_t   secondary;
     uint64_t primary_key() const { return primary; }
     uint128_t get_secondary() const { return secondary; }
    mycontract(name receiver, name code, datastream<const char*> ds):contract(receiver, code, ds){}
    void myaction() {
      auto code = _self;
      auto scope = _self;
      multi_index<"mytable"_n, record,
                 indexed_by< "bysecondary"_n, const_mem_fun<record, uint128_t, &record::get_secondary> > > table( code, scope);
EOSIO_DISPATCH( mycontract, (myaction) )

Public Types Documentation

enum constants

enum arisen::indexed_by::constants {
    index_name = static_cast<uint64_t>(IndexName),

typedef secondary_extractor_type

typedef Extractor eosio::indexed_by< IndexName, Extractor >::secondary_extractor_type;