forked from blastrain/octillery
/
proxy_113.go
65 lines (56 loc) · 1.39 KB
/
proxy_113.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
// +build go1.13
package sql
import (
core "database/sql"
"time"
"github.com/pkg/errors"
"github.com/aokabi/octillery/database/sql/driver"
)
// NullTime the compatible structure of NullTime in 'database/sql' package.
type NullTime struct {
core core.NullTime
Time time.Time
Valid bool
}
// Scan the compatible method of Scan in 'database/sql' package.
func (n *NullTime) Scan(value interface{}) error {
n.core.Time = n.Time
n.core.Valid = n.Valid
if err := n.core.Scan(value); err != nil {
return errors.WithStack(err)
}
n.Time = n.core.Time
n.Valid = n.core.Valid
return nil
}
// Value the compatible method of Value in 'database/sql' package.
func (n NullTime) Value() (driver.Value, error) {
if !n.Valid {
return nil, nil
}
return n.Time, nil
}
// NullInt32 the compatible structure of NullInt32 in 'database/sql' package.
type NullInt32 struct {
core core.NullInt32
Int32 int32
Valid bool
}
// Scan the compatible method of Scan in 'database/sql' package.
func (n *NullInt32) Scan(value interface{}) error {
n.core.Int32 = n.Int32
n.core.Valid = n.Valid
if err := n.core.Scan(value); err != nil {
return errors.WithStack(err)
}
n.Int32 = n.core.Int32
n.Valid = n.core.Valid
return nil
}
// Value the compatible method of Value in 'database/sql' package.
func (n NullInt32) Value() (driver.Value, error) {
if !n.Valid {
return nil, nil
}
return int64(n.Int32), nil
}