Package com.kuzudb
Class KuzuStruct
java.lang.Object
com.kuzudb.KuzuStruct
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionKuzuStruct
(Value value) Construct a struct from a valueKuzuStruct
(String[] fieldNames, Value[] fieldValues) Construct a struct literal from a given set of fields.KuzuStruct
(Map<String, Value> fields) Construct a struct literal from a given set of fields represented as a Java map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this object, relinquishing the underlying valuegetFieldNameByIndex
(long index) Get the name of the field at the given indexlong
getIndexByFieldName
(String fieldName) Get the index of the field with the given namelong
getValue()
getValueByFieldName
(String fieldName) Get the value of the field with the given namegetValueByIndex
(long index) Get the value of the field at the given indextoMap()
Gets the elements the struct as a Java map.
-
Constructor Details
-
KuzuStruct
Construct a struct from a value- Parameters:
value
- the value to construct the struct from
-
KuzuStruct
Construct a struct literal from a given set of fields represented as a Java map.- Parameters:
fields
- : The fields of the struct, with the keys representing the field names and the values representing the field values.- Throws:
ObjectRefDestroyedException
-
KuzuStruct
Construct a struct literal from a given set of fields. The length of the fieldName/fieldValue arrays must be the same.- Parameters:
fieldNames
- : The name of the struct fieldsfieldValues
- : The values of the struct fields- Throws:
ObjectRefDestroyedException
-
-
Method Details
-
getValue
- Returns:
- Gets the underlying Value for the struct
-
getNumFields
- Returns:
- The number of fields in the struct.
- Throws:
ObjectRefDestroyedException
- If the struct has been destroyed.
-
getIndexByFieldName
Get the index of the field with the given name- Parameters:
fieldName
- : The name of the field.- Returns:
- The index of the field with the given name, or -1 if it doesn't exist
- Throws:
ObjectRefDestroyedException
- If the struct has been destroyed.
-
getFieldNameByIndex
Get the name of the field at the given index- Parameters:
index
- : The index of the field.- Returns:
- The name of the field at the given index
- Throws:
ObjectRefDestroyedException
- If the struct has been destroyed.
-
getValueByFieldName
Get the value of the field with the given name- Parameters:
fieldName
- : The name of the field.- Returns:
- The value of the field with the given name value.
- Throws:
ObjectRefDestroyedException
- If the struct has been destroyed.
-
getValueByIndex
Get the value of the field at the given index- Parameters:
index
- : The index of the field.- Returns:
- The value of the field at the given index value.
- Throws:
ObjectRefDestroyedException
- If the struct has been destroyed.
-
toMap
Gets the elements the struct as a Java map. This will be truncated if the number of fields doesn't fit in a 32-bit integer.- Returns:
- the struct as a Java map
- Throws:
ObjectRefDestroyedException
-
close
Closes this object, relinquishing the underlying value- Specified by:
close
in interfaceAutoCloseable
- Throws:
ObjectRefDestroyedException
-