方法
ArrowListArrayBuilderappend_value
自:0.12.0 起
宣告 [src]
gboolean
garrow_list_array_builder_append_value (
GArrowListArrayBuilder* builder
GError** error
)
回傳值
類型: gboolean
成功時回傳 TRUE
,若發生錯誤則回傳 FALSE
。
它會附加一個新的列表元素。 若要附加新的列表元素,您需要先呼叫此函式,然後將列表元素值附加到 value_builder
。 value_builder
是建構子中指定的 GArrowArrayBuilder
。 您可以透過 garrow_list_array_builder_get_value_builder() 取得 value_builder
。
GArrowInt8ArrayBuilder *value_builder;
GArrowListArrayBuilder *builder;
value_builder = garrow_int8_array_builder_new();
builder = garrow_list_array_builder_new(value_builder, NULL);
// Start 0th list element: [1, 0, -1]
garrow_list_array_builder_append(builder, NULL);
garrow_int8_array_builder_append(value_builder, 1);
garrow_int8_array_builder_append(value_builder, 0);
garrow_int8_array_builder_append(value_builder, -1);
// Start 1st list element: [-29, 29]
garrow_list_array_builder_append(builder, NULL);
garrow_int8_array_builder_append(value_builder, -29);
garrow_int8_array_builder_append(value_builder, 29);
{
// [[1, 0, -1], [-29, 29]]
GArrowArray *array = garrow_array_builder_finish(builder);
// Now, builder is needless.
g_object_unref(builder);
g_object_unref(value_builder);
// Use array...
g_object_unref(array);
}