wayydb-api / src /types.cpp
rcgalbo's picture
Deploy wayyDB to HuggingFace Spaces
bf20cb7
Raw History Blame Contribute Delete
626 Bytes
#include "wayy_db/types.hpp"
#include <unordered_map>
namespace wayy_db {
DType dtype_from_string(std::string_view s) {
static const std::unordered_map<std::string_view, DType> map = {
{"int64", DType::Int64},
{"float64", DType::Float64},
{"timestamp", DType::Timestamp},
{"symbol", DType::Symbol},
{"bool", DType::Bool},
{"string", DType::String},
{"decimal6", DType::Decimal6},
};
auto it = map.find(s);
if (it == map.end()) {
throw WayyException("Unknown dtype: " + std::string(s));
}
return it->second;
}
} // namespace wayy_db