Data Entities

Introduction

Data Entities are an umbrella term for simple or complex variables to be used in a Contract and its Functions. When defined in the leftbar, data entities are global, meaning that they can be accessed (and modified) by any of the contract's functions.

Configuration

Define the Name of this Data Entity. A data entity's name is used to name and differentiate data entities. It is advised that the name be specific and descriptive enough to be able to infer the data entity's purpose and distinguish it from other data entities. Furthermore, the name will be utilized in the code as keyword to name the data entity.

Select a Data Entity Type among all available types in Solidity. This selection will specialize the data entity so to access the dedicated properties. Then you can define the storage location of a Data Entity. This will affect how (and whether) the Data Entity is stored in the contract's storage.

Type Settings

  • Simple: A Simple Data Entity is a data type suitable to hold simple types such as numbers, booleans, and strings. A Simple Data Entity's State defines whether the Data Entity's state can be modified after it is assigned a value. Constant variables can never be changed after compilation, while immutable variables can be set within a constructor. A Simple Data Entity's Subtype defines the type of data that the data entity is storing.

  • Array: The Array Type determines what type of Data Entities are stored in the array. Arrays can hold only a single type of data entity.

  • Struct: A Struct Data Entity is a type of data structure that allows different data types to be combined. A struct's name designates the subsets of variables it contains after the data types have been grouped into it. Once defined and instanced, any of the struct's data types can be both assigned a value or accessed.

  1. Select an existing Struct (this is used when you want to instance a Struct following an already defined one).

  2. Create a new Property (this is used to define Structs)

  • Array of Structs: Select an already defined Struct Data Entity for this Array.

  • Enum: An Enum values define a set of predefined constants that can be used for several purposes, such as checking whether a variable name is among them.

  • Mapping: A Data Entity Mapping is use to create a Solidity mapping. In Solidity, mappings function similarly to a dictionary or hash table in another language. These are used to store data in the form of key-value pairs, with the value being able to be of any type and the key being any of the built-in data types, but reference types (i.e. Structs, Arrays) are not permitted to be used as keys.

  1. Define the Type for the Mapping's Key

  2. Define the Type for the Mapping's Value

  3. Select an existing Mapping (this is used when you want to instance a Mapping following an already defined one)

  • Mapping of Structs: A Mapping of Structs is use to create a Solidity mapping where the mapping's values are structs. In Solidity, mappings function similarly to a dictionary or hash table in another language. These are used to store data in the form of key-value pairs, with the value being able to be of any type and the key being any of the built-in data types, but reference types (i.e. structs, arrays) are not permitted to be used as keys.

  1. Define the Mapping's Key type

  2. Define the Struct used as Mapping Value

  3. Select an existing Mapping of Structs (this is used when you want to instance a Mapping following an already defined one)

  • Free Input: A Free Input Data Entity is used to create a Data Entity with a custom value.

  1. The Type determines the type of data for this Free Input Data Entity. Naturally, this will also affect the kind of custom value that can be assigned to the data entity.

  2. This field defines the custom value that is assigned to this Free Input Data Entity.

  • Pointer: Data Entity Pointer is used to point to structure's property or to a mapping property.

  • Array of Pointers: (coming soon)

Last updated