Struct data type
A STRUCT is a composite data type that allows you to group multiple fields of different types into a single unit. Each field in a struct has a name and can hold a value of any supported data type, including other structs.
Type Constraints
- Field names must be strings
- Field values can be of any valid Flavius data type
- Structs can be nested to create complex data structures
- Field names must be unique within the same struct
Create struct
Structs are defined using curly braces {}
with field-value pairs separated by
commas. Field names are followed by a colon and their corresponding values:
{field1: value1, field2: value2, ...}
Struct literals
-- Basic struct
RETURN {name: "John", age: 30, active: true} AS person
-- Nested struct
RETURN {
user: {name: "John", age: 30},
address: {city: "San Francisco", country: "USA"}
} AS userProfile
Struct operations
Accessing Fields
You can access struct fields using dot notation:
WITH {name: "John", age: 30} AS person
RETURN person.name, person.age
Last updated on