forked from vgarvardt/gue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
71 lines (62 loc) · 1.35 KB
/
models.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.17.2
package database
import (
"database/sql"
"database/sql/driver"
"fmt"
"time"
)
type JobStatus string
const (
JobStatusPending JobStatus = "pending"
JobStatusProcessing JobStatus = "processing"
JobStatusFinished JobStatus = "finished"
JobStatusFailed JobStatus = "failed"
)
func (e *JobStatus) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = JobStatus(s)
case string:
*e = JobStatus(s)
default:
return fmt.Errorf("unsupported scan type for JobStatus: %T", src)
}
return nil
}
type NullJobStatus struct {
JobStatus JobStatus
Valid bool // Valid is true if JobStatus is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullJobStatus) Scan(value interface{}) error {
if value == nil {
ns.JobStatus, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.JobStatus.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullJobStatus) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.JobStatus), nil
}
type Job struct {
ID int64
Priority int16
RunAt time.Time
JobType string
Payload []byte
Metadata []byte
ErrorCount int32
LastError sql.NullString
Queue string
Status JobStatus
CreatedAt time.Time
UpdatedAt time.Time
}