Skip to content

Instantly share code, notes, and snippets.

@timmow
Created May 22, 2017 11:14
Show Gist options
  • Save timmow/984bb1b1fbea5878925d71a73a6bd225 to your computer and use it in GitHub Desktop.
Save timmow/984bb1b1fbea5878925d71a73a6bd225 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
func main() {
fmt.Println("vim-go")
// Could use config/config.go Connect here
db, err := gorm.Open("postgres", "<redacted>")
if err != nil {
// return a 500 maybe make error more useful
fmt.Println("cant connect to db")
}
// maybe run a query
defer db.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment