-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
376 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
input: | ||
input.go: | | ||
package execution | ||
// goverter:converter | ||
type Converter interface { | ||
// goverter:default NewOutputWithDefaults | ||
Convert(source *Input) (*Output, error) | ||
} | ||
type Input struct { | ||
Name int | ||
} | ||
type Output struct { | ||
Name string | ||
} | ||
func NewOutputWithDefaults() *Output { | ||
return &Output{ | ||
Name: "string", | ||
} | ||
} | ||
error: |- | ||
Error while creating converter method: | ||
@workdir/input.go:6 | ||
func (github.com/jmattheis/goverter/execution.Converter).Convert(source *github.com/jmattheis/goverter/execution.Input) (*github.com/jmattheis/goverter/execution.Output, error) | ||
[source] *github.com/jmattheis/goverter/execution.Input | ||
[target] *github.com/jmattheis/goverter/execution.Output | ||
| *github.com/jmattheis/goverter/execution.Input | ||
| | ||
| | github.com/jmattheis/goverter/execution.Input | ||
| | | ||
| | | int | ||
| | | | ||
source*.Name | ||
target*.Name | ||
| | | | ||
| | | string | ||
| | | ||
| | github.com/jmattheis/goverter/execution.Output | ||
| | ||
| *github.com/jmattheis/goverter/execution.Output | ||
TypeMismatch: Cannot convert int to string | ||
You can define a custom conversion method with extend: | ||
https://goverter.jmattheis.de/reference/extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
scenario/default_on_source_pointer_struct_target_struct.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
input: | ||
input.go: | | ||
package execution | ||
// goverter:converter | ||
type Converter interface { | ||
// goverter:default NewOutputWithDefaults | ||
Convert(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 | ||
} |
45 changes: 45 additions & 0 deletions
45
scenario/default_on_source_pointer_struct_target_struct_error.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
input: | ||
input.go: | | ||
package execution | ||
// goverter:converter | ||
type Converter interface { | ||
// goverter:default NewOutputWithDefaults | ||
Convert(source Input) (*Output, error) | ||
} | ||
type Input struct { | ||
Name int | ||
} | ||
type Output struct { | ||
Name string | ||
} | ||
func NewOutputWithDefaults() *Output { | ||
return &Output{ | ||
Name: "string", | ||
} | ||
} | ||
error: |- | ||
Error while creating converter method: | ||
@workdir/input.go:6 | ||
func (github.com/jmattheis/goverter/execution.Converter).Convert(source github.com/jmattheis/goverter/execution.Input) (*github.com/jmattheis/goverter/execution.Output, error) | ||
[source] github.com/jmattheis/goverter/execution.Input | ||
[target] *github.com/jmattheis/goverter/execution.Output | ||
| github.com/jmattheis/goverter/execution.Input | ||
| | ||
| | int | ||
| | | ||
source .Name | ||
target*.Name | ||
| | | | ||
| | | string | ||
| | | ||
| | github.com/jmattheis/goverter/execution.Output | ||
| | ||
| *github.com/jmattheis/goverter/execution.Output | ||
TypeMismatch: Cannot convert int to string | ||
You can define a custom conversion method with extend: | ||
https://goverter.jmattheis.de/reference/extend |
41 changes: 41 additions & 0 deletions
41
scenario/default_on_source_pointer_struct_target_struct_invalid_sig.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
input: | ||
input.go: | | ||
package execution | ||
// goverter:converter | ||
type Converter interface { | ||
// goverter:default NewOutputWithDefaults | ||
Convert(source Input) (*Output, error) | ||
} | ||
type Input struct { | ||
Name string | ||
} | ||
type Output struct { | ||
Name string | ||
} | ||
func NewOutputWithDefaults(string) *Output { | ||
return &Output{ | ||
Name: "string", | ||
} | ||
} | ||
error: |- | ||
Error while creating converter method: | ||
@workdir/input.go:6 | ||
func (github.com/jmattheis/goverter/execution.Converter).Convert(source github.com/jmattheis/goverter/execution.Input) (*github.com/jmattheis/goverter/execution.Output, error) | ||
[source] github.com/jmattheis/goverter/execution.Input | ||
[target] *github.com/jmattheis/goverter/execution.Output | ||
| github.com/jmattheis/goverter/execution.Input | ||
| | ||
source | ||
target | ||
| | ||
| *github.com/jmattheis/goverter/execution.Output | ||
Error using method: | ||
func github.com/jmattheis/goverter/execution.NewOutputWithDefaults(string) *github.com/jmattheis/goverter/execution.Output | ||
[source] string | ||
[target] *github.com/jmattheis/goverter/execution.Output | ||
Method source type mismatches with conversion source: string != github.com/jmattheis/goverter/execution.Input |
Oops, something went wrong.