Beispiel #1
0
func initTestDb(t *testing.T) *gorp.DbMap {
	// connect to db using standard Go database/sql API
	// use whatever database/sql driver you wish
	dbmap := rr.InitDb("postgres://localhost/rr_test?sslmode=disable")

	err := dbmap.CreateTablesIfNotExists()
	ok(t, err)

	// delete any existing rows
	err = dbmap.TruncateTables()
	ok(t, err)

	return dbmap
}
Beispiel #2
0
func main() {
	dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		panic(err)
	}
	os.Setenv("RR_ROOT", dir)

	// database
	rr.InitDb(os.Getenv("DATABASE_URL"))

	gokiq.Workers.RedisPool = redis.NewPool(rr.RedisConnect(os.Getenv("REDIS_URL")), 1)

	gokiq.Workers.PollInterval = 1 * time.Second
	gokiq.Workers.RedisNamespace = "rr"
	gokiq.Workers.WorkerCount = 5

	gokiq.Workers.Register(&rr.UserCallbackJob{})
	gokiq.Workers.Register(&rr.NewAccountEmailJob{})

	gokiq.Workers.Run()
}