Skip to content

Commit 774c35e

Browse files
committed
Add ApiDocs.
1 parent 30c92c1 commit 774c35e

File tree

11 files changed

+150
-0
lines changed

11 files changed

+150
-0
lines changed

src/oatpp-postgresql/Connection.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@
3333

3434
namespace oatpp { namespace postgresql {
3535

36+
/**
37+
* Implementation of &id:oatpp::orm::Connection; for PostgreSQL.
38+
*/
3639
class Connection : public orm::Connection {
3740
public:
3841

42+
/**
43+
* Get PostgreSQL native connection handle.
44+
* @return
45+
*/
3946
virtual PGconn* getHandle() = 0;
4047

4148
virtual void setPrepared(const oatpp::String& statementName) = 0;

src/oatpp-postgresql/Executor.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939

4040
namespace oatpp { namespace postgresql {
4141

42+
/**
43+
* Implementation of &id:oatpp::orm::Executor;. for PostgreSQL.
44+
*/
4245
class Executor : public orm::Executor {
4346
private:
4447

src/oatpp-postgresql/QueryResult.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
namespace oatpp { namespace postgresql {
3434

35+
36+
/**
37+
* Implementation of &id:oatpp::orm::QueryResult;. for PostgreSQL.
38+
*/
3539
class QueryResult : public orm::QueryResult {
3640
private:
3741
static constexpr v_int32 TYPE_ERROR = 0;

src/oatpp-postgresql/mapping/Deserializer.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
namespace oatpp { namespace postgresql { namespace mapping {
3434

35+
/**
36+
* Mapper from PostgreSQL values to oatpp values.
37+
*/
3538
class Deserializer {
3639
public:
3740

src/oatpp-postgresql/mapping/Oid.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*
2323
***************************************************************************/
2424

25+
/**[info]
26+
*
27+
* A copy-pasted table of postgresql OIDs.
28+
*/
29+
2530
#ifndef oatpp_postgresql_mapping_Oid_hpp
2631
#define oatpp_postgresql_mapping_Oid_hpp
2732

src/oatpp-postgresql/mapping/ResultMapper.hpp

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,57 @@
3232

3333
namespace oatpp { namespace postgresql { namespace mapping {
3434

35+
/**
36+
* Mapper from PostgreSQL result to oatpp objects.
37+
*/
3538
class ResultMapper {
3639
public:
3740

41+
/**
42+
* Result data.
43+
*/
3844
struct ResultData {
3945

46+
/**
47+
* Constructor.
48+
* @param pDbResult
49+
* @param pTypeResolver
50+
*/
4051
ResultData(PGresult* pDbResult, const std::shared_ptr<const data::mapping::TypeResolver>& pTypeResolver);
4152

53+
/**
54+
* PGResult.
55+
*/
4256
PGresult* dbResult;
4357

58+
/**
59+
* &id:oatpp::data::mapping::TypeResolver;.
60+
*/
4461
std::shared_ptr<const data::mapping::TypeResolver> typeResolver;
4562

63+
/**
64+
* Column names.
65+
*/
4666
std::vector<oatpp::String> colNames;
67+
68+
/**
69+
* Column indices.
70+
*/
4771
std::unordered_map<data::share::StringKeyLabel, v_int32> colIndices;
72+
73+
/**
74+
* Column count.
75+
*/
4876
v_int64 colCount;
77+
78+
/**
79+
* Current row index.
80+
*/
4981
v_int64 rowIndex;
82+
83+
/**
84+
* Row count.
85+
*/
5086
v_int64 rowCount;
5187

5288
};
@@ -129,12 +165,55 @@ class ResultMapper {
129165
std::vector<ReadRowsMethod> m_readRowsMethods;
130166
public:
131167

168+
/**
169+
* Default constructor.
170+
*/
132171
ResultMapper();
133172

173+
/**
174+
* Set "read one row" method for class id.
175+
* @param classId
176+
* @param method
177+
*/
134178
void setReadOneRowMethod(const data::mapping::type::ClassId& classId, ReadOneRowMethod method);
179+
180+
/**
181+
* Set "read rows" method for class id.
182+
* @param classId
183+
* @param method
184+
*/
135185
void setReadRowsMethod(const data::mapping::type::ClassId& classId, ReadRowsMethod method);
136186

187+
/**
188+
* Read one row to oatpp object or collection. <br>
189+
* Allowed output type classes are:
190+
*
191+
* - &id:oatpp::Vector;
192+
* - &id:oatpp::List;
193+
* - &id:oatpp::UnorderedSet;
194+
* - &id:oatpp::Fields;
195+
* - &id:oatpp::UnorderedFields;
196+
* - &id:oatpp::Object;
197+
*
198+
* @param dbData
199+
* @param type
200+
* @return
201+
*/
137202
oatpp::Void readOneRow(ResultData* dbData, const Type* type, v_int64 rowIndex);
203+
204+
/**
205+
* Read `count` of rows to oatpp collection. <br>
206+
* Allowed collections to store rows are:
207+
*
208+
* - &id:oatpp::Vector;
209+
* - &id:oatpp::List;
210+
* - &id:oatpp::UnorderedSet;.
211+
*
212+
* @param dbData
213+
* @param type
214+
* @param count
215+
* @return
216+
*/
138217
oatpp::Void readRows(ResultData* dbData, const Type* type, v_int64 count);
139218

140219
};

src/oatpp-postgresql/mapping/Serializer.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232
namespace oatpp { namespace postgresql { namespace mapping {
3333

34+
/**
35+
* Mapper of oatpp values to PostgreSQL values.
36+
*/
3437
class Serializer {
3538
public:
3639

src/oatpp-postgresql/mapping/type/Uuid.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class UuidObject {
7878

7979
};
8080

81+
/**
82+
* UUID type to store UUID data.
83+
*/
8184
typedef oatpp::data::mapping::type::Primitive<UuidObject, __class::Uuid> Uuid;
8285

8386
namespace __class {

src/oatpp-postgresql/orm.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
*
2323
***************************************************************************/
2424

25+
/**[info]
26+
*
27+
* This is just a header file which includes all oatpp-postgresql components:
28+
*
29+
* ```cpp
30+
* #include "Executor.hpp"
31+
* #include "Types.hpp"
32+
*
33+
* #include "oatpp/orm/SchemaMigration.hpp"
34+
* #include "oatpp/orm/DbClient.hpp"
35+
* #include "oatpp/core/macro/codegen.hpp"
36+
* ```
37+
*/
38+
2539
#ifndef oatpp_postgresql_orm_hpp
2640
#define oatpp_postgresql_orm_hpp
2741

src/oatpp-postgresql/ql_template/Parser.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,35 @@
3232

3333
namespace oatpp { namespace postgresql { namespace ql_template {
3434

35+
/**
36+
* Query template parser.
37+
*/
3538
class Parser {
3639
public:
3740

41+
/**
42+
* Query template extra info.
43+
*/
3844
struct TemplateExtra {
3945

46+
/**
47+
* Query template name.
48+
*/
4049
oatpp::String templateName;
50+
51+
/**
52+
* Template text with parameters substituted to SQLite parameter placeholders.
53+
*/
4154
oatpp::String preparedTemplate;
55+
56+
/**
57+
* Parameter type map.
58+
*/
4259
orm::Executor::ParamsTypeMap paramsTypeMap;
60+
61+
/**
62+
* Use prepared statement for this query.
63+
*/
4364
bool prepare;
4465

4566
};
@@ -51,6 +72,11 @@ class Parser {
5172
static void skipStringInDollars(parser::Caret& caret);
5273
public:
5374

75+
/**
76+
* Parse query template.
77+
* @param text
78+
* @return - &id:oatpp::data::share::StringTemplate;.
79+
*/
5480
static data::share::StringTemplate parseTemplate(const oatpp::String& text);
5581

5682
};

0 commit comments

Comments
 (0)