forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnon_null_time.go
50 lines (38 loc) · 919 Bytes
/
non_null_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
package tests
import (
"testing"
"time"
"github.com/ravendb/ravendb-go-client"
"github.com/stretchr/testify/assert"
)
func TestNonNilTimeError(t *testing.T) {
driver := createTestDriver(t)
test_case_string_non_nil_error(t, driver)
}
func test_case_string_non_nil_error(t *testing.T, driver *RavenTestDriver) {
id := "customer1"
var err error
store := driver.getDocumentStoreMust(t)
defer store.Close()
var time time.Time
time, err = ravendb.ParseTime("2006-01-02T15:04:05.9999999Z")
rtime := ravendb.Time(time)
obj := &CustomerNilTime{
ID: id,
CreatedAt: &rtime,
}
{
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()
}
}