-
Notifications
You must be signed in to change notification settings - Fork 90
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
feat: [#358] add logger for DB #908
Conversation
Warning Rate limit exceeded@hwbrzzl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 58 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (15)
WalkthroughThis pull request introduces context support and enhanced logging across the database stack. It adds a new Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant SP as ServiceProvider
participant Log as Logger
participant DB as Database
App->>SP: Call Register()
SP->>Log: Call app.MakeLog()
Log-->>SP: Return Logger instance
SP->>DB: Call BuildDB(config, log, connection)
DB->>DB: Initialize with ctx, driver, logger, builder
DB-->>SP: Return new DB instance with context
sequenceDiagram
participant Caller as Client
participant Q as Query
participant D as Driver
participant L as Logger
Caller->>Q: Invoke Query operation (e.g., Get, Insert)
Q->>D: Retrieve placeholder format via driver
Q->>L: Call trace(sql, args, rowsAffected, err)
L-->>Q: Log the SQL execution details
Q-->>Caller: Return query result
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #908 +/- ##
=======================================
Coverage 68.01% 68.01%
=======================================
Files 154 154
Lines 10191 10192 +1
=======================================
+ Hits 6931 6932 +1
Misses 2934 2934
Partials 326 326 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test now function of carbon generates a new Carbon struct when calling carbon.Now(), it's different with the test carbon, it's difficult to test. So revert it to our self test now function.
s.mockDriver.EXPECT().Config().Return(database.Config{}).Once() | ||
s.mockBuilder.EXPECT().Exec("DELETE FROM users WHERE name = ? AND id = ?", "John", 1).Return(mockResult, nil).Once() | ||
s.mockDriver.EXPECT().Explain("DELETE FROM users WHERE name = ? AND id = ?", "John", 1).Return("DELETE FROM users WHERE name = \"John\" AND id = 1").Once() | ||
s.mockLogger.EXPECT().Trace(s.ctx, s.now, "DELETE FROM users WHERE name = \"John\" AND id = 1", int64(1), nil).Return().Once() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to test now
when using carbon's test now function.
📑 Description
goravel/goravel#358
Summary by CodeRabbit
New Features
Enhanced Logging
Refactor
✅ Checks