Mocking database calls without a library?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • dockertest

    Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.

    Don't mock. Use https://github.com/ory/dockertest to actually run tests against a dockerized DB.

  • InfluxDB

    Purpose built for real-time analytics at any scale. InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.

    InfluxDB logo
  • counterfeiter

    A tool for generating self-contained, type-safe test doubles in go

    then just replace whole function, don't generate manually the mock '__') or it would get out of hand fast, you can just use codegen that static typed like https://github.com/maxbrunsfeld/counterfeiter

  • integresql

    IntegreSQL manages isolated PostgreSQL databases for your integration tests.

    Mocking has some advantages, but so does using a real database, at work we use https://github.com/allaboutapps/integresql and I quite like the approach that integresql has, since it makes possible to have a fresh database with your dummy data for every test without impacting the execution speed (compared to dropping an re-creating the database).

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • I Write Tests in Go

    1 project | news.ycombinator.com | 10 Apr 2024
  • Direction of mockery: absorb different styles of mocks into this project · vektra mockery · Discussion #671

    1 project | /r/golang | 11 Jul 2023
  • Go: Write Mock Test cases using Mockery and

    1 project | dev.to | 10 May 2023
  • Mocking unexported interfaces?

    1 project | /r/golang | 28 Apr 2023
  • Integration Tests with Postgres

    2 projects | /r/golang | 29 Mar 2023

Did you konow that Go is
the 4th most popular programming language
based on number of metions?