Actions
Improvements #12675
closed[Dbo::JsonSerializer] Support built-in types
Start date:
05/17/2024
Due date:
% Done:
100%
Estimated time:
Description
Wt::Dbo guide says:
There is also support for built-in Wt types such as WDate, WDateTime, WTime and WString which can be enabled by including <Wt/Dbo/WtSqlTraits.h>.
So I wonder why JsonSerializer does not support them
https://redmine.emweb.be/boards/2/topics/14991
Updated by Andrey Alekseev 6 months ago
I found out that type support may be extended for my project just like this
namespace Wt { namespace Dbo {
template<typename T>
typename std::enable_if< !std::is_enum<T>::value, void>::type
JsonSerializer::act(FieldRef<T> field){
writeFieldName(field.name());
WString v = field.value().toString();
JsonSerializer::act( FieldRef<WString>(v, field.name(), field.size(), field.flags()));
}
template<>
void JsonSerializer::act(FieldRef<WString> field){
std::string v = field.value().toUTF8();
JsonSerializer::act( FieldRef<std::string>(v, field.name(), field.size(), field.flags()));
}
}}
thanks to the template declered in the header file
Updated by Matthias Van Ceulebroeck 5 months ago
- Assignee set to Romain Mardulyn
- Target version set to 4.11.1
Updated by Romain Mardulyn 4 months ago
- Status changed from InProgress to Review
- Assignee deleted (
Romain Mardulyn)
Updated by Matthias Van Ceulebroeck about 1 month ago
- Assignee set to Matthias Van Ceulebroeck
Updated by Matthias Van Ceulebroeck 17 days ago
- Status changed from Review to Implemented @Emweb
- Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
- % Done changed from 0 to 100
Updated by Matthias Van Ceulebroeck 16 days ago
- Status changed from Implemented @Emweb to Implemented @Test
Updated by Matthias Van Ceulebroeck 16 days ago
- Status changed from Implemented @Test to Closed
Actions