Skip to content

Conversation

@fimac
Copy link
Contributor

@fimac fimac commented Oct 16, 2024

No description provided.

// `type EncryptedTextFieldTwo string`
//
// - ToDB and FromDB needs to be implemented for each custom type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a better way to do this.

I wanted to ensure that insert statements didn't need to be changed and only plaintext values were retrieved. Using the conversion interface allows us to convert from the go app type (e.g string) to the underlying db type (jsonb).

To do that, I needed to create a custom type, to then call the ToDb/FromDb method on.

The serialization/deserialization functions have been extracted to the goeql package currently sitting locally in the same folder (naming to tbc), so they can all be reused.

@fimac fimac mentioned this pull request Oct 16, 2024
@fimac fimac requested review from auxesis and calvinbrewer October 16, 2024 07:01
@fimac fimac marked this pull request as draft October 16, 2024 07:02
@calvinbrewer calvinbrewer marked this pull request as ready for review October 16, 2024 17:35
@calvinbrewer calvinbrewer merged commit 41f09f1 into main Oct 16, 2024
@calvinbrewer calvinbrewer deleted the test-creating-go-package branch October 16, 2024 17:36
tobyhede pushed a commit that referenced this pull request Oct 27, 2025
Go/Xorm examples with separate go package for helper functions
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.

4 participants