-
Notifications
You must be signed in to change notification settings - Fork 3
/
liteq.go
41 lines (31 loc) · 906 Bytes
/
liteq.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package liteq
import (
"context"
"database/sql"
"github.com/khepin/liteq/internal"
)
// Creates the db file with the tables and indexes
func Setup(db *sql.DB) error {
_, err := db.Exec(internal.Schema)
return err
}
func New(db *sql.DB) *JobQueue {
queries := internal.New(db)
return &JobQueue{queries}
}
type JobQueue struct {
queries *internal.Queries
}
type QueueJobParams = internal.QueueJobParams
type DedupingKey = internal.DedupingKey
type IgnoreDuplicate = internal.IgnoreDuplicate
type ReplaceDuplicate = internal.ReplaceDuplicate
func (jq *JobQueue) QueueJob(ctx context.Context, params QueueJobParams) error {
return jq.queries.QueueJob(ctx, params)
}
type ConsumeParams = internal.ConsumeParams
func (jq *JobQueue) Consume(ctx context.Context, params ConsumeParams) error {
return jq.queries.Consume(ctx, params)
}
type ErrorList = internal.ErrorList
type Job = internal.Job