(十四)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中的定义如下: