7#include <userver/storages/postgres/io/buffer_io.hpp>
8#include <userver/storages/postgres/io/buffer_io_base.hpp>
9#include <userver/utils/macaddr.hpp>
11USERVER_NAMESPACE_BEGIN
15using Macaddr = USERVER_NAMESPACE::utils::Macaddr;
16using Macaddr8 = USERVER_NAMESPACE::utils::Macaddr8;
22struct MacaddrFormatterBase : BufferFormatterBase<T> {
23 using BaseType = BufferFormatterBase<T>;
25 using BaseType::BaseType;
27 template <
typename Buffer>
28 void operator()(
const UserTypes& types, Buffer& buffer) {
29 for (
const auto val :
this->value.GetOctets()) {
30 io::WriteBuffer(types, buffer,
static_cast<
char>(val));
36struct MacaddrBufferParser : BufferParserBase<T> {
37 using BaseType = BufferParserBase<T>;
38 using BaseType::BaseType;
40 typename T::OctetsType octets;
41 const uint8_t* byte_cptr = buffer.buffer;
42 for (
auto& val : octets) {
46 this->value = T(octets);
85struct CppToSystemPg<Macaddr> : PredefinedOid<PredefinedOids::kMacaddr> {};
88struct CppToSystemPg<Macaddr8> : PredefinedOid<PredefinedOids::kMacaddr8> {};