utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Copyright 2022. Motty Cohen

Hash utilities

Copyright 2022. Motty Cohen

JSON utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashUtils

func HashUtils() *hashUtils

Factory method that acts as a static member

func JsonUtils

func JsonUtils() *jsonUtils

Factory method

func RecoverAll

func RecoverAll(cb func(v any))

All performs recover for all panics.

Sample usage:

defer RecoverAll(func(err any) {
	fmt.Printf("got error: %s", err)
})

func RecoverAny

func RecoverAny(errors []error, cb func(v any))

Any performs call cb function with recovered value in case when recovered value exists in slice errors.

Sample usage:

		defer recover.Any([]error{ErrorUsernameBlank, ErrorUsernameAlreadyTaken}, func(err any) {
 		fmt.Printf("got error: %s", err)
		})

func RecoverOne

func RecoverOne(e error, cb func(v any))

One performs call cb function with recovered value in case when recovered value equals to e otherwise panic won't be recovered and will be propagated.

Sample usage:

defer recover.One(ErrorUsernameBlank, func(err any) {
	fmt.Printf("got error: %s", err)
})

Types

This section is empty.

Directories

Path Synopsis
* TTLCache - an in-memory cache with expiration * TTLCache is a simple key/value cache in golang with the following functions: * * 1.
* TTLCache - an in-memory cache with expiration * TTLCache is a simple key/value cache in golang with the following functions: * * 1.

Jump to

Keyboard shortcuts

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