-
Notifications
You must be signed in to change notification settings - Fork 49
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
Does Toucan support enumerated types? #80
Comments
Toucan doesn't support Postgres enums directly but it uses HoneySQL under the hood so you can do something like this (defn- pg-enum [enum-type value]
(reify
honeysql.format/ToSql
(to-sql [_]
(honeysql.format/add-anon-param value)
(format "?::\"%s\"" enum-type)))) Then you can use them in Toucan: (db/select Birds :bird_type (pg-enum "bird_type" "toucan")) |
I would suggest using a different approach that is idiomatic to the |
@camsaul My postgres db has an enumerated type. I see this possible hack for making that work in java-jdbc, but that looks messy and possibly destroys the type safety of the enum in the first place (not clear). I can probably live with just strings here, but any advice on making enums work with Toucan?
The text was updated successfully, but these errors were encountered: