Documentation
¶
Overview ¶
Package checkout demonstrates a module that *consumes* another module by importing its *Service directly. The same Go call — `svc.users.Get(ctx, users.GetArgs{ID: ...})` — works in monolith mode (direct method call) and in split mode (HTTP via the shadow generator's stub *users.Service), with no edits to this file when you peel users out into its own binary. The transport switch happens at compile time via `nexus build --deployment X`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = nexus.Module("checkout", nexus.DeployAs("checkout-svc"), nexus.Provide(NewService), nexus.AsRest("POST", "/checkout", NewSubmit), )
Module declares one POST endpoint. DeployAs makes checkout its own deployment unit so `nexus dev --split` boots it as a separate subprocess from users, exercising the real HTTP path between them via the codegen'd users.UsersClient.
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.Service — the build tool decides at compile time whether that's the real local struct (monolith / users-svc binaries) or an HTTP-stub redefinition emitted by the shadow generator (checkout-svc binary). The type identifier is identical in both.