Documentation ¶
Index ¶
- func Decode[T any](s string, v *T) error
- func Error[T any](err T) []byte
- func GetJSONParam[T any](ctx *fiber.Ctx, json *T) error
- func GetLimitParam(ctx *fiber.Ctx, limit *int) error
- func GetMaxBytesParam(ctx *fiber.Ctx, maxBytes *int) error
- func GetMaxSizeParam(ctx *fiber.Ctx, maxSize *int) error
- func GetMinWordLengthParam(ctx *fiber.Ctx, minWordLength *int) error
- func GetSchemaParam(ctx *fiber.Ctx, schema *map[string]bool) error
- func GetStrictParam(ctx *fiber.Ctx, strict *bool) error
- func GetValueParam[T any](ctx *fiber.Ctx, value *T) error
- func Success[T any](v T) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode is a function that decodes a base64-encoded string and then decodes the resulting JSON into a value of type T. Parameters:
- s (string): The base64-encoded string to decode.
- v (*T): A pointer to a value of type T to store the decoded JSON.
Returns:
- error: An error message if the decoding fails, or nil if the decoding is successful.
func Error ¶
Error is a function that returns an error message with the provided error. Parameters:
- err (T): The error to include in the error message.
Returns:
- []byte: A byte slice containing the error message with the provided error.
func GetJSONParam ¶
GetJSONParam is a function that retrieves a JSON-encoded value from a query parameter in a Fiber context and decodes it into a value of type T. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- json (*T): A pointer to a value of type T to store the decoded JSON.
Returns:
- error: An error message if the decoding fails or the query parameter is invalid, or nil if the decoding is successful.
func GetLimitParam ¶
GetLimitParam is a function that retrieves the "limit" query parameter from a Fiber context and stores it in an integer pointer. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- limit (*int): A pointer to an integer to store the "limit" query parameter.
Returns:
- error: An error message if the "limit" query parameter is invalid or cannot be converted to an integer, or nil if the retrieval is successful.
func GetMaxBytesParam ¶
GetMaxBytesParam is a function that retrieves the "maxbytes" query parameter from a Fiber context and stores it in an integer pointer. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- maxBytes (*int): A pointer to an integer to store the "maxbytes" query parameter.
Returns:
- error: An error message if the "maxbytes" query parameter is invalid or cannot be converted to an integer, or nil if the retrieval is successful.
func GetMaxSizeParam ¶
GetMaxSizeParam is a function that retrieves the "maxsize" query parameter from a Fiber context and stores it in an integer pointer. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- maxSize (*int): A pointer to an integer to store the "maxsize" query parameter.
Returns:
- error: An error message if the "maxsize" query parameter is invalid or cannot be converted to an integer, or nil if the retrieval is successful.
func GetMinWordLengthParam ¶
Get the min word length url parameter
func GetSchemaParam ¶
GetSchemaParam is a function that retrieves a schema from a query parameter in a Fiber context and decodes it into a map of string keys and boolean values. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- schema (*map[string]bool): A pointer to a map of string keys and boolean values to store the decoded schema.
Returns:
- error: An error message if the decoding fails or the query parameter is invalid, or nil if the decoding is successful.
func GetStrictParam ¶
GetLimitParam is a function that retrieves the "limit" query parameter from a Fiber context and stores it in an integer pointer. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- limit (*int): A pointer to an integer to store the "limit" query parameter.
Returns:
- error: An error message if the "limit" query parameter is invalid or cannot be converted to an integer, or nil if the retrieval is successful.
func GetValueParam ¶
GetValueParam is a function that retrieves a value from a query parameter in a Fiber context and decodes it into a value of type T. Parameters:
- ctx (*fiber.Ctx): A pointer to a Fiber context.
- value (*T): A pointer to a value of type T to store the decoded value.
Returns:
- error: An error message if the decoding fails or the query parameter is invalid, or nil if the decoding is successful.
Types ¶
This section is empty.