Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeError(_ context.Context, err error, w http.ResponseWriter)
- func EncodeResponse(_ context.Context, w http.ResponseWriter, response any) error
- func HealthHandler(service, instanceID string) http.HandlerFunc
- func LoggingErrorEncoder(logger *slog.Logger, enc kithttp.ErrorEncoder) kithttp.ErrorEncoder
- func ReadMetadataQuery(r *http.Request, key string, def map[string]any) (map[string]any, error)
- func ReadNumQuery[N number](r *http.Request, key string, def N) (N, error)
- func ReadStringQuery(r *http.Request, key, def string) (string, error)
- type Response
Constants ¶
View Source
const ( OffsetKey = "offset" LimitKey = "limit" MetadataKey = "metadata" DefOffset = 0 DefLimit = 100 ContentType = "application/json" MaxLimitSize = 100 )
Variables ¶
View Source
var ( ErrValidation = errors.New("something went wrong with the request") ErrMissingName = errors.New("missing identity name") ErrMissingID = errors.New("missing entity id") ErrInvalidQueryParams = errors.New("invalid query parameters") ErrLimitSize = errors.New("invalid limit size") ErrUnsupportedContentType = errors.New("unsupported content type") )
Functions ¶
func EncodeError ¶
func EncodeError(_ context.Context, err error, w http.ResponseWriter)
func EncodeResponse ¶
func HealthHandler ¶ added in v0.6.0
func HealthHandler(service, instanceID string) http.HandlerFunc
func LoggingErrorEncoder ¶ added in v0.6.0
func LoggingErrorEncoder(logger *slog.Logger, enc kithttp.ErrorEncoder) kithttp.ErrorEncoder
func ReadMetadataQuery ¶ added in v0.6.0
func ReadNumQuery ¶ added in v0.6.0
Types ¶
Click to show internal directories.
Click to hide internal directories.