test

package
v0.0.0-...-dbd5446 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMockDB

func CheckMockDB(t *testing.T, mock sqlmock.Sqlmock)

func GenerateMockRows

func GenerateMockRows(headers []string, rows [][]driver.Value) *sqlmock.Rows

func NewMockDB

func NewMockDB() (sqlmock.Sqlmock, *gorm.DB)

func NewMockRepository

func NewMockRepository(db *gorm.DB) database.Repository

func Server

func Server() (*http.Client, *http.ServeMux, *httptest.Server)

Server returns a http Client, ServeMux, and Server. The client proxies requests to the server and handlers can be registered on the mux to handle requests. The caller must close the test server.

Types

type TestsModel

type TestsModel struct {
	ID         int64     `gorm:"column:id"`
	TestInt    int64     `gorm:"column:test_int"`
	TestString string    `gorm:"column:test_string"`
	TestBool   bool      `gorm:"column:test_bool"`
	TestFloat  float64   `gorm:"column:test_float"`
	TestTime   time.Time `gorm:"column:test_time"`
}

TestsModel Model for testing gorm database

func (TestsModel) TableName

func (TestsModel) TableName() string

Jump to

Keyboard shortcuts

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