github.com/seeker-insurance/kit@v0.0.13/db/psql/testdb.go (about)

     1  package psql
     2  
     3  import (
     4  	"github.com/jinzhu/gorm"
     5  
     6  	//register postgres dialect
     7  
     8  	_ "github.com/jinzhu/gorm/dialects/postgres"
     9  )
    10  
    11  const (
    12  	testDBName = "test"
    13  	postgres   = "postgres"
    14  	url        = `postgresql://localhost/test?sslmode=disable`
    15  )
    16  
    17  func TestDB() (*gorm.DB, error) {
    18  	return gorm.Open(postgres, url)
    19  }