Skip to content

将数据库改用为mysql,弃用第三方websocket库,自实现websocket#6

Closed
liangbm3 wants to merge 7 commits into
mainfrom
develop
Closed

将数据库改用为mysql,弃用第三方websocket库,自实现websocket#6
liangbm3 wants to merge 7 commits into
mainfrom
develop

Conversation

@liangbm3

@liangbm3 liangbm3 commented Sep 1, 2025

Copy link
Copy Markdown
Owner

No description provided.

@liangbm3 liangbm3 requested a review from Copilot September 1, 2025 13:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements a major architectural change by migrating from SQLite to MySQL as the database backend and replacing the third-party WebSocketPP library with a custom WebSocket implementation. The changes focus on modernizing the database layer with proper connection pooling, prepared statements, and repository pattern implementation.

Key changes include:

  • Complete database migration from SQLite to MySQL with connection pooling
  • Implementation of MySQL-specific repositories for users, rooms, and messages
  • Addition of comprehensive test coverage for all database components
  • Code formatting and style improvements across utility classes

Reviewed Changes

Copilot reviewed 90 out of 91 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
third_party/websocketpp Removes WebSocketPP submodule dependency
tests/utils/*.cpp Applies consistent code formatting to utility test files
tests/model/*.cpp Improves code formatting in model test files
tests/http/*.cpp Standardizes formatting in HTTP test files
tests/db/*.cpp Adds comprehensive MySQL database repository tests
tests/CMakeLists.txt Updates build configuration for MySQL dependencies
src/websocket/*.hpp/.cpp Maintains WebSocketPP usage but improves code formatting
src/utils/*.hpp/.cpp Adds SHA1 utility and improves formatting consistency
Comments suppressed due to low confidence (1)

tests/db/test_database_manager.cpp:1

  • The directory name 'respository' is misspelled. It should be 'repository'.
#include <gtest/gtest.h>

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


#include <cassert>
#include <chrono>
#include <cstdio>

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

There's a duplicate include for <cstdio> on lines 5 and 6. Remove the duplicate comment on line 6.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
#include "../src/db/connection_pool.hpp"
#include "../src/db/mysql_statement.hpp"

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

Include paths are using relative paths with '../src/'. This should use the configured include directories from CMakeLists.txt instead for better maintainability.

Suggested change
#include "../src/db/connection_pool.hpp"
#include "../src/db/mysql_statement.hpp"
#include "db/connection_pool.hpp"
#include "db/mysql_statement.hpp"

Copilot uses AI. Check for mistakes.
#include <thread>
#include <atomic>

#include "../../src/db/respository/user_repository.hpp"

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled. It should be 'repository'.

Suggested change
#include "../../src/db/respository/user_repository.hpp"
#include "../../src/db/repository/user_repository.hpp"

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +8
#include "../../src/db/respository/room_repository.hpp"
#include "../../src/db/respository/user_repository.hpp"

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled. It should be 'repository'.

Suggested change
#include "../../src/db/respository/room_repository.hpp"
#include "../../src/db/respository/user_repository.hpp"
#include "../../src/db/repository/room_repository.hpp"
#include "../../src/db/repository/user_repository.hpp"

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +9
#include "../../src/db/respository/message_repository.hpp"
#include "../../src/db/respository/user_repository.hpp"
#include "../../src/db/respository/room_repository.hpp"

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled. It should be 'repository'.

Suggested change
#include "../../src/db/respository/message_repository.hpp"
#include "../../src/db/respository/user_repository.hpp"
#include "../../src/db/respository/room_repository.hpp"
#include "../../src/db/repository/message_repository.hpp"
#include "../../src/db/repository/user_repository.hpp"
#include "../../src/db/repository/room_repository.hpp"

Copilot uses AI. Check for mistakes.
Comment thread tests/CMakeLists.txt
# 创建用户仓库测试可执行文件
add_executable(test_user_repository
db/test_user_repository.cpp
../src/db/respository/user_repository.cpp

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled in multiple locations. It should be 'repository'.

Copilot uses AI. Check for mistakes.
Comment thread tests/CMakeLists.txt
add_executable(test_room_repository
db/test_room_repository.cpp
../src/db/respository/room_repository.cpp
../src/db/respository/user_repository.cpp

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled in multiple locations. It should be 'repository'.

Copilot uses AI. Check for mistakes.
Comment thread tests/CMakeLists.txt
Comment on lines +77 to +79
../src/db/respository/message_repository.cpp
../src/db/respository/user_repository.cpp
../src/db/respository/room_repository.cpp

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled in multiple locations. It should be 'repository'.

Copilot uses AI. Check for mistakes.
Comment thread tests/CMakeLists.txt
Comment on lines +95 to +97
../src/db/respository/message_repository.cpp
../src/db/respository/user_repository.cpp
../src/db/respository/room_repository.cpp

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The directory name 'respository' is misspelled in multiple locations. It should be 'repository'.

Copilot uses AI. Check for mistakes.
@liangbm3 liangbm3 closed this Sep 1, 2025
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.

2 participants