utils

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultErrorHandler = func(c *fiber.Ctx, err error) error {
	code := fiber.StatusInternalServerError
	message := err.Error()

	var e *fiber.Error
	if errors.As(err, &e) {
		code = e.Code
	}

	return c.Status(code).JSON(fiber.Map{"error": message, "code": code})
}

DefaultErrorHandler is the default error handler.

Functions

func IntPtr

func IntPtr(i int) *int

IntPtr return a string pointer of a string.

func PtrInt

func PtrInt(i *int, defaults ...int) int

PtrInt return a string of a string pointer.

func PtrStr

func PtrStr(s *string) string

PtrStr return a string of a string pointer.

func PtrUUID

func PtrUUID(u *uuid.UUID) uuid.UUID

PtrUUID return a string of a string pointer.

func StrPtr

func StrPtr(s string) *string

StrPtr return a string pointer of a string.

func UUIDPtr

func UUIDPtr(u uuid.UUID) *uuid.UUID

UUIDPtr return a string pointer of a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL