Documentation
¶
Overview ¶
Package docflow connects document to the workflow engine and the action runner: Generate is the handler behind a "document.generate" effect, and Exists is the guard that keeps a case from advancing until a document of a given template exists for it. The document package itself stays independent of both.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exists ¶
Exists returns a guard that passes only when the case already has a document of templateName, in any template version. Register it with Engine.RegisterGuard and name it on the transition that needs the document. Generation runs in the background, so a step that depends on a document must use this guard instead of assuming it is there.
func Generate ¶
Generate returns the handler for a document-generating effect. Each run generates at most one document: the source key defaults to r.IdempotencyKey() ("<case id>/<event seq>/<effect>", plus "/<part>" when r.Part is not zero, so each part of a split effect gets its own document), so a retried job returns the document a previous attempt stored. Input the document package rejects as invalid, a template that fails to parse or execute, a document the Renderer rejects (document.ErrRenderRejected) and an empty PDF cancel the job, since a retry cannot fix them; every other error, including one from build, is returned so River retries. db is where the metadata row is written, typically the pool. The document's id and sha256 are recorded on the attempt (action.RecordResult), so a Worker with an attempt log ties each attempt to the document it produced or found.