utils

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufferInsert

func BufferInsert(buffer bytes.Buffer, target string, content string) bytes.Buffer

BufferInsert - Insert content into a buffer at a target string

func CalcBackupComponentNames

func CalcBackupComponentNames(components []types.BackupIterationComponent) string

func CalcBackupSize

func CalcBackupSize(components []types.BackupIterationComponent) string

func CalcBackupTimeTaken

func CalcBackupTimeTaken(status string, createdAt, completedAt time.Time) string

func CalcRestoreTimeTaken

func CalcRestoreTimeTaken(status string, createdAt, completedAt time.Time) string

func CalcSyncTimeTaken

func CalcSyncTimeTaken(status string, createdAt, completedAt time.Time) string

func CalculateBackupComponents

func CalculateBackupComponents(ogComponents []string) []string

func CalculateFriendlyETA

func CalculateFriendlyETA(eta int) string

func CalculateRestoreComponents

func CalculateRestoreComponents(ogComponents []string) []string

func CalculateRestoreStrat

func CalculateRestoreStrat(strategy string) string

func CheckCmd

func CheckCmd(p string) bool

CheckCmd - Checks if an executable is available and if not, returns false

func DisplayBackupComponentInfo

func DisplayBackupComponentInfo(components []types.BackupIterationComponent)

func DisplayRestoreComponentInfo

func DisplayRestoreComponentInfo(components []types.RestoreRequestResult)

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile - download a url to a local file.

func OpenSite

func OpenSite(url string) (string, error)

OpenSite - Split for multi platform

func OutputJSON added in v1.4.0

func OutputJSON(src []byte) error

func PrintCommandContext added in v1.4.0

func PrintCommandContext(output, login, subAlias, subHash string)

func PrintErrorJSON added in v1.4.0

func PrintErrorJSON(err error)

func PrintInterfaceAsJSON added in v1.4.0

func PrintInterfaceAsJSON(data interface{}) error

func RandomString

func RandomString() (string, error)

RandomString ...

func RemoveStringFromSlice

func RemoveStringFromSlice(s []string, r string) []string

func SliceEqual

func SliceEqual(a, b []string) bool

SliceEqual tells whether a and b contain the same elements in any order. A nil argument is equivalent to an empty slice.

func SliceIncludes

func SliceIncludes(slice []string, val string) bool

SliceIncludes tells whether val occurs one time in slice

func SliceIncludesAll

func SliceIncludesAll(a, b []string) bool

SliceEqual tells whether b contains at least the same elements of a in any order. This is to cater for the edge case there all items may be present in b that are required, but the check would otherwise fail if b contained an additional element not included in a A nil argument is equivalent to an empty slice.

func StringSliceContains

func StringSliceContains(s []string, e string) bool

func UnixMilliseconds

func UnixMilliseconds(t time.Time) int64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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