Lack of generics in go and a way to go around it in one particular case
Let’s look into this particular case of handling two different things in our db:
we have apples and we have bananas and we want to check if they are in the db and if so –
remove them. My background is C++, where one could do something like this:
So what is there to do in go? I figured, if we have a function that takes an apple- or bananaID we can just partially apply it and pass it into a more general remove function like so and have minimal repeating code:
Does it work? Yes! Is it a good practice/idea? You tell me! @JimboTheJam1