-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathdefault_on_source_pointer_struct_target_struct.yml
45 lines (36 loc) · 1.38 KB
/
default_on_source_pointer_struct_target_struct.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
input:
input.go: |
package execution
// goverter:converter
type Converter interface {
// goverter:default NewOutputWithDefaults
Convert(source Input) (*Output, error)
}
// goverter:converter
type Update interface {
// goverter:default:update
// goverter:default NewOutputWithDefaults
Update(source Input) (*Output, error)
}
type Input struct { Name string }
type Output struct { Name string }
func NewOutputWithDefaults() *Output {
return &Output{ Name: "string" }
}
success:
- generated/generated.go: |
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
package generated
import execution "github.com/jmattheis/goverter/execution"
type ConverterImpl struct{}
func (c *ConverterImpl) Convert(source execution.Input) (*execution.Output, error) {
pExecutionOutput := execution.NewOutputWithDefaults()
(*pExecutionOutput).Name = source.Name
return pExecutionOutput, nil
}
type UpdateImpl struct{}
func (c *UpdateImpl) Update(source execution.Input) (*execution.Output, error) {
pExecutionOutput := execution.NewOutputWithDefaults()
(*pExecutionOutput).Name = source.Name
return pExecutionOutput, nil
}