pgmock

package module
v0.0.0-...-9a1f4ac Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 8 Imported by: 0

README

pgmock

Mock go-pg databases

Forked from yusufsyaifudin/gopg-mock

Usage

See in directory examples.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
}

Formatter implements orm.Formatter

func (*Formatter) FormatQuery

func (f *Formatter) FormatQuery(b []byte, query string, params ...interface{}) []byte

type OrmResult

type OrmResult struct {
	// contains filtered or unexported fields
}

OrmResult struct to implements orm.Result

func NewResult

func NewResult(rowAffected, rowReturned int, model interface{}) *OrmResult

NewResult implements orm.Result in go-pg package

func (*OrmResult) Model

func (o *OrmResult) Model() orm.Model

func (*OrmResult) RowsAffected

func (o *OrmResult) RowsAffected() int

func (*OrmResult) RowsReturned

func (o *OrmResult) RowsReturned() int

type SQLMock

type SQLMock struct {
	// contains filtered or unexported fields
}

func NewGoPGDBTest

func NewGoPGDBTest() (conn orm.DB, mock *SQLMock, err error)

NewGoPGDBTest returns method that already implements orm.DB and mock instance to mocking arguments and results.

func (*SQLMock) ExpectExec

func (sqlMock *SQLMock) ExpectExec(query string) *SQLMock

func (*SQLMock) ExpectQuery

func (sqlMock *SQLMock) ExpectQuery(query string) *SQLMock

func (*SQLMock) FlushAll

func (sqlMock *SQLMock) FlushAll()

func (*SQLMock) Returns

func (sqlMock *SQLMock) Returns(result *OrmResult, err error)

func (*SQLMock) WithArgs

func (sqlMock *SQLMock) WithArgs(params ...interface{}) *SQLMock

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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