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

JSONB #2272

Open
astabeno opened this issue Mar 9, 2025 · 0 comments
Open

JSONB #2272

astabeno opened this issue Mar 9, 2025 · 0 comments

Comments

@astabeno
Copy link

astabeno commented Mar 9, 2025

I am trying to define a type in a struct with JSONB and it seems the struct isn't available with pgtype.

import (
"github.com/jackc/pgx/v5/pgtype"
)

type User struct {
ID int json:"id"
UID pgtype.UUID json:"uid"
Email string json:"email"
FirstName string json:"first_name"
LastName string json:"last_name"
PhoneNumber *string json:"phone_number"
Properties pgtype.JSONB json:"properties,omitempty" db:"properties"
}

I get a undefined: pgtype.JSONB error. Am I importing that correctly? I can see the file in the github repo and it seems it should be available but it looks like only JSONBCodec is available.

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

1 participant