I am trying to parse mySQL errors in order to return clean error message to the user from my golang API. I read some article like this one that show what I would like to do but it looks like the module go-mysql-driver that I am using don't support parseError.
To give a concrete example of what I try to achieve, with the error:
Error 1062: Duplicate entry 'John' for key 'name_UNIQUE'
I would like to be able to build a data structure that allow me to organize the information in order to return a user friendly message like
Error with the field 'name': 'John' already exist"
so I can also translate it in different language and directly print it client side.
Thank you!