Your Question

Is there a way to call a function (retrieve data from external API) in GORM and pass it data (e.g. ID) from a query, then include the data returned from the function in the query response ?

I see from the docs that there is a AfterFind hook which can presumably call a custom function, but I can't see how the data from the response can be included as custom (non stored) field in the response data.

If this is possible, pointers to some examples would be much appreciated.

Comment From: saeidee

This is related more to your application business logic, which means you want to use an entity as a response, you may try to use a different struct for your response/s and prepare it how you would like to send the data.