# DATA-DOG/go-sqlmock

Sql mock driver for golang to test database interactions

Repository: https://github.com/DATA-DOG/go-sqlmock
Canonical: https://ross.abutalabs.com/products/go-sqlmock
Language: Go
License: NOASSERTION
License Family: other
Topics: sql-driver, go, mock, database, tdd, testing, golang, sql
Last push: 2026-07-10T06:12:55+00:00

## Health v2 (maintenance only)
Score: 64/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 91, release rhythm 8, longevity 100
- inputs: {"age_days": 4590, "days_push": 54, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 6567, forks 414 (observed 2026-08-28T04:09:45.283282+00:00)

## What it is
go-sqlmock is a mock library implementing Go's sql/driver interface to simulate SQL driver behavior in tests without a real database connection. It supports expectation-based matching, concurrency, context features, and named parameters, enabling TDD workflows for database interactions.

## Use cases
- unit test database interactions in Go without a real database
- mock SQL driver behavior in tests
- test database transactions and rollbacks
- verify SQL query expectations in TDD workflow
- test code that uses database/sql with any driver

## When to choose
- you want fast, dependency-free unit tests for Go database code
- you follow TDD and need strict expectation ordering for SQL calls
- you need to mock context or named parameter features of database/sql

## When to avoid
- you need functional/integration testing against a real database
- you want a library that is actively developed with new features
- you prefer higher-level mocking like sqlmock alternatives with query builders

## Facets
- artifact type: library
- maturity: maintenance
- function: mocking, testing, database-driver
- domain: testing, databases, developer-tools
- platform: go, cli
- tags: sql, tdd, unit-testing, database-mocking, sql-driver

## Member repositories
- DATA-DOG/go-sqlmock (main) score 64

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:45.283282+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:43:39.923724+00:00, confidence not recorded.
  - readme: https://github.com/DATA-DOG/go-sqlmock (fetched 2026-08-28T04:09:45.283282+00:00, sha 74382e860f42)
- Data as of 2026-08-30T08:39:29.467469+00:00.
