-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from GettEngineering/issue-18
Generate default error for a desicion block
- Loading branch information
Showing
6 changed files
with
139 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// +build effeinject | ||
|
||
package main | ||
|
||
import "github.com/GettEngineering/effe" | ||
|
||
func A() error { | ||
effe.BuildFlow( | ||
effe.Step(step1), | ||
effe.Decision(new(a), effe.Failure(failure), | ||
effe.Case("a", effe.Step(step2)), | ||
effe.Case("", effe.Step(step3)), | ||
), | ||
) | ||
return nil | ||
} |
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,30 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
type a string | ||
|
||
func failure() func(error) error { | ||
return func(err error) error { | ||
return err | ||
} | ||
} | ||
|
||
func step2() func(a) int { | ||
return func(v a) int { | ||
fmt.Println(v) | ||
return 0 | ||
} | ||
} | ||
|
||
func step3() func() int { | ||
return func() int { | ||
return 0 | ||
} | ||
} | ||
|
||
func step1() func() (a, error) { | ||
return func() (a, error) { | ||
return "a", nil | ||
} | ||
} |
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 @@ | ||
example.com/foo |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.