utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToSnake

func CamelToSnake(str string) string

func IsProduction

func IsProduction() bool

func QueryToUint

func QueryToUint(query string) uint

func ReadJsonFile

func ReadJsonFile(filename string) ([]byte, error)

func ReturnErrorResponse

func ReturnErrorResponse(c *fiber.Ctx, err error, data interface{}) error

func ReturnSuccessResponse

func ReturnSuccessResponse(c *fiber.Ctx, code int, msg string, data interface{}) error

func StructToJSONString added in v1.1.0

func StructToJSONString(s any) string

Convert struct to json string. Error ignored

Types

type AuthUser

type AuthUser struct {
	jwt.RegisteredClaims
	ID    uint64 `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

func GetAuthUser

func GetAuthUser(c *fiber.Ctx) AuthUser

type JSONResponse

type JSONResponse struct {
	Success   bool        `json:"success"`
	Message   string      `json:"message"`
	Data      interface{} `json:"data"`
	Timestamp int64       `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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