TutorialLevel
State Variables
_tableId
ResourceId constant _tableId = ResourceId.wrap(0x746200000000000000000000000000005475746f7269616c4c6576656c000000);
_fieldLayout
FieldLayout constant _fieldLayout = FieldLayout.wrap(0x0004010004000000000000000000000000000000000000000000000000000000);
_keySchema
Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000);
_valueSchema
Schema constant _valueSchema = Schema.wrap(0x0004010003000000000000000000000000000000000000000000000000000000);
Functions
getKeyNames
Get the table's key field names.
function getKeyNames() internal pure returns (string[] memory keyNames);
Returns
Name | Type | Description |
---|---|---|
keyNames | string[] | An array of strings with the names of key fields. |
getFieldNames
Get the table's value field names.
function getFieldNames() internal pure returns (string[] memory fieldNames);
Returns
Name | Type | Description |
---|---|---|
fieldNames | string[] | An array of strings with the names of value fields. |
register
Register the table with its config.
function register() internal;
_register
Register the table with its config.
function _register() internal;
getValue
Get value.
function getValue(bytes32 id) internal view returns (uint32 value);
_getValue
Get value.
function _getValue(bytes32 id) internal view returns (uint32 value);
get
Get value.
function get(bytes32 id) internal view returns (uint32 value);
_get
Get value.
function _get(bytes32 id) internal view returns (uint32 value);
setValue
Set value.
function setValue(bytes32 id, uint32 value) internal;
_setValue
Set value.
function _setValue(bytes32 id, uint32 value) internal;
set
Set value.
function set(bytes32 id, uint32 value) internal;
_set
Set value.
function _set(bytes32 id, uint32 value) internal;
deleteRecord
Delete all data for given keys.
function deleteRecord(bytes32 id) internal;
_deleteRecord
Delete all data for given keys.
function _deleteRecord(bytes32 id) internal;
encodeStatic
Tightly pack static (fixed length) data using this table's schema.
function encodeStatic(uint32 value) internal pure returns (bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The static data, encoded into a sequence of bytes. |
encode
Encode all of a record's fields.
function encode(uint32 value) internal pure returns (bytes memory, EncodedLengths, bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The static (fixed length) data, encoded into a sequence of bytes. |
<none> | EncodedLengths | The lengths of the dynamic fields (packed into a single bytes32 value). |
<none> | bytes | The dynamic (variable length) data, encoded into a sequence of bytes. |
encodeKeyTuple
Encode keys as a bytes32 array using this table's field layout.
function encodeKeyTuple(bytes32 id) internal pure returns (bytes32[] memory);