utils

package
v0.0.0-...-d2a67e6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignIfNonZero

func AssignIfNonZero(field *int, newValue int)

func AssignIfNonZeroFloat

func AssignIfNonZeroFloat(field *float64, newValue float64)

func AssignIfNotEmpty

func AssignIfNotEmpty(field *string, newValue string)

func AssignUUIDIFNonEmpty

func AssignUUIDIFNonEmpty(id *uuid.UUID, newID uuid.UUID)

func DecodeReqBody

func DecodeReqBody(r *http.Request, body interface{}) error

func EnsureNumberValueIsPositive

func EnsureNumberValueIsPositive(number float64) error

func EnsureValueIsAValidEmailFormat

func EnsureValueIsAValidEmailFormat(email string) error

func EnsureValueIsAValidUUID

func EnsureValueIsAValidUUID(uuid string) error

func EnsureValueIsNotEmpty

func EnsureValueIsNotEmpty(field string) error

func EnsureValueIsValidAge

func EnsureValueIsValidAge(age int) error

func EnsureValueIsValidPasswordComplexity

func EnsureValueIsValidPasswordComplexity(password string) error

func GetPagination

func GetPagination(r *http.Request) (int, int)

func GetURLParam

func GetURLParam(r *http.Request, key string) (string, error)

func HandleHTTPError

func HandleHTTPError(w http.ResponseWriter, err error, code int)

func HandleHTTPResponse

func HandleHTTPResponse(w http.ResponseWriter, msg string, code int, body interface{})

Types

type Response

type Response struct {
	Body interface{} `json:"body"`
	Msg  string      `json:"message"`
}

Jump to

Keyboard shortcuts

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