多索引表 (5)创建多索引表
1. 创建表
- class/struct 定义一个持久化对象。
- 该对象需要有一个const的成员作为主键,类型为uint64_t
- 二级主键可选,提供不同的键类型
- 为每个二级索引定义一个键导出器,键导出器是一个函数,可以用来从Multi_index表中获取键
multi_index_example.hpp
#include <eosio/eosio.hpp>
using namespace eosio;// multi index example contract class
class [[eosio::contract]] multi_index_example : public contract {public:using contract::contract;// contract class constructormulti_index_example( name receiver, name code, datastream<const char*> ds ) :// contract base class contructorcontract(receiver, code, ds),// instantiate multi index instance as data member (find it defined below)testtab(receiver, receiver.value){ }// the row structure of the multi index table, that is, each row of the table// will contain an instance of this type of structurestruct [[eosio::table]] test_table {// this field stores a name for each row of the multi index tablename test_primary;// additional data stored in table rowuint64_t datum;// mandatory definition for primary key getteruint64_t primary_key( ) const { return test_primary.value; }};// the multi index type definition, for ease of use define a type alias `test_tables`, // based on the multi_index template type, parametarized with a random name and // the test_table data structuretypedef eosio::multi_index<"testtaba"_n, test_table> test_tables;// the multi index table instance declared as a data member of type test_tablestest_tables testtab;[[eosio::action]] void set( name user );[[eosio::action]] void print( name user );using set_action = action_wrapper<"set"_n, &multi_index_example::set>;using print_action = action_wrapper<"print"_n, &multi_index_example::print>;
};
多索引表 (5)创建多索引表相关推荐
- oracle创建新指定表空间,oracle创建表空间 创建用户指定表空间并授权
1.创建表空间 例如: (1)表空间名为myplace: (2)数据文件路径为E:\oracle\oracle_home\oradata\myspace (3)文件名为mydbf.dbf,空间大小为3 ...
- spool命令、创建一个表,创建并且copy表,查看别的用户下的表,rowid行地址 索引的时候使用,表的增删改查,删除表,oracle的回收站
1.spool 命令 spool "D:\test.txt" spool off SQL> host cls 2.创建一个表 SQL> --条件(1):有创 ...
- spool命令、创建一个表,创建而且copy表,查看别的用户下的表,rowid行地址 索引的时候使用,表的增删改查,删除表,oracle的回收站...
1.spool命令 spool "D:\test.txt" spool off SQL> host cls 2.创建一个表 SQL> --条件(1):有创建 ...
- mysql 建表时创建唯一索引
Mysql建表与索引使用规范整理 一,设计表规范: MySQL建表,字段需设置为非空,需设置字段默认值: MySQL建表,字段需NULL时,需设置字段默认值,默认值不为NULL: MySQL建表,如果 ...
- mysql索引 删除和创建_mysql索引和唯一索引的创建和删除
一.本机环境 二.索引的创建删除 三.唯一索引的创建和删除 一.本机环境 系统环境:linux centos 7.2 mysql版本:mysql-5.7.9 安装目录:/application/mys ...
- oracle实验数据库和表,1oracle创建数据库和表.doc
1oracle创建数据库和表.doc 实验一:创建数据库和表 一.实验目的 1. 掌握使用DBCA创建数据库 2. 掌握手工创建Oracle数据库的方法 3. 掌握创建数据表的方法 二.实验内容及步骤 ...
- css设置打印样式表,[CSS] 创建打印样式表
[CSS] 创建打印样式表 Chrome浏览器有一项非常好用的功能, 就是直接将网页保存为PDF(Ctrl+P), 虽然部分人觉得没有用, 但我经常使用这个功能 比如说, 有的博文写得不错, 想保存, ...
- php里建立数据库和表,PHP 创建数据库和表 | w3cschool菜鸟教程
PHP 创建数据库和表 数据库存有一个或多个表. 创建数据库 CREATE DATABASE 语句用于在 MySQL 中创建数据库. 我们必须添加 CREATE DATABASE 语句到 mysqli ...
- 大文件表空间+创建大文件表空间+查询数据库表空间类型信息+查询数据库表空间类型信息...
1用于解决存储文件大小不够的问题 2与普通表空间不同的地方在于大文件表空间只对应唯一一个数据文件或临时文件,普通表空间可最多1022个数据文件或临时文件 3大文件表空间对应文件可达4G个数据块大小,普 ...
- java 索引实现,Java创建ES索引实现
标签:public text cluster frame put elastics sea min user 1.pom.xml文件 org.springframewo ...
最新文章
- CDN和Web Cache领域相关的经典书籍推荐
- Mysqlreport总结
- 编译android系统小结
- iPhone审核条例
- [原创]RCP项目:数字图像处理软件
- 使用 C# 下载文件的十八般武艺
- scanf读取字符_在C语言中使用scanf()读取整数时跳过字符
- cuda线程束原语 __shfl_xor、__shfl、__shfl_up()、__shfl_down()
- 纸白银:交易简便成本低
- 个位数统计(java)
- 透过WebGL 3D看动画Easing函数本质
- 接口自动化测试框架搭建(5、封装get.post请求方法)--python+HTMLTestRunnerCN+request+unittest+mock+db
- Linux kernel中 __bitmap_weight函数的理解
- 【JS】每日一题:模块化
- 推荐几本javascript与jquery的好书
- 等保(公安部82号令)
- Python3 pyttsx3 文字播放
- 联想y430完全拆机图解_Y430P拆机:安装内存+清灰
- 两个关于vlan间通信的实验
- graphx-社区发现(community detection)
热门文章
- 海量数据处理:两个大文件中的相同记录
- linux多线程编写哲学家,Linux系统编程(三) ------ 多线程编程
- 2020年,数据中心的绿色技术演进与创新
- radio按扭设置只读_disabled属性样式问题
- ML之xgboost:基于xgboost(5f-CrVa)算法对HiggsBoson数据集(Kaggle竞赛)训练(模型保存+可视化)实现二分类预测
- 成功解决TypeError: a bytes-like object is required, not 'str'
- Py之xlwt:python库之xlwt的简介、安装、使用方法之详细攻略
- HaoheDI让ETL变得简单
- SylixOS 系统初探
- concurrent (二)AQS