-
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
fix(connector): added Connector
interface
#43
Conversation
Connector
interface
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
=======================================
Coverage 75.88% 75.88%
=======================================
Files 42 42
Lines 1758 1758
=======================================
Hits 1334 1334
Misses 306 306
Partials 118 118
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
|
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: 3 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.
// Query executes a query that returns multiple rows. | ||
// It takes a query string and optional arguments. | ||
// It returns a pointer to a Rows object and an error, if any. | ||
Query(query string, args ...any) (*Rows, 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.
suggestion (code_clarification): Consider documenting the behavior when args
is nil or empty.
Clarifying how the function behaves with no arguments could improve the usability and understanding of the API.
Query(query string, args ...any) (*Rows, error) | |
// Query executes a query that returns multiple rows. | |
// It takes a query string and optional arguments. If no arguments are provided, | |
// the query is executed without any parameter substitution. | |
// It returns a pointer to a Rows object and an error, if any. | |
Query(query string, args ...any) (*Rows, error) |
// QueryRow executes a query that returns a single row. | ||
// It takes a query string and optional arguments. | ||
// It returns a pointer to a Row object. | ||
QueryRow(query string, args ...any) *Row |
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): Specify the return behavior when no rows are found.
It would be beneficial to define whether a nil
Row or an error is returned when the query results in no rows, enhancing API predictability.
QueryRow(query string, args ...any) *Row | |
// QueryRow executes a query that returns a single row. | |
// It takes a query string and optional arguments. | |
// It returns a pointer to a Row object or nil if no rows are found. | |
QueryRow(query string, args ...any) *Row |
// Exec executes a query that doesn't return any rows. | ||
// It takes a query string and optional arguments. | ||
// It returns a sql.Result object and an error, if any. | ||
Exec(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.
suggestion (code_clarification): Clarify the expected behavior of Exec
with invalid SQL commands.
Documenting how Exec
handles syntax errors or unauthorized commands can help developers understand error handling.
Exec(query string, args ...any) (sql.Result, error) | |
// Exec executes a query that doesn't return any rows. | |
// It takes a query string and optional arguments. | |
// It returns a sql.Result object and an error, if any. | |
// Errors can include syntax errors in the query or issues like unauthorized commands, | |
// which will be returned as part of the error object. | |
Exec(query string, args ...any) (sql.Result, error) |
Changes