utils

package
v3.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 1 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLResult added in v3.1.9

type SQLResult struct {
	Count   int           // Count is the number of rows returned.
	Columns []string      // Columns is the slice of column names.
	Rows    []interface{} // Rows is a slice of row data, where each row is a map of column name to value.
}

SQLResult holds the result of a SQL query.

It contains the count of rows, the columns present, and the actual row data.

func UnmarshalSQLRows

func UnmarshalSQLRows(rows *sql.Rows) (*SQLResult, error)

UnmarshalSQLRows converts sql.Rows into a more structured SQLResult.

This function takes *sql.Rows as input and attempts to unmarshal the data into a SQLResult struct. It handles different SQL data types by using the appropriate sql.Null* types during scanning. It returns a pointer to a SQLResult or an error.

The function closes the sql.Rows when finished.

Jump to

Keyboard shortcuts

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