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

Function parseStructFieldValue

src/function/cast_from_string_functions.cpp:563–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563static bool parseStructFieldValue(const char*& input, const char* end, const CSVOption* option,
564 bool& closeBrack) {
565 uint64_t lvl = 0;
566 while (input < end) {
567 if (*input == '"' || *input == '\'') {
568 if (!skipToCloseQuotes(input, end)) {
569 return false;
570 }
571 } else if (*input == '{') {
572 if (!skipToClose(input, end, lvl, '}', option)) {
573 return false;
574 }
575 } else if (*input == CopyConstants::DEFAULT_CSV_LIST_BEGIN_CHAR) {
576 if (!skipToClose(input, end, ++lvl, CopyConstants::DEFAULT_CSV_LIST_END_CHAR, option)) {
577 return false;
578 }
579 } else if (*input == ',' || *input == '}') {
580 if (*input == '}') {
581 closeBrack = true;
582 }
583 return (lvl == 0);
584 }
585 input++;
586 }
587 return false;
588}
589
590static bool tryCastStringToStruct(const char* input, uint64_t len, ValueVector* vector,
591 uint64_t rowToAdd, const CSVOption* option) {

Callers 1

tryCastStringToStructFunction · 0.85

Calls 2

skipToCloseQuotesFunction · 0.85
skipToCloseFunction · 0.85

Tested by

no test coverage detected