-
Notifications
You must be signed in to change notification settings - Fork 1
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(dtc):renamed Context and added DTC #45
Conversation
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.
Hey @cnlangzi - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -8,7 +8,7 @@ import ( | |||
"time" | |||
) | |||
|
|||
type Context struct { |
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.
suggestion (code_clarification): Consider renaming Conn
to a more descriptive name reflecting its responsibilities.
The name Conn
typically suggests a simple connection object, but this struct includes complex behaviors and state management, which might be misleading.
type Context struct { | |
type DBContext struct { | |
*sql.DB | |
sync.Mutex | |
_ noCopy | |
Index int | |
} |
@@ -121,7 +121,7 @@ | |||
return db.ExecContext(ctx, query, args...) | |||
} | |||
|
|||
func (db *Context) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) { |
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.
issue (performance): Review the fallback to context.Background()
in ExecContext
.
Using context.Background()
as a fallback in ExecContext
might lead to operations that do not respect caller's context cancellation or timeout. Consider handling this scenario explicitly.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 76.09% 76.65% +0.55%
==========================================
Files 43 44 +1
Lines 1782 1829 +47
==========================================
+ Hits 1356 1402 +46
+ Misses 307 304 -3
- Partials 119 123 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Here's the code health analysis summary for commits Analysis Summary
|
Changes
Context
toClient
DTC