userver: userver/storages/sqlite/query.hpp Source File
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
query.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/sqlite/query.hpp
4
5#include <optional>
6#include <string>
7
8#include <userver/utils/strong_typedef.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace storages::sqlite {
13
14// TODO: Can use Query from #include <userver/storages/query.hpp>?
15
16/// @brief Query class, which driver executes.
17class Query {
18public:
19 /// @brief Strong typedef for query name, one can use named queries to get
20 /// better logging experience
21 using Name = utils::StrongTypedef<struct NameTag, std::string>;
22
23 /// @brief Query constructor
24 Query(const char* statement, std::optional<Name> = std::nullopt);
25
26 /// @brief Query constructor
27 Query(std::string statement, std::optional<Name> = std::nullopt);
28
29 /// @brief Get query statement
30 const std::string& GetStatement() const;
31
32 /// @brief Get query name
33 const std::optional<Name>& GetName() const;
34
35private:
36 std::string statement_;
37 std::optional<Name> name_;
38};
39
40} // namespace storages::sqlite
41
42USERVER_NAMESPACE_END