-
Notifications
You must be signed in to change notification settings - Fork 16
/
nullable_time.go
51 lines (39 loc) · 961 Bytes
/
nullable_time.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
package tests
import (
"testing"
"github.com/ravendb/ravendb-go-client"
"github.com/stretchr/testify/assert"
)
// Note: must rename as it conflicts with Order in order_test.go
type CustomerNilTime struct {
ID string `json:"Id"`
CreatedAt *ravendb.Time `json:"createdAt"`
}
func TestNilTimeError(t *testing.T) {
driver := createTestDriver(t)
test_case_string_nil_error(t, driver)
}
func test_case_nil_time_error(t *testing.T, driver *RavenTestDriver) {
id := "customer1"
var err error
store := driver.getDocumentStoreMust(t)
defer store.Close()
obj := &CustomerNilTime{
ID: id,
CreatedAt: nil,
}
{
session := openSessionMust(t, store)
err = session.Store(obj)
assert.NoError(t, err)
session.SaveChanges()
session.Close()
}
{
session := openSessionMust(t, store)
var customer *CustomerNilTime
err = session.Load(&customer, id)
assert.True(t, customer.CreatedAt == nil)
session.Close()
}
}