concept this listing in category go

This is an excerpt from Manning's book Go Web Programming.
This command should create the necessary database tables in your database. Once you have your database tables, you must be able to connect to the database and do stuff with the tables. So you’ll create a global variable, Db, which is a pointer to sql.DB, a representation of a pool of database connections. You’ll define Db in the data.go file, as shown in the following listing. Note that this listing also contains a function named init that initializes Db upon startup of your web application. You’ll use Db to execute your queries.
Go templates are text documents (for web apps, these would normally be HTML files), with certain commands embedded in them, called actions. In the Go template engine, a template is text (usually in a template file) that has embedded actions. The text is parsed and executed by the template engine to produce another piece of text. Go has a text/template standard library that’s a generic template engine for any type of text format, as well as an html/template library that’s a specific template engine for HTML. Actions are added between two double braces, {{ and }} (although these delimiters can be changed programmatically). We’ll get into actions later in this chapter. This listing shows an example of a very simple template.
The answer to this dilemma is that the Go template engine doesn’t work this way. Although we can have each template file define a single template, with the name of the template as the name of the file, we can explicitly define a template in a template file using the define action. This listing shows our layout.html now.
Listing 5.23. Defining a template explicitly
{{ define "layout" }} <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Go Web Programming</title> </head> <body> {{ template "content" }} </body> </html> {{ end }}Notice that we start the file with {{ define "layout" }} and end it with {{ end }}. Anything within these two action tags is considered part of the layout template. This means if we have another define action tag after the {{ end }} we can define another template! In other words, we can define multiple templates in the same template file, as you can see in this listing.