Skip to content

Add database/sql resilience example.#64

Open
Mak-1911 wants to merge 1 commit intocinar:mainfrom
Mak-1911:example/sql-resilience
Open

Add database/sql resilience example.#64
Mak-1911 wants to merge 1 commit intocinar:mainfrom
Mak-1911:example/sql-resilience

Conversation

@Mak-1911
Copy link
Copy Markdown

@Mak-1911 Mak-1911 commented Apr 13, 2026

Fixes #60

Description

Adds a new example in examples/sql/ demonstrating how to use Resile with Go's standard database/sql package.

The example wraps db.ExecContext with resile.Do, retries, and a circuit breaker. It uses a small mock database/sql/driver that fails the first two calls and succeeds on the third call, so the example can run without SQLite, external services, or new dependencies.

Checklist

Please ensure your contribution meets the project standards:

  • Code is formatted with go fmt.

  • All tests pass (go test -v ./...).

  • Architectural mandates (zero-dependency, type safety) are respected.

  • Tested with:

  go run ./examples/sql
  go test -v ./...

Additional Context

This example uses a mock SQL driver instead of SQLite to keep the example dependency-free while still exercising the standard database/sql API. Although I can implement the SQLite if the project demands.

@Mak-1911 Mak-1911 force-pushed the example/sql-resilience branch from 94f56eb to 77154e7 Compare April 13, 2026 17:49
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.

Example: SQL Database Resilience with sql.DB

1 participant