github.com/jasonish/buffalo@v0.8.2-0.20170413145823-bacbdd415f1b/examples/html-resource/models/models.go (about)

     1  package models
     2  
     3  import (
     4  	"log"
     5  	"os"
     6  
     7  	"github.com/markbates/going/defaults"
     8  	"github.com/markbates/pop"
     9  )
    10  
    11  // DB is a sql database connection
    12  var DB *pop.Connection
    13  
    14  func init() {
    15  	var err error
    16  	env := defaults.String(os.Getenv("GO_ENV"), "development")
    17  	DB, err = pop.Connect(env)
    18  	if err != nil {
    19  		log.Fatal(err)
    20  	}
    21  	pop.Debug = env == "development"
    22  }