// NewQbsStoreFromDSN creates a *QbsStore from a DSN; DSNs can be created // directly with ParamsToDSN or from the environment with GetDSNOrDie, via // the DATABASE_URL environment var. func NewQbsStoreFromDSN(dsn *qbs.DataSourceName) *QbsStore { qbs.RegisterWithDataSourceName(dsn) result := &QbsStore{ Dsn: dsn, Policy: NewQbsDefaultOrmTransactionPolicy(), } return result }
func main() { dsn := new(qbs.DataSourceName) dsn.Password = "******" dsn.Username = "******" dsn.DbName = "pgsql" dsn.Dialect = qbs.NewPostgres() qbs.RegisterWithDataSourceName(dsn) dsn.Append("sslmode", "disable") qbs.SetConnectionLimit(10, false) mg, err := qbs.GetMigration() if err != nil { fmt.Println(err) } mg.Log = true mg.CreateTableIfNotExists(new(Process)) http.HandleFunc("/", do) http.ListenAndServe(":80", nil) }