I've started using Google Cloud Datastore in one of the project in the company I currently work in.
In the provided example, they use a context and pass it to the connection instance
ctx := context.Background() dsClient, err := datastore.NewClient(ctx, "my-project")
Through the documentation you will see that they pass a context to all the functions that makes operations on the database, I am not sure if they are passing the same pointer or create a new pointer for each operation.
The current setup that I have is a global variable for the context in a package called "store" which I keep all the structs functions that communicate with the db, and I use that global variable each time. I don't know what is the effect of that, I am not sure why the context is used, Should I get reference of
context.Background() each time I make operations on the database ?