constructsql

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertRowsAffected

func AssertRowsAffected(operation string, expectedRows int) func(sql.Result, error) error

AssertRowsAffected checks if the given result affected exactly the expected number of rows.

func CollectRows

func CollectRows[T any](rows Rows, err error) ([]T, error)

CollectRows collects all rows to the given target type from a ExecutiveQueryBuilder.Query result.

func ScanRow

func ScanRow[T any](row RowScanner, err error) (T, error)

ScanRow scans a single row to the given target type from a ExecutiveQueryBuilder.QueryRow result. It expects a single JSON column to be selected and unmarshals to the given struct type.

Types

type RowScanner

type RowScanner interface {
	Scan(dest ...any) error
}

type Rows

type Rows interface {
	RowScanner
	Next() bool
	Close() error
	Err() error
}

Jump to

Keyboard shortcuts

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