Writer
is used to write content to the Response
:
Compared to Handler
:
The direct differences between them are:
Writer
represents writing specific content to the Response
and is implemented by the specific content (e.g., strings, error messages, etc.). In contrast, Handler
is used to process the entire request.Writer
is created within a Handler
and consumes itself when its write
function is called, making it a one-time use. In contrast, Handler
is shared across all requests.Writer
can be the content within the Result
returned by a Handler
.Writer
does not have a FlowCtrl
parameter and cannot control the execution flow of the entire request.Scribe
implements Writer
, but it offers fewer functionalities than Writer
:
The rendering function of Scribe
only writes data to the Response
; this process cannot access information from the Request
or Depot
.