sqldb

package
v0.0.0-...-90949e5 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	DB() *sql.DB
	PingContext(ctx context.Context) error
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) Row
}

func NewPostgres

func NewPostgres(dsn string) (DB, error)

type DBMock

type DBMock struct {
	mock.Mock
}

func (*DBMock) DB

func (m *DBMock) DB() *sql.DB

func (*DBMock) ExecContext

func (m *DBMock) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DBMock) PingContext

func (m *DBMock) PingContext(ctx context.Context) error

func (*DBMock) QueryRowContext

func (m *DBMock) QueryRowContext(ctx context.Context, query string, args ...interface{}) Row

type Postgres

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

func (*Postgres) DB

func (p *Postgres) DB() *sql.DB

func (*Postgres) ExecContext

func (p *Postgres) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*Postgres) PingContext

func (p *Postgres) PingContext(ctx context.Context) error

func (*Postgres) QueryRowContext

func (p *Postgres) QueryRowContext(ctx context.Context, query string, args ...interface{}) Row

type ResultMock

type ResultMock struct {
	mock.Mock
}

func (*ResultMock) LastInsertId

func (m *ResultMock) LastInsertId() (int64, error)

func (*ResultMock) RowsAffected

func (m *ResultMock) RowsAffected() (int64, error)

type Row

type Row interface {
	Scan(args ...interface{}) error
	Err() error
}

type RowMock

type RowMock struct {
	mock.Mock
}

func (*RowMock) Err

func (r *RowMock) Err() error

func (*RowMock) Scan

func (r *RowMock) Scan(args ...interface{}) error

Jump to

Keyboard shortcuts

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