Documentation
¶
Overview ¶
Package blueprint turns blueprints into flows and flows into blueprints.
A blueprint (design §4.8) is a flow body with declared parameters. Request and subflow references in its nodes may be {param: name}; the other parameters (string, int, bool) become inputs of the flow made from it. Using a blueprint copies it into an ordinary flow; nothing links the flow back to the blueprint.
Everything here is pure: references are looked up through a Resolver the caller provides and ids come from a function the caller provides.
Index ¶
- Variables
- func Check(bp model.Blueprint) diag.List
- func Default() model.Blueprint
- func DefaultAsync() model.Blueprint
- func DefaultAsyncPre() model.Blueprint
- func DefaultDataset() model.Blueprint
- func DefaultGRPC() model.Blueprint
- func DefaultGRPCPre() model.Blueprint
- func FromFlow(f model.Flow, newID func() model.ID, name string) (model.Blueprint, error)
- func Instantiate(bp model.Blueprint, in Input) (model.Flow, diag.List)
- type Input
- type Resolver
Constants ¶
This section is empty.
Variables ¶
var ErrNoName = errors.New("a blueprint needs a name")
ErrNoName is returned by FromFlow for an empty blueprint name.
Functions ¶
func Check ¶
Check validates a blueprint's own structure: parameter names and types, that every {param: x} names a declared parameter of the right type, and that reference parameters are used. The flow body is validated as an ordinary flow once the blueprint has been used.
func Default ¶
Default is the blueprint new requests are seeded with. Its nodes become the request's inline post hooks, which see the response: they write its status to the run log and fail the request unless the status is 2xx. Redirects need no node: the engine follows them up to http.max_redirects and fails the request beyond it.
func DefaultAsync ¶
DefaultAsync is the post hook new async requests are seeded with. An async request has no status, so it logs the outcome and the number of messages received, and fails unless the run ended well.
func DefaultAsyncPre ¶
DefaultAsyncPre is the pre hook new async requests are seeded with: it writes what is about to be sent to the run log.
func DefaultDataset ¶
DefaultDataset is the post hook new dataset requests are seeded with. A query has no HTTP status, so it logs the outcome and how many rows came back, and fails unless the query ran.
func DefaultGRPC ¶
DefaultGRPC is the post hook new gRPC requests are seeded with. A gRPC call has a status code, not an HTTP status, so it logs the code and fails unless it is OK.
func DefaultGRPCPre ¶
DefaultGRPCPre is the pre hook new gRPC requests are seeded with: it writes the call about to be made to the run log.
func FromFlow ¶
FromFlow makes a blueprint from an existing flow: every distinct request or subflow reference in the same collection becomes a reference parameter whose default is the original target, and every input becomes a string parameter with its default. References into other collections stay as they are, since a parameter could not say which collection to look in. Using the result with its defaults rebuilds the original flow.