-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: support injected verb clients in Go #2828
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic 🪄
5fe4861
to
a48563b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looking good!
@@ -24,8 +24,8 @@ type EchoResponse struct { | |||
// Echo returns a greeting with the current time. | |||
// | |||
//ftl:verb | |||
func Echo(ctx context.Context, req EchoRequest) (EchoResponse, error) { | |||
tresp, err := ftl.Call(ctx, time.Time, time.TimeRequest{}) | |||
func Echo(ctx context.Context, req EchoRequest, tc time.TimeClient) (EchoResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
@@ -18,7 +18,7 @@ type EchoResponse struct { | |||
} | |||
|
|||
//ftl:verb | |||
func Echo(ctx context.Context, req EchoRequest) (EchoResponse, error) { | |||
ftl.Call(ctx, other.Echo, other.EchoRequest{}) | |||
func Echo(ctx context.Context, req EchoRequest, oc other.EchoClient) (EchoResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we know which parameter is the request? Must it always be the 2nd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this implementation yes, though maybe it could be inferred? the first non-resource-typed param (where verb clients are functions and other resources are known types, e.g. ftl.PostgresDatabase etc.) we encounter
maybe worth landing the other resource types first and then revisiting this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current approach allows a request as the 2nd parameter, optionally. if it's not there we just start consuming resources
c7c5864
to
06a20eb
Compare
775cc98
to
54b239d
Compare
https://hackmd.io/OULeRFQQQvaMURysN27eEw
only the TestLifecycle integration test is updated with the new approach in this PR, to demonstrate that both old and new verb call strategies are still functional. will remove other usages of
ftl.Call(...)
to follow<Verb>Client
signatures in external stubs and (local) signatures intypes.ftl.go
main.go
andtypes.ftl.go
, e.g. "providers" for verb clients-
go-runtime/build.go
changes accompanying the above^ bunch of stuff to get imports working now that we're generating full verb request/response types rather than just function referencesgo-runtime/server.go
to inject the registered providers when processing an inbound call#2641