sqlutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanRows

func ScanRows(r Rows, scanFunc func(row Scannable) error) error

ScanRows iterates over database rows and applies the provided scan function to each row. It handles proper resource cleanup by ensuring rows are closed after scanning is complete. Parameters:

  • r: A Rows interface that provides iteration over database query results
  • scanFunc: A function that will be called for each row to perform the scanning

Returns an error if scanning fails, if there's an error during iteration, or if closing the rows fails

Types

type Rows

type Rows interface {
	Close() error
	Err() error
	Next() bool
	Scan(dest ...any) error
}

Rows represents a database result set that can be iterated over. It provides methods for closing the result set, checking for errors, and scanning individual rows.

type Scannable

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

Scannable represents an object that can be scanned into a destination. It provides a Scan method that populates the destination arguments with the values from the object.

Jump to

Keyboard shortcuts

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