sql

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EOF error = errors.New("EOF")

EOF describes the error that should be returned when asynchronous operations have concluded

Functions

func ReadRows

func ReadRows[T any](rows *sql.Rows) ([]*T, error)

ReadRows extracts all the data from a single SQL result set into a slice of the specified type. This function attempts to map each column in the result set to an associated field on the item, based on the value of an "sql" tag, a "json" tag or the field name in that order. The mapping is case-insensitive. If any column can't be mapped then an error will be returned.

func ReadRowsAsync added in v1.1.13

func ReadRowsAsync[T any](rows *sql.Rows, objCh chan<- *T, errCh chan<- error)

ReadRowsAsync extracts all the data from a single SQL result set, converts each item into an object of the specified type and sends the result to a channel. This function also sends any error that occurs to the channel. This allows the function to be run concurrently with other functions. This function will exit when an error occurs

Types

This section is empty.

Jump to

Keyboard shortcuts

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