utils

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSV2IntArray

func CSV2IntArray(csv string) ([]int64, error)

CSV2IntArray CSV intenger array conversion

func DecodeBasicAuthHeader

func DecodeBasicAuthHeader(header string) (string, string, error)

func DiffKeyValuesInMap

func DiffKeyValuesInMap(X, Y map[string]string) map[string]string

DiffKeyValuesInMap does a diff key and values from 2 strings maps

func DiffSlice

func DiffSlice(X, Y []string) []string

DiffSlice return de Difference between two Slices

func GetTLSConfig

func GetTLSConfig(
	SSLCert, SSLKey, SSLCA string,
	InsecureSkipVerify bool,
) (*tls.Config, error)

GetTLSConfig gets a tls.Config object from the given certs, key, and CA files. you must give the full path to the files. If all files are blank and InsecureSkipVerify=false, returns a nil pointer.

func RemoveDuplicatesUnordered

func RemoveDuplicatesUnordered(elements []string) []string

RemoveDuplicatesUnordered removes duplicated elements in the array string

func Splitter

func Splitter(s string, splits string) []string

Splitter multiple value split

func WaitAlignForNextCycle

func WaitAlignForNextCycle(SecPeriod int, l Logger)

WaitAlignForNextCycle waiths untile a next cycle begins aligned with second 00 of each minute

Types

type Logger

type Logger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Warn(args ...interface{})
	Warning(args ...interface{})
	Warnf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	WithFields(fields logrus.Fields) *logrus.Entry
}

Logger interface serve as a generic model to be used with *logrus.Logger or *logrus.Entry

type NetworkAddress

type NetworkAddress struct {
	Host string
	Port string
}

func SplitHostPortDefault

func SplitHostPortDefault(input, defaultHost, defaultPort string) (NetworkAddress, error)

Jump to

Keyboard shortcuts

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