예제 #1
0
func init() {
	st := NewSuite("qbs")
	st.InitF = func() {
		st.AddBenchmark("Insert", 2000*ORM_MULTI, QbsInsert)
		st.AddBenchmark("MultiInsert 100 row", 500*ORM_MULTI, QbsInsertMulti)
		st.AddBenchmark("Update", 2000*ORM_MULTI, QbsUpdate)
		st.AddBenchmark("Read", 4000*ORM_MULTI, QbsRead)
		st.AddBenchmark("MultiRead limit 100", 2000*ORM_MULTI, QbsReadSlice)

		qbs.Register("mysql", ORM_SOURCE, "model", qbs.NewMysql())
		qbs.ChangePoolSize(ORM_MAX_IDLE)
		qbs.SetConnectionLimit(ORM_MAX_CONN, true)

		qo, _ = qbs.GetQbs()
	}
}
예제 #2
0
파일: k.go 프로젝트: rose312/mzr
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)
}