-
Hi 👋, I have a column that needs to be encrypted in the database and decrypted in the model. What is the best way to solve this with SQLBoiler? I'm using Postgres, not sure if I should be doing this at the database level or writing some custom code? NOTE: My use case it not a password so it doesn't need to be bcyrpted, this needs to be reversible encryption. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You could attempt to use the sqlboiler hook system that's available. The database isn't usually where I put this but you could maybe accomplish it with a view & trigger if you wanted to. |
Beta Was this translation helpful? Give feedback.
-
Another alternative is to create a custom type for your column that does the encryption/decryption in the Scan/Value methods and use the types.replace configuration to use that type in your model. |
Beta Was this translation helpful? Give feedback.
You could attempt to use the sqlboiler hook system that's available. The database isn't usually where I put this but you could maybe accomplish it with a view & trigger if you wanted to.