helper

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToBytesBuffer

func AnyToBytesBuffer(i interface{}) (*bytes.Buffer, error)

func AnyToString

func AnyToString(a any) string

func AssignFromSlice

func AssignFromSlice[T any](slice []T, vars ...*T)

func GetLocalizer

func GetLocalizer(c echo.Context) *i18n.Localizer

func GetTemplate

func GetTemplate(templ string) *template.Template

func GetVarValue

func GetVarValue(v any) any

func GracefulShutdown

func GracefulShutdown(log *logger.AppLogger, ops ...func() error)

func IfThenElse

func IfThenElse[T any](condition bool, ifTrue T, ifFalse T) T

func IsA

func IsA(a any, typeToAssert reflect.Kind) bool

func IsNil

func IsNil(x interface{}) bool

func JSONAPIModel

func JSONAPIModel[
	T interface{} |
		*map[string]interface{} |
		[]*map[string]interface{} |
		page.Paginate[map[string]interface{}],
](r *echo.Response, models T, status int) error

func MakeStruct

func MakeStruct(data map[string]any) interface{}

func MakeTemplateData

func MakeTemplateData(data map[string]any) interface{}

func MapToByte

func MapToByte(obj map[string]interface{}) ([]byte, error)

func MemoryUsage

func MemoryUsage() string

func Must

func Must[T any](t T, err error) T

func MustErr

func MustErr(err error)

func RequestID

func RequestID(c echo.Context) string

func RuntimeStatistics

func RuntimeStatistics(startTime time.Time, showName bool) string

func StructToJSONField

func StructToJSONField(obj interface{}) (jf.JsonField, error)

func StructToMap

func StructToMap(obj interface{}) (map[string]interface{}, error)

func SubStr

func SubStr(stack string, needle string) string

func Ter

func Ter[T any](cond bool, a, b T) T

func ToPointer

func ToPointer[T any](t T) *T

func ToPointerOrNil

func ToPointerOrNil[T comparable](t T) *T

func ValidationErrorString

func ValidationErrorString(
	ctx echo.Context,
	validationErrors validator.ValidationErrors,
) map[string]interface{}

func ValueFromPointer

func ValueFromPointer[T any](t *T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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