jackc / jackc/pgx

JSONB

Open
#2,272 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

Research direction

The report points to pgtype and the JSONBCodec symbol but does not name a source file or test. Start by checking the pgtype JSONB definitions in the v5 repository and compare the public API with the import shown; done means the supported representation and import path are clear or the missing API is captured in a focused issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.