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 support for Postgres encode and decode expressions #856

Closed
dbrgn opened this Issue Apr 11, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@dbrgn
Contributor

dbrgn commented Apr 11, 2017

Postgres supports string encoding and decoding (to and from bytea columns):

https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-OTHER

Examples:

SELECT encode(data, 'base64') FROM blobcache;
SELECT encode(pubkey, 'hex') FROM public_keys;

Supported formats: base64, hex, escape.

Would be great if these were usable from diesel.

@sgrif

This comment has been minimized.

Member

sgrif commented Apr 12, 2017

You can declare any function you'd like with the sql_function! macro. http://docs.diesel.rs/diesel/macro.sql_function.html

@sgrif sgrif closed this Apr 12, 2017

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