-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_main_tbool_test.go
95 lines (79 loc) · 2.65 KB
/
example_main_tbool_test.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package gomeos
import (
"fmt"
"time"
)
func ExampleTBoolFromBaseTemporal() {
tb_seq := TBoolIn("{FALSE@2022-10-01, FALSE@2022-10-02,TRUE@2022-10-03}", &TBoolSeq{})
res := TBoolFromBaseTemporal(true, tb_seq, &TBoolSeq{})
fmt.Println(TBoolOut(res))
// Output:
// {t@2022-10-01 00:00:00+00, t@2022-10-02 00:00:00+00, t@2022-10-03 00:00:00+00}
}
func ExampleTBoolSeqSetFromBaseTstzspanset() {
tstzspanset := NewTsTzSpanSet("{[2023-01-01 08:00:00+00, 2023-01-02 08:00:00+00), (2023-01-03 10:00:00+00, 2023-01-04 12:00:00+00]}")
tss := TBoolSeqSetFromBaseTstzspanset(true, tstzspanset)
fmt.Println(TBoolOut(tss))
// Output:
// {[t@2023-01-01 08:00:00+00, t@2023-01-02 08:00:00+00), (t@2023-01-03 10:00:00+00, t@2023-01-04 12:00:00+00]}
}
func ExampleTBoolOut() {
g_is := NewTBoolInst("TRUE@2022-10-01")
fmt.Println(TBoolOut(g_is))
// Output:
// t@2022-10-01 00:00:00+00
}
func ExampleTBoolValueAtTimestamp() {
g_is := NewTBoolSeq("{FALSE@2022-10-01, FALSE@2022-10-02,TRUE@2022-10-03}")
ts, _ := time.Parse("2006-01-02", "2022-10-01")
res := TBoolValueAtTimestamp(g_is, ts)
fmt.Println(res)
// Output:
// false
}
func ExampleEverEqTBoolBool() {
tb1 := NewTBoolSeq("{FALSE@2022-10-01, FALSE@2022-10-02,FALSE@2022-10-03}")
tb2 := true
res := EverEqTBoolBool(tb1, tb2)
fmt.Println(res)
// Output:
// false
}
func ExampleTEqTBoolBool() {
tb1 := NewTBoolSeq("{FALSE@2022-10-01, FALSE@2022-10-02,FALSE@2022-10-03}")
tb2 := false
res := TEqTBoolBool(tb1, tb2)
fmt.Println(res.String())
// Output:
// {t@2022-10-01 00:00:00+00, t@2022-10-02 00:00:00+00, t@2022-10-03 00:00:00+00}
}
func ExampleTNEqTBoolBool() {
tb1 := NewTBoolSeq("{FALSE@2022-10-01, FALSE@2022-10-02,FALSE@2022-10-03}")
tb2 := false
res := TNEqTBoolBool(tb1, tb2)
fmt.Println(res.String())
// Output:
// {f@2022-10-01 00:00:00+00, f@2022-10-02 00:00:00+00, f@2022-10-03 00:00:00+00}
}
func ExampleTAndTBoolBool() {
tb1 := NewTBoolSeq("{TRUE@2022-10-01, TRUE@2022-10-02,TRUE@2022-10-03}")
tb2 := true
res := TAndTBoolBool(tb1, tb2)
fmt.Println(res.String())
// Output:
// {t@2022-10-01 00:00:00+00, t@2022-10-02 00:00:00+00, t@2022-10-03 00:00:00+00}
}
func ExampleTNotTBool() {
tb1 := NewTBoolSeq("{TRUE@2022-10-01, TRUE@2022-10-02,TRUE@2022-10-03}")
res := TNotTBool(tb1, &TBoolSeq{})
fmt.Println(res.String())
// Output:
// {f@2022-10-01 00:00:00+00, f@2022-10-02 00:00:00+00, f@2022-10-03 00:00:00+00}
}
func ExampleTBoolWhenTrue() {
tb1 := NewTBoolSeq("{TRUE@2022-10-01, FALSE@2022-10-02,TRUE@2022-10-03}")
res := TBoolWhenTrue(tb1)
fmt.Println(res.TsTzSpanSetOut())
// Output:
// {[2022-10-01 00:00:00+00, 2022-10-01 00:00:00+00], [2022-10-03 00:00:00+00, 2022-10-03 00:00:00+00]}
}