helpers

package
v0.0.0-...-cc2b1d6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsCategory

func ContainsCategory(categories []*models.Category, category *models.Category) bool

func FormIntValue

func FormIntValue(r *http.Request, name string) (int, error)

FormIntValue parse form value to integer type.

func GetPaginationValues

func GetPaginationValues(r *http.Request) dto.Pagination

GetPaginationValues helpers will parse URL query and return dto.Pagination data.

func HttpCatch

func HttpCatch(w http.ResponseWriter, status int, err error)

func MustCatch

func MustCatch(err error)

MustCatch catches and panic exception

func Respond

func Respond(w http.ResponseWriter, r Response)

func ResponseErrors

func ResponseErrors(w http.ResponseWriter, errs []error)

ResponseErrors utility to return validation errors as JSON

func ValidateStruct

func ValidateStruct(obj interface{}) (errs []error)

Types

type Response

type Response struct {
	StatusCode int
	Msg        string
}

Jump to

Keyboard shortcuts

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