Documentation
¶
Index ¶
- func Error(c http.Context, opts ...StdOpt) http.Response
- func Raw(c http.Context, statusCode int, contentType string, data []byte) http.Response
- func Resp(c http.Context, code, desc string, opts ...StdOpt) http.Response
- func Success(c http.Context, opts ...StdOpt) http.Response
- type Std
- type StdOpt
- func WithData(data any) StdOpt
- func WithDesc(desc string) StdOpt
- func WithErr(e error) StdOpt
- func WithErrAccess(e error) StdOpt
- func WithErrHeader(e error) StdOpt
- func WithErrInvalidRule(e error) StdOpt
- func WithErrNotFound(e error) StdOpt
- func WithErrParameter(e error) StdOpt
- func WithErrRuntime(e error) StdOpt
- func WithErrThirdParty(e error) StdOpt
- func WithErrUnsupport(e error) StdOpt
- func WithErrWaiting(e error) StdOpt
- func WithMaskedData(keysToMask []string, data any) StdOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error construct standard response with default error response code and description after applying any given options.
func Raw ¶ added in v0.21.1
Raw returns a raw binary response with the given HTTP status code, content type, and data. Unlike Resp/Success/Error, this bypasses the standard JSON envelope entirely — intended for binary pass-through responses such as PDF files or other non-JSON payloads.
Types ¶
type Std ¶
type Std struct {
ResponseCode string `json:"responseCode"`
ResponseDesc string `json:"responseDesc"`
ResponseData any `json:"responseData,omitempty"`
ResponseValidation []string `json:"responseValidation,omitempty"`
// contains filtered or unexported fields
}
Std holds standard response structure for brispot microservice.
type StdOpt ¶
type StdOpt func(std *Std)
StdOpt option signature that accept and modify Std response object.
func WithErrAccess ¶ added in v0.17.5
func WithErrHeader ¶ added in v0.17.5
func WithErrInvalidRule ¶ added in v0.17.5
func WithErrNotFound ¶ added in v0.17.5
func WithErrParameter ¶ added in v0.17.5
func WithErrRuntime ¶ added in v0.17.5
func WithErrThirdParty ¶ added in v0.16.6
func WithErrUnsupport ¶ added in v0.17.5
func WithErrWaiting ¶ added in v0.17.5
func WithMaskedData ¶ added in v0.17.1
WithMaskedData masks specified keys in the response data
Click to show internal directories.
Click to hide internal directories.