MCPcopy
hub / github.com/jackc/pgx / RowToStructByName

Function RowToStructByName

rows.go:644–648  ·  view source on GitHub ↗

RowToStructByName returns a T scanned from row. T must be a struct. T must have the same number of named public fields as row has fields. The row and T fields will be matched by name. The match is case-insensitive. The database column name can be overridden with a "db" struct tag. If the "db" struct

(row CollectableRow)

Source from the content-addressed store, hash-verified

642// fields as row has fields. The row and T fields will be matched by name. The match is case-insensitive. The database
643// column name can be overridden with a "db" struct tag. If the "db" struct tag is "-" then the field will be ignored.
644func RowToStructByName[T any](row CollectableRow) (T, error) {
645 var value T
646 err := (&namedStructRowScanner{ptrToStruct: &value}).ScanRow(row)
647 return value, err
648}
649
650// RowToAddrOfStructByName returns the address of a T scanned from row. T must be a struct. T must have the same number
651// of named public fields as row has fields. The row and T fields will be matched by name. The match is

Callers

nothing calls this directly

Calls 1

ScanRowMethod · 0.65

Tested by

no test coverage detected