helpers

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpJSON

func DumpJSON(v any) string

DumpJSON marshals a value to a JSON string, if it fails, it will return an empty string.

func GenerateCacheKey

func GenerateCacheKey(req any, functionName string, softTTL, hardTTL time.Duration, version string) (string, error)

GenerateCacheKey generates a cache key for a given function name and request encoded in SHA512. With the following format: SHA512(functionName:marshalledRequest:softTTL:hardTTL)

func GetFunctionName

func GetFunctionName(f any) string

GetFunctionName uses reflect to retrieve the name of the function passed into the higher-order function.

func TernaryOp

func TernaryOp[T any](condition bool, trueVal, falseVal T) T

TernaryOp is a helper function to do a ternary operation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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