sqlhelp

package
v1.5.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sqlhelp contains testing helpers for sql transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmpIfErr

func CmpIfErr(t *testing.T, err error, old, actual, new interface{}, msg string)

CmpIfErr is the macro which'll take an error and the expected cases (old actual and new) In case of being errored, it'll cmp actual with old (to check if there are undesired changes) Else, it'll cmp actual with new (to check if the changes are correct)

func CmpWithGoldenFile

func CmpWithGoldenFile(t *testing.T, got []byte, goldenFilename, msg string)

CmpWithGoldenFile performs cmp over the goldenFile and the got bytes given Note: avoid testdata/%s when giving the filename

func MockDB

func MockDB(t *testing.T) (db *sqlx.DB, mock sqlmock.Sqlmock)

MockDB wraps sqlmock.New with sqlx to return *sqlx.DB with sqlmock.Mock

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL