I have this application where requests are filtered based on the string in the struct and made to execute different functions.
My approach is to have a Map which maps the strings to the function pointers and execute them. However this approach is being contended by a teammate who wants to do this filtering by reflection. We are using Go and it is for monitoring the activity of our site.
Teammates approach: Use reflection to switch the object based on the string, pass the string to the function and let the function call the relevant function. My approach: Simple map from string to functions
Any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire