test

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeDatabase

type FakeDatabase struct {
	*gorm.DB
}

FakeDatabase provides a minimal in-memory database implementation to use during tests in place of a GORM database.

func NewFakeDatabase

func NewFakeDatabase(t TestObject) *FakeDatabase

NewFakeDatabase instantiates a fake database.

func (*FakeDatabase) CreateTablesFromEntities

func (database *FakeDatabase) CreateTablesFromEntities(t TestObject, tableEntityPointers ...interface{}) *FakeDatabase

CreateTableFromEntity creates new tables in the database using the provided entity pointers.

func (*FakeDatabase) SaveEntities

func (database *FakeDatabase) SaveEntities(t TestObject, entityPointers ...interface{}) *FakeDatabase

SaveEntities takes a collection of entity pointers and saves them to the fake database.

func (*FakeDatabase) SetError

func (database *FakeDatabase) SetError(t TestObject, err error) *FakeDatabase

type TestObject

type TestObject interface {
	Errorf(format string, args ...interface{})
	FailNow()
}

TestObject is a minimal interface for interacting with Golang tests.

Jump to

Keyboard shortcuts

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