query/backends/postgres/src/postgres_dialect.cpp

32 lines
1.1 KiB
C++

#include "postgres_dialect.hpp"
#include "matador/sql/dialect_builder.hpp"
#include "matador/utils/basic_types.hpp"
[[maybe_unused]] const matador::sql::dialect *get_dialect() {
using namespace matador::sql;
const static dialect d = dialect_builder::builder()
.create()
.with_placeholder_func([](const size_t index) {
return "$" + std::to_string(index);
})
.with_token_replace_map({
{dialect_token::BeginBinaryData, "'\\x"},
{dialect_token::Identity, "GENERATED BY DEFAULT AS IDENTITY"}
})
.with_data_type_replace_map({
{matador::utils::basic_type::Int8, "SMALLINT"},
{matador::utils::basic_type::UInt8, "SMALLINT"},
{matador::utils::basic_type::Float, "REAL"},
{matador::utils::basic_type::Double, "DOUBLE PRECISION"},
{matador::utils::basic_type::Time, "TIME(6)"},
{matador::utils::basic_type::DateTime, "TIMESTAMPTZ(6)"},
{matador::utils::basic_type::Blob, "BYTEA"}
})
.with_bool_strings("TRUE", "FALSE")
.with_default_schema_name("public")
.build();
return &d;
}