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 proper support for postgres enum #246

Closed
wants to merge 1 commit into from
Closed

Add proper support for postgres enum #246

wants to merge 1 commit into from

Conversation

yaroot
Copy link
Contributor

@yaroot yaroot commented Jul 26, 2019

Postgres enums are encoded with PgObject in jdbc (and doobie). PgObject is basically just a (type: String, value: String)pair, doobie-postgres has basic support for it. The approach will be different from other modules so I'd like to get some feedback.

Right now I have the very basic implementation, basically you need to feed a type name (in postgres) to DoobiePgEnum.meta and get back a Meta instance for your enum. I'd like to have a more convenient API but seems hard without using lazy val or macros.

@yaroot yaroot changed the title [WIP] add proper postgres enum support [WIP] add proper support for postgres enum Jul 26, 2019
@coveralls
Copy link

coveralls commented Jul 26, 2019

Coverage Status

Coverage increased (+0.03%) to 91.348% when pulling 9aabcef on yaroot:doobie-pg into 0e19f28 on lloydmeta:master.

@lloydmeta
Copy link
Owner

Sorry it took a while for me to get back to you on this: I had to take a look at https://github.com/tpolecat/doobie/blob/f17d00fae2ba7a46d1dcb40b57a937a9a998abba/modules/postgres/src/main/scala/doobie/postgres/Instances.scala#L147-L165 to understand what was going on :)

I think this is a reasonable approach to supporting PG enums; can you add some tests, etc so we can try/hash out the API?

@yaroot
Copy link
Contributor Author

yaroot commented Aug 9, 2019

Unrelated tests are failing..

@yaroot yaroot changed the title [WIP] add proper support for postgres enum Add proper support for postgres enum Oct 10, 2019
@yaroot
Copy link
Contributor Author

yaroot commented Oct 10, 2019

@lloydmeta sorry for disappearing, please have a look, basic support is there. Should this be in a separate package?

@lloydmeta
Copy link
Owner

After giving it some thought, I think rather than this being something included in enumeratum-doobie, which adds support for doobie-core, I think this makes more sense as a separate module, given as how doobie-postgres is its own separate dependency. Thoughts?

@lloydmeta lloydmeta closed this Oct 22, 2019
@lloydmeta lloydmeta reopened this Oct 22, 2019
@yaroot
Copy link
Contributor Author

yaroot commented Oct 28, 2019

@lloydmeta done

@lloydmeta
Copy link
Owner

@yaroot sorry I was unclear, what I meant was not for you to create another module in this project, but to publish it yourself. I haven't myself used the doobie-postgres integration extensively enough to be a good steward for this integration.

@yaroot
Copy link
Contributor Author

yaroot commented Oct 31, 2019

alright, that's fine

@yaroot yaroot closed this Oct 31, 2019
@yaroot yaroot deleted the doobie-pg branch October 31, 2019 12:33
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

Successfully merging this pull request may close these issues.

None yet

3 participants