Create Struct
Creating a struct type allows you to define a custom type that groups multiple fields together,
making it easier to organize related data and return structured results.
Configuration
To create a struct type, define its shape by specifying fields with their types.
You can also provide an optional JSON tag for each field.
Add the Create Struct
function
Define the name of the struct
Tap on Add New Field to add fields to your struct
Initialize the Struct
Once the struct type is created, you can create an instance using the Initiate Struct function.
You can optionally pre-fill it with values from existing variables.
Select the struct type
(Optional) Pass existing variables to auto-fill each field
For all types (except pointer types), zero values will be used by default.
For example, an empty string for string
, or 0
for int
.
Once the struct is created, you can:
- Access and read values from its fields
- Update individual fields
- Return the entire struct as a response