util

package
v0.0.0-...-cde087c Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

* aml-jens * * (C) 2023 Deutsche Telekom AG * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

Index

Constants

This section is empty.

Variables

View Source
var DEBUG, INFO, WARN, FATAL = logging.GetLogger()

Functions

func AbsInt

func AbsInt(a int) int

func ByteCompare

func ByteCompare(a []byte, b []byte) bool

Compares each entrie of a and b Returns true only if a and be are of equal length AND have equal values

func FloorToInt

func FloorToInt(a float64) int

func FormatLabelISO

func FormatLabelISO(nbr float64) string

Format float64 to a ISO labeld nubmer with max 2 decimals

func FormatLabelISOKilo

func FormatLabelISOKilo(nbr float64) string

Format a number that already contains 1000*

func FormatLabelISOShorter

func FormatLabelISOShorter(nbr float64) string

Format float64 to a ISO labeld nubmer with max 1 decimal

func IsDirectory

func IsDirectory(path string) (bool, error)

func IsFileAndExecutable

func IsFileAndExecutable(path string) (bool, error)

func IterateTagName

func IterateTagName(name string) string

Iterate a name, adding (number) to it. Increment (number) if already has suffix. If it cant increment: returns 'random' base64 string

func MaxInt

func MaxInt(a int, b int) int

func MinInt

func MinInt(a int, b int) int

func RemoveWhiteSpace

func RemoveWhiteSpace(str string) string

func RetrieveMostLikelyGatewayIp

func RetrieveMostLikelyGatewayIp() string

Returns educated guess, on which ip the grafana is reachable

Types

type ErrorLevel

type ErrorLevel uint8
const (
	ErrInfo ErrorLevel = iota
	ErrWarn
	ErrFatal
)

type IndentedWriter

type IndentedWriter struct {
	// contains filtered or unexported fields
}

func NewIndentWirter

func NewIndentWirter() *IndentedWriter

func (*IndentedWriter) Indent

func (i *IndentedWriter) Indent(show_vertical_line bool)

func (*IndentedWriter) UnIndent

func (i *IndentedWriter) UnIndent()

func (*IndentedWriter) WriteCloseIndent

func (i *IndentedWriter) WriteCloseIndent(msg string) (n int, err error)

func (*IndentedWriter) WriteFirst

func (i *IndentedWriter) WriteFirst(msg string) (n int, err error)

func (*IndentedWriter) WriteNoIndent

func (i *IndentedWriter) WriteNoIndent(msg string) (n int, err error)

func (*IndentedWriter) WriteNormal

func (i *IndentedWriter) WriteNormal(msg string) (n int, err error)

func (*IndentedWriter) WriteNormalLines

func (i *IndentedWriter) WriteNormalLines(msgs []string) (n int, err error)

type RoutineReport

type RoutineReport struct {
	Wg               *sync.WaitGroup
	On_extern_exit_c chan uint8
	//This channel should be used, in the event of a fatal-ish error
	Send_error_c chan struct {
		Err   error
		Level ErrorLevel
	}
	//This channel should be used, if and only if some goroutine markes the application as finished
	Application_has_finished chan string
	// contains filtered or unexported fields
}

func (RoutineReport) Report

func (r RoutineReport) Report(err error, level ErrorLevel)

func (RoutineReport) ReportFatal

func (r RoutineReport) ReportFatal(err error)

func (RoutineReport) ReportInfo

func (r RoutineReport) ReportInfo(err error)

func (RoutineReport) ReportWarn

func (r RoutineReport) ReportWarn(err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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