mapper

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStandardNullableType

func IsStandardNullableType(t reflect.Type) bool

IsStandardNullableType returns whether t can represent SQL NULL.

func IsStandardSpecialType

func IsStandardSpecialType(t reflect.Type) bool

IsStandardSpecialType returns whether t requires direct struct scanning.

func ScanAll

func ScanAll[T any](rows Rows, columnNames []string, hooks Hooks) ([]T, error)

ScanAll maps every row into T using column and struct metadata.

Types

type Hooks

type Hooks interface {
	IsNullableType(t reflect.Type) bool
	IsSpecialStruct(t reflect.Type) bool
	CreateSpecialScanTarget(fieldValue reflect.Value, fieldType reflect.Type) (any, bool)
	AssignSpecialValue(fieldValue reflect.Value, target any) (bool, error)
}

Hooks provides dialect-specific nullable and special-value behavior.

type Rows

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

Rows is the driver independent row iterator required by ScanAll.

type StandardHooks

type StandardHooks struct{}

StandardHooks implements Hooks for dialects that only need the standard nullable and special value tables.

func (StandardHooks) AssignSpecialValue

func (StandardHooks) AssignSpecialValue(reflect.Value, any) (bool, error)

AssignSpecialValue returns that no dialect-specific assignment exists.

func (StandardHooks) CreateSpecialScanTarget

func (StandardHooks) CreateSpecialScanTarget(reflect.Value, reflect.Type) (any, bool)

CreateSpecialScanTarget returns that no dialect-specific scan target exists.

func (StandardHooks) IsNullableType

func (StandardHooks) IsNullableType(t reflect.Type) bool

IsNullableType retursn whether t can represent SQL NULL.

func (StandardHooks) IsSpecialStruct

func (StandardHooks) IsSpecialStruct(t reflect.Type) bool

IsSpecialStruct returns whether t requires direct struct scanning.

Jump to

Keyboard shortcuts

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