-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_runner_test.go
68 lines (54 loc) · 939 Bytes
/
example_runner_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
package sabi_test
import (
"github.com/sttk/sabi"
"github.com/sttk/sabi/errs"
)
func NewMyDaxBase() sabi.DaxBase {
return sabi.NewDaxBase()
}
func ExampleSeq() {
type FooDax interface {
sabi.Dax
// ...
}
type BarDax interface {
sabi.Dax
// ...
}
base := NewMyDaxBase()
txn1 := sabi.Txn_[FooDax](base, func(dax FooDax) errs.Err {
// ...
return errs.Ok()
})
txn2 := sabi.Txn_[BarDax](base, func(dax BarDax) errs.Err {
// ...
return errs.Ok()
})
err := sabi.Seq(txn1, txn2)
if err.IsNotOk() {
// ...
}
}
func ExamplePara() {
type FooDax interface {
sabi.Dax
// ...
}
type BarDax interface {
sabi.Dax
// ...
}
base := NewMyDaxBase()
txn1 := sabi.Txn_[FooDax](base, func(dax FooDax) errs.Err {
// ...
return errs.Ok()
})
txn2 := sabi.Txn_[BarDax](base, func(dax BarDax) errs.Err {
// ...
return errs.Ok()
})
err := sabi.Para(txn1, txn2)
if err.IsNotOk() {
// ...
}
}