func initTpl() { templates = make(map[string]*template.Template) layouts, err := filepath.Glob("views/*.html") //Get the list of template files app.Chk(err) includes, err := filepath.Glob("views/includes/*.html") //Get the list of include files app.Chk(err) for _, layout := range layouts { files := append(includes, layout) // Parse the layout tpl file and all the includes templates[filepath.Base(layout)] = template.Must(template.ParseFiles(files...)) } }
// NewCassandra returns a cassandra object func NewCassandra(host, keyspace string) *Cassandra { // connect to the cluster cluster := gocql.NewCluster(host) cluster.Keyspace = keyspace cluster.Consistency = gocql.Quorum csession, err := cluster.CreateSession() app.Chk(err) return &Cassandra{session: csession} }