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

!feat(dtc):renamed Context and added DTC #45

Merged
merged 4 commits into from
Apr 29, 2024
Merged

!feat(dtc):renamed Context and added DTC #45

merged 4 commits into from
Apr 29, 2024

Conversation

cnlangzi
Copy link
Member

@cnlangzi cnlangzi commented Apr 28, 2024

Changes

  • renamed Context to Client
  • added DTC

Copy link

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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 {
Copy link

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.

Suggested change
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) {
Copy link

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.

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

Attention: Patch coverage is 87.14286% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 76.65%. Comparing base (a6accdf) to head (119d860).

Files Patch % Lines
dtc.go 82.97% 4 Missing and 4 partials ⚠️
client.go 91.66% 1 Missing ⚠️
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     
Flag Coverage Δ
Unit-Tests 76.65% <87.14%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

deepsource-io bot commented Apr 28, 2024

Here's the code health analysis summary for commits a6accdf..119d860. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Go LogoGo✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@cnlangzi cnlangzi merged commit f7859c0 into main Apr 29, 2024
7 checks passed
@cnlangzi cnlangzi deleted the feat/dtc branch April 29, 2024 00:56
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.

1 participant