-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathcontext_override_extend.yml
58 lines (48 loc) · 1.82 KB
/
context_override_extend.yml
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
input:
input.go: |
package example
// goverter:converter
// goverter:extend Two
// goverter:extend One
type Conv1 interface {
// goverter:context ctx
Convert(source []string, ctx map[string]Output) []Output
}
// goverter:converter
// goverter:extend One
// goverter:extend Two
type Conv2 interface {
// goverter:context ctx
Convert(source []string, ctx map[string]Output) []Output
}
// goverter:context ctx
func One(id string, ctx map[string]Output) Output { return ctx[id] }
func Two(id string) Output { return Output{} }
type Output struct {}
success:
- generated/generated.go: |
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
package generated
import execution "github.com/jmattheis/goverter/execution"
type Conv1Impl struct{}
func (c *Conv1Impl) Convert(source []string, context map[string]execution.Output) []execution.Output {
var exampleOutputList []execution.Output
if source != nil {
exampleOutputList = make([]execution.Output, len(source))
for i := 0; i < len(source); i++ {
exampleOutputList[i] = execution.One(source[i], context)
}
}
return exampleOutputList
}
type Conv2Impl struct{}
func (c *Conv2Impl) Convert(source []string, context map[string]execution.Output) []execution.Output {
var exampleOutputList []execution.Output
if source != nil {
exampleOutputList = make([]execution.Output, len(source))
for i := 0; i < len(source); i++ {
exampleOutputList[i] = execution.Two(source[i])
}
}
return exampleOutputList
}