Documentation
¶
Index ¶
- func Accepted(c *fiber.Ctx, s any) error
- func BadRequest(c *fiber.Ctx, s any) error
- func Conflict(c *fiber.Ctx, code, title, message string) error
- func Created(c *fiber.Ctx, s any) error
- func FindUnknownFields(original, marshaled map[string]any) map[string]any
- func Forbidden(c *fiber.Ctx, code, title, message string) error
- func GetFileFromHeader(ctx *fiber.Ctx) (string, error)
- func GetIdempotencyKeyAndTTL(c *fiber.Ctx) (string, time.Duration)
- func GetPayloadFromContext(c *fiber.Ctx) any
- func InternalServerError(c *fiber.Ctx, code, title, message string) error
- func JSONResponse(c *fiber.Ctx, status int, s any) error
- func JSONResponseError(c *fiber.Ctx, err pkg.ResponseError) error
- func NoContent(c *fiber.Ctx) error
- func NotFound(c *fiber.Ctx, code, title, message string) error
- func NotImplemented(c *fiber.Ctx, message string) error
- func OK(c *fiber.Ctx, s any) error
- func ParseUUIDPathParameters(entityName string) fiber.Handler
- func PartialContent(c *fiber.Ctx, s any) error
- func RangeNotSatisfiable(c *fiber.Ctx) error
- func ServiceUnavailable(c *fiber.Ctx, code, title, message string) error
- func Unauthorized(c *fiber.Ctx, code, title, message string) error
- func UnprocessableEntity(c *fiber.Ctx, code, title, message string) error
- func ValidateStruct(s any) error
- func WithBody(s any, h DecodeHandlerFunc) fiber.Handler
- func WithDecode(c ConstructorFunc, h DecodeHandlerFunc) fiber.Handler
- func WithError(c *fiber.Ctx, err error) error
- type ConstructorFunc
- type DecodeHandlerFunc
- type Pagination
- type PayloadContextValue
- type QueryHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest sends an HTTP 400 Bad Request response with a custom body.
func FindUnknownFields ¶
FindUnknownFields finds fields that are present in the original map but not in the marshaled map.
func Forbidden ¶
Forbidden sends an HTTP 403 Forbidden response with a custom code, title and message.
func GetFileFromHeader ¶
GetFileFromHeader method that get file from header and give a string fom this dsl gold file
func GetIdempotencyKeyAndTTL ¶
GetIdempotencyKeyAndTTL returns idempotency key and ttl if pass through.
func GetPayloadFromContext ¶
GetPayloadFromContext retrieves the decoded request payload from the Fiber context.
func InternalServerError ¶
InternalServerError sends an HTTP 500 Internal Server Error response
func JSONResponse ¶
JSONResponse sends a custom status code and body as a JSON response.
func JSONResponseError ¶
func JSONResponseError(c *fiber.Ctx, err pkg.ResponseError) error
JSONResponseError sends a JSON formatted error response with a custom error struct.
func NotFound ¶
NotFound sends an HTTP 404 Not Found response with a custom code, title and message.
func NotImplemented ¶
NotImplemented sends an HTTP 501 Not Implemented response with a custom message.
func ParseUUIDPathParameters ¶
ParseUUIDPathParameters globally, considering all path parameters are UUIDs and adding them to the span attributes entityName is a snake_case string used to identify id name, for example the "organization" entity name will result in "app.request.organization_id" otherwise the path parameter "id" in a request for example "/v1/organizations/:id" will be parsed as "app.request.id"
func PartialContent ¶
PartialContent sends an HTTP 206 Partial Content response with a custom body.
func RangeNotSatisfiable ¶
RangeNotSatisfiable sends an HTTP 416 Requested Range Not Satisfiable response.
func ServiceUnavailable ¶ added in v3.4.8
ServiceUnavailable sends an HTTP 503 Service Unavailable response with a custom code, title and message.
func Unauthorized ¶
Unauthorized sends an HTTP 401 Unauthorized response with a custom code, title and message.
func UnprocessableEntity ¶
UnprocessableEntity sends an HTTP 422 Unprocessable Entity response with a custom code, title and message.
func ValidateStruct ¶
ValidateStruct validates a struct against defined validation rules, using the validator package.
func WithBody ¶
func WithBody(s any, h DecodeHandlerFunc) fiber.Handler
WithBody wraps a handler function, providing it with an instance of the specified struct.
func WithDecode ¶
func WithDecode(c ConstructorFunc, h DecodeHandlerFunc) fiber.Handler
WithDecode wraps a handler function, providing it with a struct instance created using the provided constructor function.
Types ¶
type ConstructorFunc ¶
type ConstructorFunc func() any
ConstructorFunc representing a constructor of any type.
type DecodeHandlerFunc ¶
DecodeHandlerFunc is a handler which works with withBody decorator. It receives a struct which was decoded by withBody decorator before. Ex: json -> withBody -> DecodeHandlerFunc.
func SetBodyInContext ¶
func SetBodyInContext(handler fiber.Handler) DecodeHandlerFunc
SetBodyInContext is a higher-order function that wraps a Fiber handler, injecting the decoded body into the request context.
type Pagination ¶
type Pagination struct {
Limit int
Page int
Cursor string
SortOrder string
StartDate time.Time
EndDate time.Time
}
Pagination entity from query parameter from get apis
type PayloadContextValue ¶
type PayloadContextValue string
PayloadContextValue is a wrapper type used to keep Context.Locals safe.
type QueryHeader ¶
type QueryHeader struct {
Metadata *bson.M
Limit int
Page int
Cursor string
SortOrder string
StartDate time.Time
EndDate time.Time
UseMetadata bool
PortfolioID string
OperationType string
ToAssetCodes []string
}
QueryHeader entity from query parameter from get apis
func ValidateParameters ¶
func ValidateParameters(params map[string]string) (*QueryHeader, error)
ValidateParameters validate and return struct of default parameters
func (*QueryHeader) ToCursorPagination ¶
func (qh *QueryHeader) ToCursorPagination() Pagination
func (*QueryHeader) ToOffsetPagination ¶
func (qh *QueryHeader) ToOffsetPagination() Pagination