O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving the product detail from the datastore

The product registry data store in the Redis datastore is JSON data representing a slice of strings. We use the Unmarshal function found in the json package to unmarshal the JSON encoded data into the productKeys variable. Now, that we have all the product keys that should be displayed on the products listing page, it's time to create a product instance for each key. We do so, by first declaring the products variable that will be a slice of products. We iterate through the product keys and derive the productTitle value, which is the SEO friendly name of the product. We supply the productTitle variable to the GetProductDetail method of the Redis datastore to fetch a product for the given product ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required