12.7 Dependencies
provide Db = Db.open(App.get().dbUrl) for role api, saga
provide Payments = PaymentsClient.new(App.get().stripeKey)
impl Orders { dep db: Db; dep pay: Payments }provide Type = expression (for role r, …)?— a dependency factory, executed once per node at start-up (step 4 of §2.4) for the listed roles (all by default).dep name: Typeis allowed in theimplof a service, in an actor, a pipeline, a saga and at module level. A module-level dependency is available to all functions of the module as an immutable value.
Implementation-defined. Module-level
dep(D-8055; DIV-017; D-5101). This implementation binds a module-leveldeponly in the sagas and pipelines of the module; it is not available inmainand in ordinary functions. The other places ofdep(serviceimpl, actor) are as in the Standard.
- If code that uses a
depcan run on a role without the correspondingprovide, it is a compile error. A test MAY override aprovide(§18).
Related diagnostics
duplicate-provide, missing-provide, unknown-role
See also
Source: docs/spec/oxl-standard.en.md