Documentation
¶
Overview ¶
Package checkout demonstrates a module that *consumes* another module via its generated typed client. The same Go call — `users.Get(ctx, users.GetArgs{ID: ...})` — works in monolith mode (in-process LocalInvoker) and in split mode (HTTP RemoteCaller), with no edits to checkout's handler code when you decide to peel users out into its own binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = nexus.Module("checkout", nexus.Provide(NewService), nexus.Provide(users.NewUsersClient), nexus.AsRest("POST", "/checkout", NewSubmit), )
Module declares one POST endpoint. checkout has no DeployAs tag of its own in the demo — the split here is "users out, checkout local". Tag it the same way to make it splittable on its own.
Functions ¶
This section is empty.
Types ¶
type Receipt ¶
type Receipt struct {
OrderID string `json:"orderId"`
UserID string `json:"userId"`
Display string `json:"display"`
}
type Service ¶
Service is checkout's service wrapper. Its constructor takes a users.UsersClient — the framework injects either the local or remote variant depending on the running binary's deployment, but the type the consumer sees is identical.
func NewService ¶
func NewService(app *nexus.App, u users.UsersClient) *Service