Documentation
¶
Index ¶
Constants ¶
const SuccessMsg = "success"
SuccessMsg is the msg of the success envelope, the one JSON writes.
Variables ¶
This section is empty.
Functions ¶
func Abort ¶
Abort refuses the request with err, written in the failure envelope the way Error writes it, and stops the handler chain: what code outside the controller path refuses a request through, and nowhere else. A refusal with a status and message of its own is a service error, types.NewError(status, msg), so the one rule NewError holds for statuses and messages holds for every refusal: what the envelope looks like on the wire is the framework's to decide and to change, and a caller here states only the refusal it is making. The public response.Abort forwards to it.
func Attachment ¶
Attachment writes data as a downloadable file, setting the download file name and content type explicitly. It is used for exports where the format decides the file extension and MIME type.
func Error ¶
Error writes err in the failure envelope: a service error, anywhere in the wrap chain, answers with the status and client-safe message it was constructed with; any other error is the server's own failure and answers 500 with failureMsg. Internal error text — database drivers naming tables and columns, third-party client output — never reaches the envelope; callers log the full error themselves before answering it here.
Types ¶
This section is empty.