We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d4b20d commit 0f9fa68Copy full SHA for 0f9fa68
repeat.go
@@ -0,0 +1,29 @@
1
+package transdsl
2
+
3
+import (
4
+ "time"
5
+)
6
7
+type Repeat struct {
8
+ MaxTimes int
9
+ TimeLen time.Duration //ms
10
+ Fragment Fragment
11
+}
12
13
+func (this *Repeat) Exec(transInfo *TransInfo) error {
14
+ flag := false
15
+ if this.MaxTimes < 0 {
16
+ flag = true
17
+ }
18
19
+ for i := 0; flag || i < this.MaxTimes; i++ {
20
+ this.Fragment.Exec(transInfo)
21
+ <-time.After(this.TimeLen * time.Millisecond)
22
23
+ return nil
24
25
26
+func (this *Repeat) Rollback(transInfo *TransInfo) {
27
+ this.Fragment.Rollback(transInfo)
28
29
0 commit comments