(十四)eos開發實戰dapp+遊戲--智慧合約之資料庫multi_index多key
開言:此教材只是個人學習過程記錄自己理解和各種坑如有問題可提出修正,個人注重是開發動手,小白,寫也是為了重複加深印象,目標此教學習實現開發一個EOS小遊戲,堅持.......
環境: Mac+EOS-1.3.0
任務:multi_index多key
multi_index</*<-資料表名稱*/, ,/*<-資料物件型別*/
/*設定索引->*/indexed_by< N(查詢名), const_mem_fun</*<-資料物件型別*/, 型別, &/*<-資料物件型別*/::方法名const方法> >
後續:
end & cend
返回指向虛擬行的迭代器,代表剛剛過去的最後一行,不能被間接引用;
可以向後推進,不能向前推進。
const_iterator end() const
const_iterator end() const
rbegin & crbegin
返回和begin/cbegin類似的,但反向的迭代器
const_iterator rbegin() const
const_iterator crbegin() const
rend & crend
返回和end/cend類似的,但反向的迭代器
const_iterator rend() const
const_iterator crend() const
lower_bound
查詢大於等於給定主鍵值的物件
const_iterator lower_bound( uint64_t primary ) const
upper_bound
查詢大於給定主鍵值的物件
const_iterator upper_bound( uint64_t primary ) const
get_index
返回一個適當型別的二級索引
secondary_index get_index<IndexName>()
secondary_index get_index<IndexName>() const
iterator_to
返回給定物件的迭代器
const_iterator iterator_to( const object_type& obj ) const
indexed_by
indexed_by結構體用於例項化multi_index表的索引
indexed_by在multi_index.hpp中的定義如下: