MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / lbug_value_get_struct_num_fields

Function lbug_value_get_struct_num_fields

src/c_api/value.cpp:511–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511lbug_state lbug_value_get_struct_num_fields(lbug_value* value, uint64_t* out_result) {
512 auto physical_type_id = static_cast<Value*>(value->_value)->getDataType().getPhysicalType();
513 if (physical_type_id != PhysicalTypeID::STRUCT) {
514 return LbugError;
515 }
516 auto val = static_cast<Value*>(value->_value);
517 const auto& data_type = val->getDataType();
518 try {
519 *out_result = StructType::getNumFields(data_type);
520 return LbugSuccess;
521 } catch (Exception& e) {
522 return LbugError;
523 }
524}
525
526lbug_state lbug_value_get_struct_field_name(lbug_value* value, uint64_t index, char** out_result) {
527 auto physical_type_id = static_cast<Value*>(value->_value)->getDataType().getPhysicalType();

Callers 1

TEST_FFunction · 0.85

Calls 2

getDataTypeMethod · 0.80
getPhysicalTypeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68