Exemple #1
0
func main() {
	con, err := db.Connect(cfg.Config.DatabaseURL, cfg.Config.ApplicationName+"_gtmigrate")
	if err != nil {
		log.Fatal(errors.ErrorWithStack(err))
	}

	err = db.WithTx(con, func(tx db.Tx) error {
		l := logger.New(">>")
		return migrations.Exec(l, tx)
	})

	if err != nil {
		log.Fatal(errors.ErrorWithStack(err))
	}
}
Exemple #2
0
func main() {
	l := logger.New()

	txManager, err := newTxManager()
	if err != nil {
		log.Fatal(errors.ErrorWithStack(err))
	}

	router := web.NewRouter(l, txManager)

	port := getPort()
	l.Printf("Starting server on port=%s", port)

	err = http.ListenAndServe(port, router)
	if err != nil {
		log.Fatalf("Can not start server\n%s", errors.ErrorWithStack(err))
	}
}