Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converting driver.Value bug #1227

Open
dino-ma opened this issue Oct 11, 2024 · 1 comment
Open

converting driver.Value bug #1227

dino-ma opened this issue Oct 11, 2024 · 1 comment

Comments

@dino-ma
Copy link
Contributor

dino-ma commented Oct 11, 2024

error

sql: Scan error on column index 1, name "signid": converting driver.Value type []uint8 ("13727213540140455812") to a int64: value out of range

table schema

Signid       int64     `gorm:"column:signid;not null;comment:XXXXXXX" json:"signid"`      


  `signid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'XXX',

gen query code

query.Use(db).UserQywxQrcode.WithContext(ctx).Where(table.ID.Eq(id)).First()

go.mod

        gorm.io/driver/sqlite v1.5.2
	gorm.io/gen v0.3.26
	gorm.io/gorm v1.25.11
	gorm.io/plugin/dbresolver v1.5.2
	gorm.io/plugin/soft_delete v1.1.0

how to fix

Skip the single ID when querying
@qqxhb
Copy link
Member

qqxhb commented Oct 11, 2024

https://gorm.io/gen/database_to_structs.html#Field-Options
Try FieldType("signid","uint64")

to a int64: value out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants