-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathmodels.go
More file actions
60 lines (51 loc) · 1.26 KB
/
models.go
File metadata and controls
60 lines (51 loc) · 1.26 KB
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
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.20.0
package querytest
import (
"database/sql/driver"
"fmt"
)
type AuthorsStatus string
const (
AuthorsStatusInit AuthorsStatus = "init"
AuthorsStatusDone AuthorsStatus = "done"
AuthorsStatusCanceled AuthorsStatus = "canceled"
AuthorsStatusProcessing AuthorsStatus = "processing"
AuthorsStatusWaiting AuthorsStatus = "waiting"
)
func (e *AuthorsStatus) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AuthorsStatus(s)
case string:
*e = AuthorsStatus(s)
default:
return fmt.Errorf("unsupported scan type for AuthorsStatus: %T", src)
}
return nil
}
type NullAuthorsStatus struct {
AuthorsStatus AuthorsStatus
Valid bool // Valid is true if AuthorsStatus is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAuthorsStatus) Scan(value interface{}) error {
if value == nil {
ns.AuthorsStatus, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AuthorsStatus.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAuthorsStatus) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.AuthorsStatus), nil
}
type Author struct {
ID int64
Status AuthorsStatus
}