Skip to content

ScanRows doesn't reset fields in target struct for incoming null values #6819

@turip

Description

@turip

GORM Playground Link

go-gorm/playground#686

Description

Starting with gorm v1.25.1 (v1.25.0 was not affected), if I use ScanRows on a struct that is not initialized to its default value for all fields GORM will not overwrite those fields that are NULL on SQL side.

An example codpiece can be found at go-gorm/playground#686, but generally speaking we have encountered it when using a non-builtin type too (https://github.com/shopspring/decimal).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions