docker | database connection refused between two containers
Your golang api should be included in the compose file and added to the same network.

It also looks like when you run the golang api that you are adding it to a network other than backend, which is the network that is created in your compose file.