Skip to content

parseTime DSN Option is mandatory for gorm.Model #175

@bodo-hugo-barwich

Description

@bodo-hugo-barwich

Describe the feature

For MySQL databases the DSN option parseTime needs to be True for any gorm.Model based model to work.

This should be by default on and only be disabled in special cases.

Or at least stated clearly that this option is required for gorm.Model to work properly.

Motivation

Any fetch on the resulting database structures fails with:
Fetch returns empty structure

2025/07/24 06:15:30 /home/runner/work/playground/playground/main_test.go:24 sql: Scan error on column index 1, name "created_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time
[0.791ms] [rows:1] SELECT * FROM `users` WHERE `users`.`id` = 1 AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT 1
    main_test.go:25: Failed, got error: sql: Scan error on column index 1, name "created_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time
User (1): User (1) was fetched

Related Issues

Fetch fails with parseTime unset

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions