2019-08-04 14:15:47 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
|
|
|
#include <Functions/FunctionsVisitParam.h>
|
|
|
|
#include <Functions/FunctionsStringSearch.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ExtractBool
|
|
|
|
{
|
|
|
|
using ResultType = UInt8;
|
|
|
|
|
|
|
|
static UInt8 extract(const UInt8 * begin, const UInt8 * end)
|
|
|
|
{
|
|
|
|
return begin + 4 <= end && 0 == strncmp(reinterpret_cast<const char *>(begin), "true", 4);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NameVisitParamExtractBool { static constexpr auto name = "visitParamExtractBool"; };
|
2021-09-21 16:43:46 +00:00
|
|
|
using FunctionVisitParamExtractBool = FunctionsStringSearch<ExtractParamImpl<NameVisitParamExtractBool, ExtractBool>>;
|
2019-08-04 14:15:47 +00:00
|
|
|
|
2021-04-01 20:07:01 +00:00
|
|
|
struct NameSimpleJSONExtractBool { static constexpr auto name = "simpleJSONExtractBool"; };
|
2021-09-21 16:43:46 +00:00
|
|
|
using FunctionSimpleJSONExtractBool = FunctionsStringSearch<ExtractParamImpl<NameSimpleJSONExtractBool, ExtractBool>>;
|
2019-08-04 14:15:47 +00:00
|
|
|
|
|
|
|
void registerFunctionVisitParamExtractBool(FunctionFactory & factory)
|
|
|
|
{
|
|
|
|
factory.registerFunction<FunctionVisitParamExtractBool>();
|
2021-03-30 16:25:56 +00:00
|
|
|
factory.registerFunction<FunctionSimpleJSONExtractBool>();
|
2019-08-04 14:15:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|