Create Keys And Values
The kv
and pkv
objects serve as the foundational building blocks for constructing data2d
and data3d structures. To ensure the integrity of data structure and maintain proper data organization, it is strongly recommended
to exclusively employ the helper methods kv()
and pkv()
for initializing these essential
core objects.
val
kv
objects are created.The val object serves as the foundational element for value storage in both the data2d and data3d structures. Both objects rely on the val object type to determine and store the underlying value's data type accurately. The val object encompasses the following properties:
Properties
- Name
stringValue
- Type
- string
- Description
A string value. Also, color values are converted and stored as string values. Optional. The default is na.
- Name
floatValue
- Type
- float
- Description
A float value. Optional. The default is na.
- Name
intValue
- Type
- int
- Description
An integer value. Both regular integer values as well as unix timestamp values (milliseconds), are stored as integer values. Optional. The default is na.
- Name
boolValue
- Type
- bool
- Description
A boolean value. Optional. The default is na.
kv
kv()
method to create kv objects.The kv object is the core of key-value pair. It creates the link between a key and its value, a val object. The kv object has the following properties:
Properties
- Name
key
- Type
- string
- Description
The key identifier.
- Name
val
- Type
- val
- Description
A value represented by the val object. Must contain one of the val properties: val.stringValue, val.floatValue, val.intValue, or val.boolValue.
- Name
altVal
- Type
- val
- Description
An alternate value represented by the val object. Must contain one of the val properties: val.stringValue, val.floatValue, val.intValue, or val.boolValue. Optional. The default is na.
- Name
format
- Type
- string
- Description
A custom string format for the val object. Optional. The default is na.
- Name
dataType
- Type
- string
- Description
The data type for the value. Possible values are string, float, int, bool, color, and timestamp.
- Name
value
- Type
- string
- Description
The string version of the original value. Optional. The default is na.
- Name
altValue
- Type
- string
- Description
The string version of the alternate value. Optional. The default is na.
- Name
formatValue
- Type
- string
- Description
The formatted version of the original value. If no format is available, just uses string version. Optional. The default is na.
- Name
formatAltValue
- Type
- string
- Description
The formatted version of the alternate value. If no format is available, just uses string version. Optional. The default is na.
- Name
timezone
- Type
- string
- Description
A custom timezone for the value. Applies only for timestamp data types. Optional. The default is na.
- Name
_tz
- Type
- bool
- Description
An internal switch to determine if custom timezone is set for this object. Optional. The default is false.
pkv
pkv()
method to create pkv objects.The pkv object is the core of grouped key-value pairs identified with a primary key. It creates the link between a primary key and its group of key-value pairs, which are essentially an array of kv objects. The pkv object has the following properties:
Properties
- Name
primaryKey
- Type
- string
- Description
The primary key identifier.
- Name
dataKeys
- Type
- array<string>
- Description
An array of data key identifiers.
- Name
dataKeyTypes
- Type
- array<string>
- Description
An array of data types asscociated with the object's data keys.
- Name
kvs
- Type
- array<kv>
- Description
An array of kv objects. They must adhere to this objects data keys and data key types.
kv()
The kv() method is utilized to construct a kv
object, which is the preferred approach for generating
kv
object. This method systematically constructs the kv
object, ensuring that
all of its properties are properly satisfied.
- Name
this
- Type
- string
- Description
A string object, representing a unique key identifier.
- Name
val
- Type
- object
- Description
Any object of data type string, float, integer (including Unix timestamp), boolean and color.
- Name
altVal
- Type
- object
- Description
Any object of data type string, float, integer (including Unix timestamp), boolean and color. Optional. The default is na.
- Name
timestamp
- Type
- bool
- Description
A boolean flag to indicate if the integer value is of timestamp data type. Use true for timestamp values. This parameter is only available with integer values (includes timestamps); for all other cases, not available. Optional. The default is na.
- Name
timezone
- Type
- string
- Description
A string representing timezone in UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). This parameter is only available with integer values (includes timestamps); for all other cases, not available. Optional. The default is na.
- Name
format
- Type
- string
- Description
A string format. Optional. The default is na.
- Name
returns
- Type
- kv
- Description
A kv object.
alt()
Set alternate value for a kv
object.
- Name
this
- Type
- kv
- Description
A kv object.
- Name
altVal
- Type
- object
- Description
An object of type string, float, integer (including Unix timestamp), boolean, or color. It must match the data type of the kv object.
- Name
returns
- Type
- kv
- Description
This kv object.
pkv()
The pkv() method is utilized to construct a pkv
object, which is the preferred approach for generating
pkv
object. This method systematically constructs the pkv
object, ensuring that
all of its properties are properly satisfied.
- Name
this
- Type
- string
- Description
A string object, representing a unique primary key identifier.
- Name
kvs
- Type
- array<kv>
- Description
An array of
kv
objects.
- Name
returns
- Type
- pkv
- Description
A
pkv
object.