String types¶
The string type is declared with the keyword STRING and is used to store a sequence of characters.
Length limits¶
GQL imposes different length limits on strings depending on the context:
- Property strings: Strings stored as node or edge properties are limited to 65,535 bytes.
- Runtime strings: Strings in runtime contexts, such as expression evaluation and function return values, are limited to 2³²−1 bytes (approximately 4 GB).
Strings must be enclosed in single quotes (') or double quotes (").
Declaration example¶
'''
CREATE GRAPH TYPE IF NOT EXISTS person AS
{ NODE Person
( {
id INT64 PRIMARY KEY,
is_adult BOOL DEFAULT TRUE,
name STRING DEFAULT 'John Doe',
hobbies LIST<STRING> DEFAULT ['reading', 'swimming'],
birthday DATE DEFAULT DATE('1990-01-01')
} )
}
'''
In the preceding example, the property name is of the string type (STRING) with a default value of John Doe.