test

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains(array interface{}, s interface{}) bool

ArrayContains check if an element exists in an array using DeepEquals function

func DeepEquals

func DeepEquals(a, b interface{}) bool

DeepEquals returns equality between 2 elements using github.com/fsamin/go-dump

func Equal

func Equal(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{})

Equal checks that two elements are equal.

func EqualValuesWithoutOrder

func EqualValuesWithoutOrder(t *testing.T, a, b interface{}, msgAndArgs ...interface{})

EqualValuesWithoutOrder checks equality between two slices without respecting slide order

func Error

func Error(t *testing.T, err error, msg ...interface{})

Error logs Fatal if there is no error.

func NoError

func NoError(t *testing.T, err error, msg ...interface{})

NoError logs Fatal if there is an error.

func NotEmpty

func NotEmpty(t *testing.T, i interface{}, msg ...interface{})

NotEmpty logs Fatal if it's empty

func NotNil

func NotNil(t *testing.T, i interface{}, msg ...interface{})

NotNil logs Fatal if there is nil value.

func SetupPG

func SetupPG(t *testing.T, bootstrapFunc ...test.Bootstrapf) (*test.FakeTransaction, cache.Store)

SetupPG setup PG DB for test and use gorpmapping singleton's mapper.

func SetupPGWithFactory

func SetupPGWithFactory(t *testing.T, bootstrapFunc ...test.Bootstrapf) (*test.FakeTransaction, *database.DBConnectionFactory, cache.Store)

Types

type SqlExecutorMock

type SqlExecutorMock struct {
	Queries  []SqlExecutorMockQuery
	OnSelect func(i interface{})
}

func (*SqlExecutorMock) Delete

func (s *SqlExecutorMock) Delete(list ...interface{}) (int64, error)

func (*SqlExecutorMock) Exec

func (s *SqlExecutorMock) Exec(query string, args ...interface{}) (sql.Result, error)

func (*SqlExecutorMock) Get

func (s *SqlExecutorMock) Get(i interface{}, keys ...interface{}) (interface{}, error)

func (*SqlExecutorMock) Insert

func (s *SqlExecutorMock) Insert(list ...interface{}) error

func (SqlExecutorMock) LastQuery

func (s SqlExecutorMock) LastQuery() SqlExecutorMockQuery

func (*SqlExecutorMock) Query

func (s *SqlExecutorMock) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*SqlExecutorMock) QueryRow

func (s *SqlExecutorMock) QueryRow(query string, args ...interface{}) *sql.Row

func (*SqlExecutorMock) Select

func (s *SqlExecutorMock) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error)

func (*SqlExecutorMock) SelectFloat

func (s *SqlExecutorMock) SelectFloat(query string, args ...interface{}) (float64, error)

func (*SqlExecutorMock) SelectInt

func (s *SqlExecutorMock) SelectInt(query string, args ...interface{}) (int64, error)

func (*SqlExecutorMock) SelectNullFloat

func (s *SqlExecutorMock) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error)

func (*SqlExecutorMock) SelectNullInt

func (s *SqlExecutorMock) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error)

func (*SqlExecutorMock) SelectNullStr

func (s *SqlExecutorMock) SelectNullStr(query string, args ...interface{}) (sql.NullString, error)

func (*SqlExecutorMock) SelectOne

func (s *SqlExecutorMock) SelectOne(holder interface{}, query string, args ...interface{}) error

func (*SqlExecutorMock) SelectStr

func (s *SqlExecutorMock) SelectStr(query string, args ...interface{}) (string, error)

func (*SqlExecutorMock) Update

func (s *SqlExecutorMock) Update(list ...interface{}) (int64, error)

func (*SqlExecutorMock) UpdateColumns

func (s *SqlExecutorMock) UpdateColumns(columnFilter gorp.ColumnFilter, list ...interface{}) (int64, error)

func (*SqlExecutorMock) WithContext

func (s *SqlExecutorMock) WithContext(ctx context.Context) gorp.SqlExecutor

type SqlExecutorMockQuery

type SqlExecutorMockQuery struct {
	Query string
	Args  []interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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