pgxscan

package module
v0.0.0-...-6b123da Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 7 Imported by: 0

README

Un-tested don't use!

This is a tool I created for another project that I have found a need for againm because of this I have extracted it to a public repo.

TODO: Write tests for this code

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueryColumnsTagsMismtach = fmt.Errorf("query returned less columns than DB tags on struct")

ErrQueryColumnsTagsMismtach is returned when not all struct tags count does not match query column count This is a non-fatal error and can be ignored if the above is by design or planned This however acts as a fail-safe to avoid missing columns inside your select calls

Functions

func QueryRow

func QueryRow(ctx context.Context, tx querier, input interface{}, query string, args ...interface{}) error

QueryRow is a wrapper around Query that allows us to avoid the verbose Scan call

func Rows

func Rows(rows pgx.Rows, input interface{}) error

Rows takes a pgx.Rows and pointer to a slice of struct It will simplify scanning by using the db tags on structs to avoid verbose Scan calls

Types

type ErrQueryReturnedExtraColumns

type ErrQueryReturnedExtraColumns struct {
	ValueType string
	Columns   []string
}

func (ErrQueryReturnedExtraColumns) Error

type ErrUnexportedProperty

type ErrUnexportedProperty struct {
	PropertyName string
}

func (ErrUnexportedProperty) Error

func (err ErrUnexportedProperty) Error() string

Jump to

Keyboard shortcuts

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