dbtest

package
v0.0.0-...-8ad27d5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package dbtest contains supporting code for running tests that hit the DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPointer

func BoolPointer(b bool) *bool

BoolPointer is a helper to get a *bool from a bool. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

func FloatPointer

func FloatPointer(f float64) *float64

FloatPointer is a helper to get a *float64 from a float64. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

func IntPointer

func IntPointer(i int) *int

IntPointer is a helper to get a *int from a int. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

func ProductNamePointer

func ProductNamePointer(value string) *productbus.Name

ProductNamePointer is a helper to get a *Name from a string. It's in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

func StringPointer

func StringPointer(s string) *string

StringPointer is a helper to get a *string from a string. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

func UserNamePointer

func UserNamePointer(value string) *userbus.Name

UserNamePointer is a helper to get a *Name from a string. It's in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.

Types

type BusDomain

type BusDomain struct {
	Delegate *delegate.Delegate
	Home     *homebus.Business
	Product  *productbus.Business
	User     *userbus.Business
	VProduct *vproductbus.Business
}

BusDomain represents all the business domain apis needed for testing.

type Database

type Database struct {
	DB        *sqlx.DB
	Log       *logger.Logger
	BusDomain BusDomain
}

Database owns state for running and shutting down tests.

func NewDatabase

func NewDatabase(t *testing.T, edb *esqldb.Database) *Database

NewDatabase uses the specified database to perform testing. This database should be created using the `et.NewTestDatabase` call. A connection pool is provided with business domain packages.

Jump to

Keyboard shortcuts

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