one more opt to postgres.Config (SkipDBInitialization), move the queue package folder up
This commit is contained in:
parent
f2b6bbcbc4
commit
bea9d67446
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/robfig/cron/v3"
|
||||
|
||||
"github.com/tribalwarshelp/cron/pkg/cron/queue"
|
||||
"github.com/tribalwarshelp/cron/pkg/queue"
|
||||
)
|
||||
|
||||
type Cron struct {
|
||||
|
|
|
@ -14,7 +14,8 @@ import (
|
|||
var log = logrus.WithField("package", "pkg/postgres")
|
||||
|
||||
type Config struct {
|
||||
LogQueries bool
|
||||
LogQueries bool
|
||||
SkipDBInitialization bool
|
||||
}
|
||||
|
||||
func Connect(cfg *Config) (*pg.DB, error) {
|
||||
|
@ -27,8 +28,10 @@ func Connect(cfg *Config) (*pg.DB, error) {
|
|||
})
|
||||
}
|
||||
|
||||
if err := prepareDB(db); err != nil {
|
||||
return nil, err
|
||||
if cfg == nil || !cfg.SkipDBInitialization {
|
||||
if err := prepareDB(db); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return db, nil
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/vmihailenco/taskq/v3/redisq"
|
||||
)
|
||||
|
||||
var log = logrus.WithField("package", "pkg/cron/queue")
|
||||
var log = logrus.WithField("package", "pkg/queue")
|
||||
|
||||
type Queue struct {
|
||||
redis redis.UniversalClient
|
Reference in New Issue