-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.go
62 lines (46 loc) · 1.07 KB
/
context.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
package payrus
import "math"
const (
abortIndex uint8 = math.MaxUint8 / 2
)
// when done papyrus action,do next like update order
type NextFunc func(context *Context)
type NextList []NextFunc
// Context is all of the pay channel to use for execute operation like pay or transfer etc.
type Context struct {
next NextList
errors Error
abortIndex uint8 //now handlerFunc's index.
params map[string]string
}
func (c *Context) Reset() {
}
func (c *Context) Clone() *Context {
var cp = *c
cp.next = nil
cp.errors = Error{}
cp.abortIndex = -1
return &cp
}
func (c *Context) Next() {
}
func (c *Context) Abort() {
c.abortIndex = abortIndex
}
func (c *Context) AbortWithErr(msg string, t ErrorType, err error) Error {
c.Abort()
return ErrorsNew(msg, t, err)
}
func (c *Context) IsAbort() bool {
return c.abortIndex >= abortIndex
}
func (c *Context) NextLen() int {
return len(c.next)
}
//set other param for action
func (c *Context) SetParam(key, value string) {
}
//get other param from pay channel
func (c *Context) GetParam(key string) string {
return ""
}