Skip to content

Add postgres JSON cast type #160

Closed
Closed
@wexder

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions