How to make a custom SQL query on a collection in storage?

I’m writing a server authoritative two player turn based game using the GoLang runtime. Two players are matched and the state of their game is stored in a public (owned by the system) “MultiplayerGames” storage Collection using a unique UUID as the Key that identifies the game and the Value is a JSON object containing the state of the game including the UserIds of the two players involved. I want to write a GoLang runtime RPC that returns a list of active games that a particular UserId is involved in. Because these game states are owned by the system rather than one of the players involved in the game, I think I have to write a custom SQL query using the db *sql.DB that’s passed to the RPC function ? I imagine I will have to index the two UserIds in the JSON value to optimize the query too ? Is all this do-able and advisable and if so, can you point me to some sample code that queries Storage using SQL and also how to add these indexes ?

Answered in new thread: How to Index Storage JSON for Custom SQL Query?