utils

package
v0.0.0-...-eec4b17 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirIfNotExists

func CreateDirIfNotExists(dirPath string)

CreateDirIfNotExists creates a directory if it does not exist

func GetEnvOr

func GetEnvOr(envKey string, orValue string) string

GetEnvOr returns the value of the ENV variable having the given key, or the provided orValue

func GetTimePointer

func GetTimePointer(time time.Time) *time.Time

func Max

func Max(first int, second int) int

Max returns the max between first and second

func MergeAndRemoveDuplicates

func MergeAndRemoveDuplicates(first []string, second []string) []string

MergeAndRemoveDuplicates merges two slices of strings and removes duplicates

func UnwrapError

func UnwrapError(ctx context.Context, err error) error

Types

type HttpError

type HttpError struct {
	StatusCode codes.Code
	Response   string
	Headers    map[string]string
}

func NewTooManyRequestsError

func NewTooManyRequestsError(res string) *HttpError

func WrapErr

func WrapErr(statusCode codes.Code, res string) *HttpError

WrapErr wraps the given error into a new one that contains the given status code and response

func (*HttpError) Error

func (e *HttpError) Error() string

func (*HttpError) WithHeaders

func (e *HttpError) WithHeaders(headers map[string]string) *HttpError

Jump to

Keyboard shortcuts

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