utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timing []timeLog

Functions

func BuildRequestPayload added in v0.2.0

func BuildRequestPayload(signature string, payload map[string]interface{}) *bytes.Buffer

BuildRequestPayload :: merges the provided payload with the standard payload that needs to be sent

func DebugDumpJSON added in v0.3.0

func DebugDumpJSON(msg string, d interface{})

functions specifically used for Debugging purposes.

func DebugDumpViper added in v0.3.0

func DebugDumpViper()

func DisplayProfileData

func DisplayProfileData()

func FailOnError

func FailOnError(err error)

func FailOnErrorWithMessage

func FailOnErrorWithMessage(err error, message string)

func FileHash

func FileHash(filePath string) (string, error)

func IsWSL added in v0.2.0

func IsWSL() (bool, error)

IsWSL :: detects whether app is running in WSL environment refer to: https://github.com/Microsoft/WSL/issues/423#issuecomment-679190758

func LogTime

func LogTime(operation string)

func Pluralize added in v0.2.2

func Pluralize(base string, count int) string

Pluralize :: pluralizes a word (if applicable) based on provided count

func SendRequest added in v0.2.0

func SendRequest(signature string, method string, sendRequestTo url.URL, payload *bytes.Buffer) (*http.Response, error)

SendRequest ::

func ShowError

func ShowError(err error)

func ShowErrorWithMessage

func ShowErrorWithMessage(err error, message string)

func ShowSpinner

func ShowSpinner(msg string) *spinner.Spinner

ShowSpinner :: create a spinner with a given message and start

func ShowWarning

func ShowWarning(warning string)

func StartSpinnerAfterDelay added in v0.1.1

func StartSpinnerAfterDelay(msg string, delay time.Duration, cancelStartIf chan bool) *spinner.Spinner

StartSpinnerAfterDelay :: create a spinner with a given message and start

func StopSpinner

func StopSpinner(spinner *spinner.Spinner)

StopSpinner :: stops a spinner instance and clears it

func StopSpinnerWithMessage

func StopSpinnerWithMessage(spinner *spinner.Spinner, finalMsg string)

StopSpinnerWithMessage :: stops a spinner instance and clears it, after writing `finalMsg`

func StringHash

func StringHash(s string) uint32

func UpdateSpinnerMessage added in v0.1.1

func UpdateSpinnerMessage(spinner *spinner.Spinner, newMessage string)

UpdateSpinnerMessage :: updates the message on the right of the given spinner

Types

type ExitCode

type ExitCode int

ExitCode :: alias for exitcode

type InteractiveExitStatus

type InteractiveExitStatus struct {
	ExitCode int
	Restart  bool
}

InteractiveExitStatus :: exist status from the interative prompt

We exit go-prompt after every query (in order to manage the prompt history to only include complete queries) We therefore need to distinguish between:

a user requested exit (ctrl+D or .exit) - indicated by a non-nil exit code and restart=false and a value , go-prompt being terminated after a query completion and requiring restarting - indicated by restart=true

Jump to

Keyboard shortcuts

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