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

Unable to use netip.Addr in models #7359

Open
and3rson opened this issue Jan 25, 2025 · 2 comments
Open

Unable to use netip.Addr in models #7359

and3rson opened this issue Jan 25, 2025 · 2 comments
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@and3rson
Copy link

GORM Playground Link

go-gorm/playground#786

Description

Since (if I understand correctly) GORM uses pgx, I should be able to use netip.Addr since it's supported by the former.

However, model with netip.Addr field fails migration.

@github-actions github-actions bot added the type:with reproduction steps with reproduction steps label Jan 25, 2025
@and3rson
Copy link
Author

and3rson commented Jan 25, 2025

My mistake: I have to set type as gorm:"type:inet", not gorm:"inet". Closing.

@and3rson
Copy link
Author

and3rson commented Jan 25, 2025

Update: it still does not work, neither with or without the type:inet tag.

unsupported type netip.Addr, a struct

2025/01/25 16:23:29 playground/main_test.go:15 sql: converting argument $10 type: unsupported type netip.Addr, a struct
[0.194ms] [rows:0] INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`,`net_addr`) VALUES ("2025-01-25 16:23:29.548","2025-01-25 16:23:29.548",NULL,"jinzhu",0,NULL,NULL,NULL,false,"1.2.3.4") RETURNING `id`

@and3rson and3rson reopened this Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
Development

No branches or pull requests

2 participants