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

Json mapping MariaDB #1606

Open
ghost opened this issue Dec 3, 2021 · 1 comment
Open

Json mapping MariaDB #1606

ghost opened this issue Dec 3, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 3, 2021

Hello all,

we are using MariaDB as database and I would like to store a Circe json in the database.
In the documentation I saw that for Postgres you can use the following code for a bidirectional mapping:

implicit val jsonMeta: Meta[Json] =
  Meta.Advanced.other[PGobject]("json").timap[Json](
    a => parse(a.getValue).leftMap[Json](e => throw e).merge)(
    a => {
      val o = new PGobject
      o.setType("json")
      o.setValue(a.noSpaces)
      o
    }
  )

Since I don't have PGObject with MariaDB, how else could I do this mapping ?
Thanks a lot

@jatcwang
Copy link
Collaborator

jatcwang commented Dec 6, 2021

@jmw847 PGobject is PostgreSQL JDBC driver's way of allowing you to set the value of a custom type (in this case the custom type is JSON). You'd need to find the equivalent way to do that in MariaDB's JDBC driver. (Sorry I spent a few min looking but didn't find anything)

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