Skip to content

Commit 8079e76

Browse files
authored
models: add toString method (#2339)
1 parent a22956b commit 8079e76

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
8+
### Changed
9+
10+
- Add toString method to all models
11+
712
## [1.9.11] - 2025-06-20
813

914
### API changes list

drogon_ctl/templates/model_cc.csp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,11 @@ Json::Value [[className]]::toJson() const
12081208
return ret;
12091209
}
12101210

1211+
std::string [[className]]::toString() const
1212+
{
1213+
return toJson().toStyledString();
1214+
}
1215+
12111216
Json::Value [[className]]::toMasqueradedJson(
12121217
const std::vector<std::string> &pMasqueradingVector) const
12131218
{

drogon_ctl/templates/model_h.csp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ auto cols=@@.get<std::vector<ColumnInfo>>("columns");
204204
static const std::string &getColumnName(size_t index) noexcept(false);
205205

206206
Json::Value toJson() const;
207+
std::string toString() const;
207208
Json::Value toMasqueradedJson(const std::vector<std::string> &pMasqueradingVector) const;
208209
/// Relationship interfaces
209210
<%c++

0 commit comments

Comments
 (0)