Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server with db #15

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

Server with db #15

wants to merge 57 commits into from

Conversation

a-badin
Copy link
Collaborator

@a-badin a-badin commented Jun 8, 2023

No description provided.

nickdemiman and others added 30 commits May 2, 2023 13:30
Пока еще не дописал и не затестил
uml для базы данных
Вернул параметризированный опциональный конструктор
но насчет асинхронности тут вопрос стоит, потому что напрягает функция accept
#include <optional>
#include "url_dispatcher.hpp"

using udp = boost::asio::ip::udp;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше выделить в отдельный namespace или вообще не использовать using в hpp файлах

_socket,
_streambuf,
[self = shared_from_this()](
boost::system::error_code error,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

такие большие функции лучше выносить в методы класса

void async_accept() {
_socket.emplace(_io_context);

_acceptor.async_accept(*_socket, [&](boost::system::error_code error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше явно перечислять захват

class UrlDispatcher {
public:
UrlDispatcher() : urls() {
std::shared_ptr<UserView> user_v(new UserView());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make_shared

public:
DatabaseTable(const std::string&);

~DatabaseTable();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

virtual


DatabaseTable::DatabaseTable(const std::string &tableName) : tableName(tableName)
{
db = new pqxx::connection(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAII

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants