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

Add postgres JSON cast type #160

Closed
wexder opened this issue Jun 4, 2022 · 3 comments
Closed

Add postgres JSON cast type #160

wexder opened this issue Jun 4, 2022 · 3 comments

Comments

@wexder
Copy link
Contributor

wexder commented Jun 4, 2022

Is your feature request related to a problem? Please describe.
We are using a lot of json fields in our postgres database. And it's hard to do the UPSERT with json column type.
Currect solution I found is double casting the json string.

  insertStm := table.INSERT(table.AllColumns).MODEL(table).
  ON_CONFLICT(table.SomeColumn).DO_UPDATE(
  postgres.SET(
    table.JsonColumn.SET(postgres.StringExp(postgres.CAST(postgres.String(*data)).AS("json"))),
    ),

Describe the solution you'd like
Add postgres.Json() func that would return StringExpression.

@wexder
Copy link
Contributor Author

wexder commented Jun 4, 2022

I've create PR for this #161

@go-jet
Copy link
Owner

go-jet commented Jun 6, 2022

Hi @wexder. Yeah, it makes sense to have a json literal.

@go-jet go-jet mentioned this issue Sep 30, 2022
@go-jet go-jet added this to the Version 2.9.0 milestone Sep 30, 2022
@go-jet
Copy link
Owner

go-jet commented Sep 30, 2022

Support added with v2.9.0 release.

@go-jet go-jet closed this as completed Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants