pgtype icon indicating copy to clipboard operation
pgtype copied to clipboard

invalid field found for struct github.com/jackc/pgtype.Inet's field IPNet: define a valid foreign key for relations or implement the Valuer/Scanner interface

Open keeprockin2019 opened this issue 3 years ago • 2 comments

migrations

CREATE TABLE IF NOT EXISTS  merchant (
  id SERIAL NOT NULL UNIQUE,
  bms_whitelist INET[] NOT NULL,
  api_whitelist INET[] NOT NULL,
  );

code

type Merchant struct{
Id                  uint64            `json:"id" gorm:"id"`
BmsWhitelist        *pgtype.InetArray `json:"bms_whitelist" gorm:"bms_whitelist"`
ApiWhitelist        *pgtype.InetArray `json:"api_whitelist" gorm:"api_whitelist"`
}

when I execute the query statement using gorm

[error] invalid field found for struct github.com/jackc/pgtype.Inet's field IPNet: define a valid foreign key for relations or implement the Valuer/Scanner interface

keeprockin2019 avatar Oct 06 '22 07:10 keeprockin2019

Any updates on this ?

Malay-Acharya avatar Jul 12 '24 13:07 Malay-Acharya