mocks

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mocks provides mock implementations for testing sqlcredo components. It includes mock SQLExecutor and SQLResult types that implement the domain interfaces, allowing for isolated unit testing of database operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnExecCb added in v0.7.0

type OnExecCb func(ctx context.Context, query string, args ...any)

type OnSelectCb added in v0.7.0

type OnSelectCb func(ctx context.Context, dest any, query string, args ...any)

type SQLExecutor

type SQLExecutor struct {
	mock.Mock
	// contains filtered or unexported fields
}

func NewSQLExecutor

func NewSQLExecutor() *SQLExecutor

func (*SQLExecutor) Exec

func (m *SQLExecutor) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*SQLExecutor) SelectMany

func (m *SQLExecutor) SelectMany(ctx context.Context, dest any, query string, args ...any) error

func (*SQLExecutor) SelectOne

func (m *SQLExecutor) SelectOne(ctx context.Context, dest any, query string, args ...any) error

func (*SQLExecutor) SetOnExecCb added in v0.7.0

func (m *SQLExecutor) SetOnExecCb(cb OnExecCb)

func (*SQLExecutor) SetOnSelectManyCb added in v0.7.0

func (m *SQLExecutor) SetOnSelectManyCb(cb OnSelectCb)

func (*SQLExecutor) SetOnSelectOneCb added in v0.7.0

func (m *SQLExecutor) SetOnSelectOneCb(cb OnSelectCb)

type SQLResult

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

func NewSQLResult

func NewSQLResult(lastInsertID int64, rowsAffected int64) *SQLResult

func (*SQLResult) LastInsertId

func (r *SQLResult) LastInsertId() (int64, error)

func (*SQLResult) RowsAffected

func (r *SQLResult) RowsAffected() (int64, error)

Jump to

Keyboard shortcuts

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