-
-
Notifications
You must be signed in to change notification settings - Fork 171
WIP: Add support for pgx v5 interface #523
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
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # go.mod # go.sum # internal/testutils/test_utils.go # qrm/scan_context.go # tests/postgres/main_test.go # tests/postgres/northwind_test.go
feat: add preliminary json support for qrm_pgx.
# Conflicts: # go.mod # go.sum
# Conflicts: # tests/postgres/alltypes_test.go # tests/postgres/select_json_test.go
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (64.24%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #523 +/- ##
==========================================
- Coverage 92.18% 91.68% -0.51%
==========================================
Files 139 140 +1
Lines 8576 8728 +152
==========================================
+ Hits 7906 8002 +96
- Misses 493 532 +39
- Partials 177 194 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you so much for this @go-jet I'm reviewing this and the adapter thread now. |
|
Works great so far! We may have covered this in the past but I'm trying to refresh my memory. Any reason for Doing Generated public.table Generated model Both are right, but including them it case TimestampTz matters. The same generated table and model work when not using |
The reason is because
Does it work with standard |
Makes sense. Though V5 Has been out for ~4 years now so not expecting a major update any time soon, having the latest PGX version under I tried to JsonPQ version, same issue, must be something destination wise but the normal PQ/PGX versions work with the same dest which is odd. Just doing the typical Jet Generated Type type News struct {
Title string `json:"title"`
Body string `json:"body"`
Type string `json:"type"`
CreatedAt time.Time `json:"created_at"`
ID uuid.UUID `sql:"primary_key" json:"id"`
}My Custom Type package models
import "jetpgxpoc/gen/public/model"
type News struct {
model.News
} Then stmt := postgres.
SELECT_JSON_ARR(table.News.AllColumns).
FROM(table.News).
ORDER_BY(table.News.CreatedAt.DESC()).
LIMIT(limit)
var newsSlice []models.News // My custom type news
if err := stmt.QueryContext(ctx, db, &newsSlice); err != nil {We don't have to pollute this PR with this probably separate issue though. |
|
Aha I see where the issue is. CreatedAt time.Time `json:"created_at"you are using snake case. So the fix is: CreatedAt time.Time `json:"createdAt" // or `json:"CreatedAt" or you can remove json tag completely.Also |
Gotcha, I'll play more with it another time when optimizing complex join queries. I haven't run into any issues yet with implementing this PR into prod. Appreciate your great work as always! |
No description provided.