Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix wrong parameter type in example #24

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _examples/callback/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Deps struct {
func ExampleWorkflow(d Deps) *workflow.Workflow[Example, Status] {
b := workflow.NewBuilder[Example, Status]("callback example")

b.AddCallback(StatusStarted, func(ctx context.Context, r *workflow.Record[Example, Status], reader io.Reader) (Status, error) {
b.AddCallback(StatusStarted, func(ctx context.Context, r *workflow.Run[Example, Status], reader io.Reader) (Status, error) {
b, err := io.ReadAll(reader)
if err != nil {
return 0, err
Expand Down
2 changes: 1 addition & 1 deletion _examples/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Workflow(d Deps) *workflow.Workflow[GettingStarted, Status] {
)

builder.AddStep(StatusStarted,
func(ctx context.Context, r *workflow.Record[GettingStarted, Status]) (Status, error) {
func(ctx context.Context, r *workflow.Run[GettingStarted, Status]) (Status, error) {
r.Object.FollowAnExample = "✅"

return StatusFollowedTheExample, nil
Expand Down
6 changes: 3 additions & 3 deletions _examples/gettingstarted/gettingstarted.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ type Deps struct {
func Workflow(d Deps) *workflow.Workflow[GettingStarted, Status] {
b := workflow.NewBuilder[GettingStarted, Status]("getting started")

b.AddStep(StatusStarted, func(ctx context.Context, r *workflow.Record[GettingStarted, Status]) (Status, error) {
b.AddStep(StatusStarted, func(ctx context.Context, r *workflow.Run[GettingStarted, Status]) (Status, error) {
r.Object.ReadTheDocs = "✅"
return StatusReadTheDocs, nil
}, StatusReadTheDocs)

b.AddStep(StatusReadTheDocs, func(ctx context.Context, r *workflow.Record[GettingStarted, Status]) (Status, error) {
b.AddStep(StatusReadTheDocs, func(ctx context.Context, r *workflow.Run[GettingStarted, Status]) (Status, error) {
r.Object.FollowAnExample = "✅"
return StatusFollowedTheExample, nil
}, StatusFollowedTheExample)

b.AddStep(StatusFollowedTheExample, func(ctx context.Context, r *workflow.Record[GettingStarted, Status]) (Status, error) {
b.AddStep(StatusFollowedTheExample, func(ctx context.Context, r *workflow.Run[GettingStarted, Status]) (Status, error) {
r.Object.CreateAFunExample = "✅"
return StatusCreatedAFunExample, nil
}, StatusCreatedAFunExample)
Expand Down
2 changes: 1 addition & 1 deletion _examples/schedule/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ExampleWorkflow(d Deps) *workflow.Workflow[Example, Status] {
b := workflow.NewBuilder[Example, Status]("schedule trigger example")

b.AddStep(StatusStarted,
func(ctx context.Context, r *workflow.Record[Example, Status]) (Status, error) {
func(ctx context.Context, r *workflow.Run[Example, Status]) (Status, error) {
return StatusFollowedTheExample, nil
},
StatusFollowedTheExample,
Expand Down
4 changes: 2 additions & 2 deletions _examples/timeout/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func ExampleWorkflow(d Deps) *workflow.Workflow[Example, Status] {
b := workflow.NewBuilder[Example, Status]("timeout example")

b.AddTimeout(StatusStarted,
func(ctx context.Context, r *workflow.Record[Example, Status], now time.Time) (time.Time, error) {
func(ctx context.Context, r *workflow.Run[Example, Status], now time.Time) (time.Time, error) {
// Using "now" over time.Now() allows for you to specify a clock for testing.
return now.Add(time.Hour), nil
},
func(ctx context.Context, r *workflow.Record[Example, Status], now time.Time) (Status, error) {
func(ctx context.Context, r *workflow.Run[Example, Status], now time.Time) (Status, error) {
r.Object.Now = now
return StatusFollowedTheExample, nil
},
Expand Down
Loading