@@ -20,14 +20,14 @@ package std
20
20
import (
21
21
"database/sql"
22
22
"fmt"
23
- "github.com/ClickHouse/clickhouse-go/v2"
24
- clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests"
25
- "github.com/stretchr/testify/require"
26
23
"strconv"
27
24
"testing"
28
25
"time"
29
26
27
+ "github.com/ClickHouse/clickhouse-go/v2"
28
+ clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests"
30
29
"github.com/stretchr/testify/assert"
30
+ "github.com/stretchr/testify/require"
31
31
)
32
32
33
33
func TestStdDateTime64 (t * testing.T ) {
@@ -53,6 +53,7 @@ func TestStdDateTime64(t *testing.T) {
53
53
, Col7 DateTime64(0, 'Europe/London')
54
54
, Col8 Nullable(DateTime64(3, 'Europe/Moscow'))
55
55
, Col9 DateTime64(9)
56
+ , Col10 DateTime64(9)
56
57
) Engine MergeTree() ORDER BY tuple()
57
58
`
58
59
defer func () {
@@ -81,21 +82,23 @@ func TestStdDateTime64(t *testing.T) {
81
82
sql.NullTime {Time : datetime3 , Valid : true },
82
83
sql.NullTime {Time : time.Time {}, Valid : false },
83
84
expectedMinDateTime ,
85
+ time.Time {},
84
86
)
85
87
require .NoError (t , err )
86
88
require .NoError (t , scope .Commit ())
87
89
var (
88
- col1 time.Time
89
- col2 time.Time
90
- col3 time.Time
91
- col4 * time.Time
92
- col5 []time.Time
93
- col6 []* time.Time
94
- col7 sql.NullTime
95
- col8 sql.NullTime
96
- col9 time.Time
90
+ col1 time.Time
91
+ col2 time.Time
92
+ col3 time.Time
93
+ col4 * time.Time
94
+ col5 []time.Time
95
+ col6 []* time.Time
96
+ col7 sql.NullTime
97
+ col8 sql.NullTime
98
+ col9 time.Time
99
+ col10 time.Time
97
100
)
98
- require .NoError (t , conn .QueryRow ("SELECT * FROM test_datetime64" ).Scan (& col1 , & col2 , & col3 , & col4 , & col5 , & col6 , & col7 , & col8 , & col9 ))
101
+ require .NoError (t , conn .QueryRow ("SELECT * FROM test_datetime64" ).Scan (& col1 , & col2 , & col3 , & col4 , & col5 , & col6 , & col7 , & col8 , & col9 , & col10 ))
99
102
assert .Equal (t , datetime1 .In (time .UTC ), col1 )
100
103
assert .Equal (t , datetime2 .UnixNano (), col2 .UnixNano ())
101
104
assert .Equal (t , datetime3 .UnixNano (), col3 .UnixNano ())
@@ -113,6 +116,7 @@ func TestStdDateTime64(t *testing.T) {
113
116
require .Equal (t , sql.NullTime {Time : datetime3 .In (col7 .Time .Location ()), Valid : true }, col7 )
114
117
require .Equal (t , sql.NullTime {Time : time.Time {}, Valid : false }, col8 )
115
118
require .Equal (t , time .Date (1900 , 01 , 01 , 0 , 0 , 0 , 0 , time .UTC ), col9 )
119
+ require .Equal (t , time .Unix (0 , 0 ).UTC (), col10 )
116
120
})
117
121
}
118
122
}
0 commit comments