Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

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 #190

@keeprockin2019

Description

@keeprockin2019

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions