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

The template data object

The template data object that will be passed to the template renderer will be a templatedata.ShoppingCart struct (defined in the shared/templatedata/shoppingcart.go source file):

type ShoppingCart struct {  PageTitle string  Products []*models.Product}

The PageTitle field will be used to display the web page title and the Products field, a slice of Product objects, will be used to display the products that are currently in the shopping cart.

Now that we have the templates in place, let's take a look at modeling the shopping cart.

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