Data Types
In Databraid, nodes work with various data types to process, manipulate, and transmit information within a braid. Understanding the different data types and their characteristics is crucial for creating effective and efficient braids.
Primitive Data Types
Databraid supports several primitive data types, which are the most basic and fundamental types of data. These include:
-
Number: Represents numeric values, both integers and floating-point numbers. Numbers are used for mathematical calculations, comparisons, and other quantitative operations.
-
String: Represents textual data, a sequence of characters. Strings are used for storing and manipulating text-based information, such as names, labels, or descriptions.
-
Boolean: Represents a logical value of either true or false. Booleans are used for conditional statements, flags, and binary decisions within a braid.
Composite Data Types
In addition to primitive data types, Databraid also supports composite data types, which are more complex and can contain multiple values or elements. The main composite data types in Databraid are:
-
Array: Represents an ordered collection of values, where each value can be of any data type. Arrays are used for storing and manipulating lists of data, such as a series of numbers or a collection of strings.
-
Object: Represents a collection of key-value pairs, where each key is a string, and the corresponding value can be of any data type. Objects are used for storing structured data, such as properties of an entity or configuration settings.
Special Data Types
Databraid also provides special data types that are specific to certain domains or use cases. These include:
-
Color: Represents a color value, typically expressed as a combination of red, green, and blue (RGB) components or other color models like HSL or HSV. Color data types are used in graphics and visualization nodes.
-
Image: Represents an image file or a matrix of pixel values. Image data types are used in nodes that deal with image processing, manipulation, and display.
-
Audio: Represents an audio signal or a buffer of audio samples. Audio data types are used in nodes that handle audio processing, analysis, and synthesis.
-
Video: Represents a video file or a sequence of video frames. Video data types are used in nodes that work with video playback, processing, and manipulation.
Type Conversion
Databraid provides nodes that allow for the conversion between different data types. These type conversion nodes ensure that data can be seamlessly passed between nodes that expect different types. Some common type conversion nodes include:
- Number to String: Converts a numeric value to its string representation.
- String to Number: Parses a string and converts it to a numeric value, if possible.
- Boolean to Number: Converts a boolean value to a numeric representation, typically 0 for false and 1 for true.
- Array to String: Converts an array to a string representation, often by joining the elements with a specified separator.
- Object to String: Converts an object to a string representation, such as JSON.
Type conversion nodes are essential for ensuring compatibility between nodes and allowing data to flow smoothly within a braid. They provide flexibility in handling different data types and enable the integration of nodes that operate on different types of data.
By understanding the available data types and utilizing type conversion nodes when necessary, you can create braids that effectively process and manipulate data, ensuring that the right type of data is passed between nodes and that the desired operations are performed correctly.
Remember to refer to the specific documentation of each node to understand the expected input and output data types and any additional considerations or limitations when working with different types of data in Databraid.