Skip to content

Commit ca8d05d

Browse files
author
Christopher Ludden
committed
fix: fixes child workflow options
1 parent 5039511 commit ca8d05d

File tree

6 files changed

+29
-94
lines changed

6 files changed

+29
-94
lines changed

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,17 @@ Optional **CLI** with:
5252
## Getting Started
5353
1. Install [buf](https://docs.buf.build/installation)
5454

55-
1. Install this plugin by downloading the latest [release](https://github.com/cludden/protoc-gen-go-temporal/releases)
55+
2. Install this plugin
5656

57-
2. Install Go protoc plugin
57+
2a. Grab a binary for your OS from [the releases page](https://github.com/cludden/protoc-gen-go-temporal/releases) and place in your $PATH
58+
59+
2b. `go install github.com/cludden/protoc-gen-go-temporal/cmd/protoc-gen-go_temporal@<version>`
60+
61+
3. Install Go protoc plugin
5862
```shell
5963
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
6064
```
6165

62-
3. Install this plugin
63-
64-
3a. Grab a binary for your OS from [the releases page](https://github.com/cludden/protoc-gen-go-temporal/releases) and place in your $PATH
65-
66-
3b. `go install github.com/cludden/protoc-gen-go-temporal/cmd/protoc-gen-go_temporal@<version>`
67-
6866
4. Initialize buf repository
6967
```shell
7068
mkdir proto && cd proto && buf init
@@ -74,7 +72,7 @@ mkdir proto && cd proto && buf init
7472
```yaml
7573
version: v1
7674
deps:
77-
- buf.build/cludden/protoc-gen-go-temporal@<version>
75+
- buf.build/cludden/protoc-gen-go-temporal:<version>
7876
```
7977
8078
6. Add plugin to `buf.gen.yaml` and exclude it from managed mode go prefix

gen/example/v1/example_temporal.pb.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/simple/simple_temporal.pb.go

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/temporal/v1/temporal.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/plugin/testclient.go

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (svc *Service) genTestClientImplQueryMethod(f *g.File, query string) {
5252
hasInput := !isEmpty(handler.Input)
5353
hasOutput := !isEmpty(handler.Output)
5454

55-
f.Commentf("%s executes a %s query", query, query)
55+
f.Commentf("%s executes a %s query", query, svc.fqnForQuery(query))
5656
f.Func().
5757
Params(g.Id("c").Op("*").Id(toCamel("Test%sClient", svc.Service.GoName))).
5858
Id(query).
@@ -108,69 +108,6 @@ func (svc *Service) genTestClientImplQueryMethod(f *g.File, query string) {
108108
})
109109
}
110110

111-
// genTestClientImplQueryDelayedMethod genereates a TestClient <Query>Delayed method
112-
func (svc *Service) genTestClientImplQueryDelayedMethod(f *g.File, query string) {
113-
handler := svc.methods[query]
114-
hasInput := !isEmpty(handler.Input)
115-
hasOutput := !isEmpty(handler.Output)
116-
methodName := toCamel("%sDelayed", query)
117-
118-
f.Commentf("%s executes a %s query", methodName, svc.fqnForQuery(query))
119-
f.Func().
120-
Params(g.Id("c").Op("*").Id(toCamel("Test%sClient", svc.Service.GoName))).
121-
Id(methodName).
122-
ParamsFunc(func(args *g.Group) {
123-
args.Id("ctx").Qual("context", "Context")
124-
args.Id("workflowID").String()
125-
args.Id("runID").String()
126-
if hasInput {
127-
args.Id("req").Op("*").Id(handler.Input.GoIdent.GoName)
128-
}
129-
}).
130-
ParamsFunc(func(returnVals *g.Group) {
131-
if hasOutput {
132-
returnVals.Op("*").Id(handler.Output.GoIdent.GoName)
133-
}
134-
returnVals.Error()
135-
}).
136-
BlockFunc(func(fn *g.Group) {
137-
fn.List(g.Id("val"), g.Err()).Op(":=").Id("c").Dot("env").Dot("QueryWorkflow").CallFunc(func(args *g.Group) {
138-
args.Id(fmt.Sprintf("%sQueryName", query))
139-
if hasInput {
140-
args.Id("req")
141-
}
142-
})
143-
fn.If(g.Err().Op("!=").Nil()).Block(
144-
g.ReturnFunc(func(returnVals *g.Group) {
145-
if hasOutput {
146-
returnVals.Nil()
147-
}
148-
returnVals.Err()
149-
}),
150-
).Else().If(g.Op("!").Id("val").Dot("HasValue").Call()).Block(
151-
g.ReturnFunc(func(returnVals *g.Group) {
152-
if hasOutput {
153-
returnVals.Nil()
154-
}
155-
returnVals.Nil()
156-
}),
157-
).Else().BlockFunc(func(bl *g.Group) {
158-
if !hasOutput {
159-
bl.Return(g.Nil())
160-
} else {
161-
bl.Var().Id("result").Id(handler.Output.GoIdent.GoName)
162-
bl.If(g.Err().Op(":=").Id("val").Dot("Get").Call(g.Op("&").Id("result")), g.Err().Op("!=").Nil()).Block(
163-
g.Return(
164-
g.Nil(),
165-
g.Err(),
166-
),
167-
)
168-
bl.Return(g.Op("&").Id("result"), g.Nil())
169-
}
170-
})
171-
})
172-
}
173-
174111
// genTestClientImplSignalMethod genereates a TestClient <Signal> method
175112
func (svc *Service) genTestClientImplSignalMethod(f *g.File, signal string) {
176113
handler := svc.methods[signal]

internal/plugin/worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,10 @@ func (svc *Service) genWorkerWorkflowChildOptions(f *g.File, workflow string) {
467467
g.Return(g.Op("&").Id(typeName).Values()),
468468
)
469469

470-
f.Comment("WithStartWorkflowOptions sets the initial client.StartWorkflowOptions")
470+
f.Comment("WithChildWorkflowOptions sets the initial client.StartWorkflowOptions")
471471
f.Func().
472472
Params(g.Id("opts").Op("*").Id(typeName)).
473-
Id("WithStartWorkflowOptions").
473+
Id("WithChildWorkflowOptions").
474474
Params(g.Id("options").Qual(workflowPkg, "ChildWorkflowOptions")).
475475
Op("*").Id(typeName).
476476
Block(

0 commit comments

Comments
 (0)