-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper_gen.go
68 lines (55 loc) · 1.98 KB
/
wrapper_gen.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
// Code generated by go generate; DO NOT EDIT.
package example
import (
"context"
"sandwich"
)
var _ sandwich.Wrapper[IOrigin] = (*WrapperTest)(nil)
func (c *WrapperTest) _delegateCall(invoke *sandwich.Invoke) {
defer func() {
if !invoke.IsProceed() {
invoke.Process()
}
}()
c.WrapperMethod(invoke.Ctx, invoke)
}
// implements IWrapperOp
func (c *WrapperTest) DoSomething() {
_params := []*sandwich.Valued{}
invoke := &sandwich.Invoke{Ctx: context.Background(), MethodName: "DoSomething", Params: _params}
invoke.SetProcess(func() []*sandwich.Valued {
c.GetDelegate().DoSomething()
return invoke.Returns
})
c._delegateCall(invoke)
return
}
func (c *WrapperTest) DoSomething1(ctx context.Context, key string, val string) (_error error) {
_params := []*sandwich.Valued{
{Name: "ctx", Value: ctx}, {Name: "key", Value: key}, {Name: "val", Value: val},
}
invoke := &sandwich.Invoke{Ctx: ctx, MethodName: "DoSomething1", Params: _params}
invoke.SetProcess(func() []*sandwich.Valued {
_error = c.GetDelegate().DoSomething1(_params[0].Value.(context.Context), _params[1].Value.(string), _params[2].Value.(string))
invoke.Returns = make([]*sandwich.Valued, 1)
invoke.Returns[0] = &sandwich.Valued{Name: "_error", Value: _error}
return invoke.Returns
})
c._delegateCall(invoke)
return
}
func (c *WrapperTest) DoSomething2(ctx context.Context, keys ...string) (_string string, _error error) {
_params := []*sandwich.Valued{
{Name: "ctx", Value: ctx}, {Name: "keys", Value: keys},
}
invoke := &sandwich.Invoke{Ctx: ctx, MethodName: "DoSomething2", Params: _params}
invoke.SetProcess(func() []*sandwich.Valued {
_string, _error = c.GetDelegate().DoSomething2(_params[0].Value.(context.Context), _params[1].Value.([]string)...)
invoke.Returns = make([]*sandwich.Valued, 2)
invoke.Returns[0] = &sandwich.Valued{Name: "_string", Value: _string}
invoke.Returns[1] = &sandwich.Valued{Name: "_error", Value: _error}
return invoke.Returns
})
c._delegateCall(invoke)
return
}