fix: issues
This commit is contained in:
@@ -4,21 +4,16 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
_ "go.ipao.vip/atom"
|
||||
_ "go.ipao.vip/atom/contracts"
|
||||
. "github.com/riverqueue/river"
|
||||
_ "go.ipao.vip/atom"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
)
|
||||
|
||||
var (
|
||||
_ JobArgs = (*{{.Name}}Job)(nil)
|
||||
_ JobArgsWithInsertOpts = (*{{.Name}}Job)(nil)
|
||||
)
|
||||
var _ contracts.JobArgs = (*{{.Name}})(nil)
|
||||
|
||||
type {{.Name}}Job struct {
|
||||
}
|
||||
type {{.Name}} struct {}
|
||||
|
||||
// InsertOpts implements JobArgsWithInsertOpts.
|
||||
func (s {{.Name}}Job) InsertOpts() InsertOpts {
|
||||
func (s {{.Name}}) InsertOpts() InsertOpts {
|
||||
return InsertOpts{
|
||||
Queue: QueueDefault,
|
||||
Priority: PriorityDefault,
|
||||
@@ -28,21 +23,20 @@ func (s {{.Name}}Job) InsertOpts() InsertOpts {
|
||||
}
|
||||
}
|
||||
|
||||
func ({{.Name}}Job) Kind() string {
|
||||
return "{{.Name}}Job"
|
||||
}
|
||||
func ({{.Name}}) Kind() string { return "{{.Name}}" }
|
||||
func (arg {{.Name}}) UniqueID() string { return arg.Kind()}
|
||||
|
||||
var _ Worker[{{.Name}}Job] = (*{{.Name}}JobWorker)(nil)
|
||||
var _ Worker[{{.Name}}] = (*{{.Name}}Worker)(nil)
|
||||
|
||||
// @provider(job)
|
||||
type {{.Name}}JobWorker struct {
|
||||
WorkerDefaults[{{.Name}}Job]
|
||||
type {{.Name}}Worker struct {
|
||||
WorkerDefaults[{{.Name}}]
|
||||
}
|
||||
|
||||
func (w *{{.Name}}JobWorker) NextRetry(job *Job[{{.Name}}Job]) time.Time {
|
||||
func (w *{{.Name}}Worker) NextRetry(job *Job[{{.Name}}]) time.Time {
|
||||
return time.Now().Add(5 * time.Second)
|
||||
}
|
||||
|
||||
func (w *{{.Name}}JobWorker) Work(ctx context.Context, job *Job[{{.Name}}Job]) error {
|
||||
func (w *{{.Name}}Worker) Work(ctx context.Context, job *Job[{{.Name}}]) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -8,13 +8,11 @@ import (
|
||||
. "github.com/riverqueue/river"
|
||||
log "github.com/sirupsen/logrus"
|
||||
_ "go.ipao.vip/atom"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
_ "go.ipao.vip/atom/contracts"
|
||||
)
|
||||
|
||||
var (
|
||||
_ JobArgs = SortArgs{}
|
||||
_ JobArgsWithInsertOpts = SortArgs{}
|
||||
)
|
||||
var _ contracts.JobArgs = SortArgs{}
|
||||
|
||||
type SortArgs struct {
|
||||
Strings []string `json:"strings"`
|
||||
@@ -27,9 +25,8 @@ func (s SortArgs) InsertOpts() InsertOpts {
|
||||
}
|
||||
}
|
||||
|
||||
func (SortArgs) Kind() string {
|
||||
return "sort"
|
||||
}
|
||||
func (SortArgs) Kind() string { return "sort" }
|
||||
func (a SortArgs) UniqueID() string { return a.Kind() }
|
||||
|
||||
var _ Worker[SortArgs] = (*SortWorker)(nil)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package job
|
||||
|
||||
import (
|
||||
"context"
|
||||
"quyun/providers/postgres"
|
||||
"sync"
|
||||
|
||||
"{{.ModuleName}}/providers/postgres"
|
||||
@@ -18,18 +17,6 @@ import (
|
||||
"go.ipao.vip/atom/container"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
"go.ipao.vip/atom/opt"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/riverqueue/river"
|
||||
"github.com/riverqueue/river/riverdriver/riverpgxv5"
|
||||
"github.com/riverqueue/river/rivertype"
|
||||
"github.com/samber/lo"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"go.ipao.vip/atom/container"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
"go.ipao.vip/atom/opt"
|
||||
)
|
||||
|
||||
func Provide(opts ...opt.Option) error {
|
||||
|
||||
Reference in New Issue
Block a user