utils

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package utils supplies logging and testing utils.

Index

Constants

This section is empty.

Variables

View Source
var CompletePath func(prefix string, suffix string) string = iter8utils.CompletePath

CompletePath determines complete path of a file

Functions

func BoolPointer added in v0.1.17

func BoolPointer(b bool) *bool

BoolPointer takes a bool as input, creates a new variable with the input value, and returns a pointer to the variable

func Float32Pointer added in v0.1.16

func Float32Pointer(f float32) *float32

Float32Pointer takes an float32 as input, creates a new variable with the input value, and returns a pointer to the variable

func Float64Pointer added in v0.1.16

func Float64Pointer(f float64) *float64

Float64Pointer takes an float64 as input, creates a new variable with the input value, and returns a pointer to the variable

func GetJSONBytes added in v0.1.16

func GetJSONBytes(url string) ([]byte, error)

GetJSONBytes downloads JSON from URL and returns a byte slice

func GetLogger

func GetLogger() *logrus.Logger

GetLogger returns a logger, if needed after creating it.

func Int32Pointer added in v0.1.16

func Int32Pointer(i int32) *int32

Int32Pointer takes an int32 as input, creates a new variable with the input value, and returns a pointer to the variable

func SetLogLevel

func SetLogLevel(l logrus.Level)

SetLogLevel sets level for logging.

func StringPointer added in v0.1.16

func StringPointer(s string) *string

StringPointer takes a string as input, creates a new variable with the input value, and returns a pointer to the variable

func WaitTimeoutOrError added in v0.1.16

func WaitTimeoutOrError(wg *sync.WaitGroup, timeout time.Duration, errCh chan error) error

WaitTimeoutOrError waits for one of the following three events 1) all goroutines in the waitgroup to finish normally -- no error is returned 2) a timeout occurred before all go routines could finish normally -- an error is returned 3) an error in the errCh channel sent by one of the goroutines -- an error is returned See https://stackoverflow.com/questions/32840687/timeout-for-waitgroup-wait

Types

type HTTPMethod added in v0.1.16

type HTTPMethod string

HTTPMethod is either GET or POST

const (
	// GET method
	GET HTTPMethod = "GET"
	// POST method
	POST = "POST"
)

func HTTPMethodPointer added in v0.1.16

func HTTPMethodPointer(h HTTPMethod) *HTTPMethod

HTTPMethodPointer takes an HTTPMethod as input, creates a new variable with the input value, and returns a pointer to the variable

Jump to

Keyboard shortcuts

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