Documentation ¶
Index ¶
- Variables
- func ApplyModifiers(req *http.Request, modifiers ...RequestModifier) *http.Request
- func AtLeastOne[Model any](body Model, model Model) bool
- func Client() *http.Client
- func ErrorHandler(c *fiber.Ctx, err error) error
- func ExecuteWithTimeout(ctx context.Context, fn func() error) error
- func ExecuteWithTimeoutResult[Result any](ctx context.Context, fn func() (*Result, error)) (*Result, error)
- func Exit(format string, a ...interface{})
- func FiberMessage(c *fiber.Ctx, statusCode int, response string) error
- func IntoScope(p fiberpaginate.PageInfo, db *gorm.DB) func(db *gorm.DB) *gorm.DB
- func IsDuplicate(err error) bool
- func IsExpectedPageInfo(err error) bool
- func IsNotFound(err error) bool
- func IsOk(statusCode int) bool
- func MapJsonTags[From any, Into any](from From, intoType *Into) (*Into, error)
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
- func NormalizeEmail(email string) string
- func ParseTime(s string, format TimeFormat) (*time.Time, error)
- func RegisterCustomValidators() (*validator.Validate, error)
- func Request(method string, url string, body []byte, modifiers ...RequestModifier) (*http.Response, error)
- func SplitBearerToken(accessToken string) (*string, error)
- func ToJsonString(p interface{}) (string, error)
- func ToSnakeCase(s string) string
- func Validate(validate *validator.Validate, s any, maybeErrs ...MaybeError) error
- func ValidateID(id string) (*uuid.UUID, error)
- type APIError
- func BadRequest(err error) APIError
- func Conflict() APIError
- func Forbidden() APIError
- func ForbiddenReason(err error) APIError
- func InternalServerError() APIError
- func InvalidJSON() APIError
- func InvalidRequestData(errors map[string]string) APIError
- func NewAPIError(statusCode int, err error) APIError
- func Unauthorized() APIError
- type HeaderKVModifier
- type MaybeError
- type Platform
- type RequestModifier
- type SuccessResponse
- type TimeFormat
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ApplyModifiers ¶
func ApplyModifiers(req *http.Request, modifiers ...RequestModifier) *http.Request
func AtLeastOne ¶
func ErrorHandler ¶
func FiberMessage ¶
func IsDuplicate ¶
func IsExpectedPageInfo ¶
func IsNotFound ¶
func MapJsonTags ¶
MapJsonTags maps request data to a target model using mapstructure NOTE: this function does not correctly map time.Time fields from from to time.Time fields in intoType see the following GitHub issues: https://github.com/mitchellh/mapstructure/issues/334 https://github.com/go-viper/mapstructure/issues/20
func MergeMaps ¶
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
MergeMaps merges multiple maps into a single map. The keys of maps earlier in the list will take precedence over keys in later maps.
func NormalizeEmail ¶
func RegisterCustomValidators ¶
func RegisterCustomValidators() (*validator.Validate, error)
func SplitBearerToken ¶
func ToJsonString ¶
func ToSnakeCase ¶
func Validate ¶
func Validate(validate *validator.Validate, s any, maybeErrs ...MaybeError) error
Types ¶
type APIError ¶
func BadRequest ¶
func ForbiddenReason ¶
func InternalServerError ¶
func InternalServerError() APIError
func InvalidJSON ¶
func InvalidJSON() APIError
func InvalidRequestData ¶
func NewAPIError ¶
func Unauthorized ¶
func Unauthorized() APIError
type HeaderKVModifier ¶
type MaybeError ¶
func NewMaybeError ¶
func NewMaybeError(name string, err error) *MaybeError
func (*MaybeError) IsError ¶
func (me *MaybeError) IsError() bool
func (*MaybeError) Unwrap ¶
func (me *MaybeError) Unwrap() error
type RequestModifier ¶
func AcceptJSON ¶
func AcceptJSON() RequestModifier
func Authorization ¶
func Authorization(value string) RequestModifier
func FormURLEncoded ¶
func FormURLEncoded() RequestModifier
func HeaderKV ¶
func HeaderKV(key, value string) RequestModifier
func JSON ¶
func JSON() RequestModifier
type SuccessResponse ¶
type SuccessResponse struct {
Message string `json:"message"`
}
For swagger docs:
Click to show internal directories.
Click to hide internal directories.