18 January, 2019

TIL #8 - GDPR, hashes, go subtests

Notes taken between: 14-18 January 2019


One of the projects I worked on recently was satisfying the new GDPR laws which requires online companies to delete any PII (personable identifiable information). Now lets say theres a table named user. you wouldnt want to delete the entire row as the user id isnt PII but is necessary to check if that user was already deleted. So, instead you would remove the content of the relevent fields "john" --> ""

A scenario we encountered was fields with unique constraints. which it wasnt possible for more than 1 field to be empty "". We ended up hashing the values.

hashes

you can never unhash something. hashes can be compared to see if something is unique.

base64

base64 containts 64 characters. A–Z, a–z, and 0–9. https://en.wikipedia.org/wiki/Base64

intellij shortcut

shift+f4 Replace and and also shows instance of it.

Go subtests

in a subtest, you're re-using the same DB for perfomance reasons; So then if for example on your fifth subtest you're inserting a user, their user ID would be 5. If you don't want to extract the subtest into it's own test; a little trick is to truncate the table.

t.Run("fifth subtest name", func(t *testing.T) {
conn.MustExec("TRUNCATE TABLE <insert table name>)