mirror of
https://github.com/oatpp/oatpp-postgresql.git
synced 2024-11-27 02:39:56 +08:00
Ser/De: Arrays. Refactor method names.
This commit is contained in:
parent
d1bcba1380
commit
28af5a276e
@ -64,9 +64,9 @@ Deserializer::Deserializer() {
|
|||||||
setDeserializerMethod(data::mapping::type::__class::AbstractObject::CLASS_ID, nullptr);
|
setDeserializerMethod(data::mapping::type::__class::AbstractObject::CLASS_ID, nullptr);
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Deserializer::deserializeEnum);
|
setDeserializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Deserializer::deserializeEnum);
|
||||||
|
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractVector>);
|
setDeserializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractVector>);
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractList>);
|
setDeserializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractList>);
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractUnorderedSet>);
|
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractUnorderedSet>);
|
||||||
|
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractPairList::CLASS_ID, nullptr);
|
setDeserializerMethod(data::mapping::type::__class::AbstractPairList::CLASS_ID, nullptr);
|
||||||
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID, nullptr);
|
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID, nullptr);
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#else
|
#else
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace oatpp { namespace postgresql { namespace mapping {
|
namespace oatpp { namespace postgresql { namespace mapping {
|
||||||
@ -212,7 +212,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Collection>
|
template<class Collection>
|
||||||
static oatpp::Void deserializeArray2(const Deserializer* _this, const InData& data, const Type* type) {
|
static oatpp::Void deserializeArray(const Deserializer* _this, const InData& data, const Type* type) {
|
||||||
|
|
||||||
if(data.isNull) {
|
if(data.isNull) {
|
||||||
return oatpp::Void(nullptr, type);
|
return oatpp::Void(nullptr, type);
|
||||||
|
@ -65,9 +65,9 @@ void Serializer::setSerializerMethods() {
|
|||||||
|
|
||||||
setSerializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Serializer::serializeEnum);
|
setSerializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Serializer::serializeEnum);
|
||||||
|
|
||||||
setSerializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractVector>);
|
setSerializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractVector>);
|
||||||
setSerializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractList>);
|
setSerializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractList>);
|
||||||
setSerializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractUnorderedSet>);
|
setSerializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractUnorderedSet>);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
|
@ -30,6 +30,12 @@
|
|||||||
|
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
|
#include <WinSock2.h>
|
||||||
|
#else
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace oatpp { namespace postgresql { namespace mapping {
|
namespace oatpp { namespace postgresql { namespace mapping {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,7 +178,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Collection>
|
template<class Collection>
|
||||||
static void serializeArray2(const Serializer* _this, OutputData& outData, const oatpp::Void& polymorph) {
|
static void serializeArray(const Serializer* _this, OutputData& outData, const oatpp::Void& polymorph) {
|
||||||
|
|
||||||
if(!polymorph) {
|
if(!polymorph) {
|
||||||
serNull(outData);
|
serNull(outData);
|
||||||
@ -183,7 +189,7 @@ private:
|
|||||||
const oatpp::Type* itemType = getArrayItemTypeAndDimensions(polymorph, meta.dimensions);
|
const oatpp::Type* itemType = getArrayItemTypeAndDimensions(polymorph, meta.dimensions);
|
||||||
|
|
||||||
if(meta.dimensions.empty()) {
|
if(meta.dimensions.empty()) {
|
||||||
throw std::runtime_error("[oatpp::postgresql::mapping::Serializer::serializeArray2()]: Error. "
|
throw std::runtime_error("[oatpp::postgresql::mapping::Serializer::serializeArray()]: Error. "
|
||||||
"Invalid array.");
|
"Invalid array.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user