Documentation
¶
Index ¶
- func ApiRequestCtx(c context.Context, api string) context.Context
- func Contextual(ctx context.Context, errs ...error) []zap.Field
- func FourZeroFour() http.Handler
- func GetApiName(ctx context.Context) string
- func GetClientID(ctx context.Context) string
- func GetClientSecret(ctx context.Context) string
- func GetRequestID(ctx context.Context) string
- func GetToken(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func HandleError(ctx context.Context, w http.ResponseWriter, err error)
- func HandleInternalError(ctx context.Context, w http.ResponseWriter, err error)
- type ApiFoul
- type ApiHandler
- type ContextKey
- type ErrorResponse
- type Foul
- type OkResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FourZeroFour ¶
func GetApiName ¶
func GetClientID ¶
func GetClientSecret ¶
func GetRequestID ¶
func HandleError ¶
func HandleError(ctx context.Context, w http.ResponseWriter, err error)
func HandleInternalError ¶
func HandleInternalError(ctx context.Context, w http.ResponseWriter, err error)
Types ¶
type ApiFoul ¶
type ApiFoul struct {
ApiName string `json:"api_name"`
Message string `json:"message"`
Cause Foul `json:"-"`
RequestId string `json:"request_id"`
StatusCode int `json:"status_code"`
DomainCode string `json:"domain_codes"`
}
func (*ApiFoul) WithApiName ¶
func (*ApiFoul) WithDomainCode ¶
func (*ApiFoul) WithMessage ¶
func (*ApiFoul) WithStatusCode ¶
type ApiHandler ¶
type ApiHandler struct {
Name string
Path string
Method string
HandleFunc http.HandlerFunc
}
func (ApiHandler) RegisterToRouter ¶
func (api ApiHandler) RegisterToRouter(router *mux.Router)
type ContextKey ¶
type ContextKey int
const ( ApiName ContextKey = iota Token ClientID ClientSecret RequestID UserID )
type ErrorResponse ¶
type OkResponse ¶
type OkResponse struct {
Status string `json:"status"`
}
Click to show internal directories.
Click to hide internal directories.