Skip to content

enhanced transaction APIs - #11

Merged
ziflex merged 4 commits into
masterfrom
fix/improved-tx-handling
Sep 5, 2026
Merged

ziflex merged 4 commits into
masterfrom
fix/improved-tx-handling

Conversation

@ziflex

@ziflex ziflex commented Sep 2, 2026

Copy link
Copy Markdown
Owner

This pull request refactors and modernizes the CI pipeline, improves documentation, and updates code quality tooling for the project. The most important changes include a major overhaul of the GitHub Actions workflows, significant improvements and clarifications to the documentation (README.md), and a migration to golangci-lint for linting. The configuration for static analysis and formatting tools is also updated for better maintainability and clarity.

CI/CD and Tooling Modernization:

  • The .github/workflows/ci.yml workflow is completely restructured: it now uses versioned actions, adds environment variables for tool versions, splits jobs into test, quality (lint/format), race detection, and vulnerability scanning, and pins tool versions for reproducibility. The Go versions matrix is updated for clarity and future-proofing.
  • The old .github/workflows/static-analysis.yml workflow is removed, consolidating all static analysis into the main CI workflow.
  • The Makefile is updated to use golangci-lint for linting, adds a fmt-check target for CI formatting checks, and introduces a test-race target for race condition testing.

Documentation and API Clarification:

  • The README.md is extensively revised to clarify the API, usage patterns, and transaction management semantics. It updates code examples to use context-aware methods, explains the difference between Database and DatabaseWithContext, and provides more accurate helper function descriptions and transaction behavior explanations. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Static Analysis and Formatting Configuration:

  • The .golangci.yml configuration is rewritten for the latest golangci-lint version, enabling only the necessary linters, and moving linter settings under a settings block. It also adds exclusions and path settings for generated code and third-party directories, and configures formatters for gofmt and goimports. [1] [2]

Code Example Updates:

  • All code and documentation examples are updated to use context-aware query and exec methods, reflecting best practices and the latest API. [1] [2]

These changes collectively improve the project's maintainability, developer experience, and documentation accuracy.

…ted documentation, and enhanced transaction APIs.
Copilot AI lite review requested due to automatic review settings September 2, 2026 20:53

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.

🟡 Changes recommended

The transaction implementation currently introduces redundant rollback calls, and commit-error test expectations don’t match the cleanup behavior, which will likely break sqlmock-based tests.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR modernizes the project’s CI/tooling setup (GitHub Actions + golangci-lint + make targets) and refreshes documentation/examples around dbx’s context-aware APIs and transaction reuse semantics, alongside a functional update to transaction error handling.

Changes:

  • Refactors transactionWithInternal to reuse transactions via FromContext, improves rollback error reporting (joining op + rollback failures), and updates examples to context-aware calls.
  • Overhauls CI by consolidating jobs (test/quality/race/vuln scan), pinning tool versions, and migrating linting/format checks to golangci-lint + make fmt-check.
  • Updates docs and comments across the library to clarify Database vs DatabaseWithContext, transaction reuse vs “independent” transactions, and context helper semantics; adds/refreshes tests and helpers.
File summaries
File Description
transaction.go Updates transaction core logic (reuse detection + rollback error joining) and examples.
transaction_test.go Reworks transaction tests for new semantics and adds new cases (panic, rollback join, reuse).
test_helpers_test.go Adds shared sqlmock helper + test-only Beginner implementation.
README.md Major doc refresh: context-aware API usage, transaction semantics, and examples.
options.go Clarifies that isolation/read-only options apply only when dbx creates a new transaction.
options_test.go Updates option tests and transaction-with-result tests to use shared helpers and new expectations.
Makefile Switches lint to golangci-lint and adds fmt-check + test-race targets.
lib.go Updates package/docs examples to use context-aware query/exec methods and clarifies transaction reuse phrasing.
go.mod Removes toolchain pin and drops unused indirect deps.
go.sum Tidies module checksums consistent with go.mod changes.
database.go Improves docs and adds //nolint:noctx annotations for legacy database/sql-style methods.
database_test.go Updates tests to reuse shared column-name constants and checks Rows.Err()/Row.Err().
context.go Updates examples to use context-aware exec; adds/extends context creation helpers.
context_test.go Refactors tests to use shared sqlmock helper; adds coverage for NewContextFrom.
.golangci.yml Migrates to a v2-style golangci-lint config, enabling formatters and reorganizing settings/exclusions.
.github/workflows/static-analysis.yml Removes standalone static-analysis workflow (consolidated into CI).
.github/workflows/ci.yml Rebuilds CI into separate jobs (test/quality/race/vuln), pins tool versions, and runs fmt-check/lint/tidy-diff.
Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread options_test.go
Comment thread transaction.go Outdated
Comment thread transaction_test.go
@ziflex
ziflex merged commit 5a2e9a0 into master Sep 5, 2026
5 checks passed
@ziflex
ziflex deleted the fix/improved-tx-handling branch September 5, 2026 02:17
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