utils

package
v0.0.0-...-0132329 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StructSliceToMapSlice

func StructSliceToMapSlice[T any](value []T) ([]map[string]any, error)

StructSliceToMapSlice converts the given slice to a slice of map

func ToMap

func ToMap(value any) (map[string]any, error)

ToMap converts the given struct pointer its corresponding map

Types

type Console

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

Console represents a simple stdout printer, with colour support

func NewConsole

func NewConsole(output io.Writer) *Console

NewConsole creates a new Console instance with default colour configurations for different message types, if the output is nil then os.Stdout is used

func (*Console) Debug

func (console *Console) Debug(a ...any)

Debug prints a debug message if verbose mode is enabled.

func (*Console) Debugf

func (console *Console) Debugf(format string, a ...any)

Debugf prints a formatted debug message if verbose mode is enabled.

func (*Console) Debugln

func (console *Console) Debugln(a ...any)

Debugln prints a debug message followed by a newline if verbose mode is enabled.

func (*Console) Error

func (console *Console) Error(a ...any)

Error prints an error message.

func (*Console) Errorf

func (console *Console) Errorf(format string, a ...any)

Errorf prints a formatted error message.

func (*Console) Errorln

func (console *Console) Errorln(a ...any)

Errorln prints an error message followed by a newline.

func (*Console) Info

func (console *Console) Info(a ...any)

Info prints an informational message.

func (*Console) Infof

func (console *Console) Infof(format string, a ...any)

Infof prints a formatted informational message.

func (*Console) Infoln

func (console *Console) Infoln(a ...any)

Infoln prints an informational message followed by a newline.

func (*Console) Information

func (console *Console) Information(a ...any)

Information is an alias for Info. It prints an informational message.

func (*Console) Informationf

func (console *Console) Informationf(format string, a ...any)

Informationf is an alias for Infof. It prints a formatted informational message.

func (*Console) Informationln

func (console *Console) Informationln(a ...any)

Informationln is an alias for Infoln. It prints an informational message followed by a newline.

func (*Console) ToggleVerboseMode

func (console *Console) ToggleVerboseMode(mode bool)

ToggleVerboseMode enables or disables verbose mode for the console.

func (*Console) Warn

func (console *Console) Warn(a ...any)

Warn prints a warning message.

func (*Console) Warnf

func (console *Console) Warnf(format string, a ...any)

Warnf prints a formatted warning message.

func (*Console) Warning

func (console *Console) Warning(a ...any)

Warning is an alias for Warn. It prints a warning message.

func (*Console) Warningf

func (console *Console) Warningf(format string, a ...any)

Warningf is an alias for Warnf. It prints a formatted warning message.

func (*Console) Warningln

func (console *Console) Warningln(a ...any)

Warningln is an alias for Warnln. It prints a warning message followed by a newline.

func (*Console) Warnln

func (console *Console) Warnln(a ...any)

Warnln prints a warning message followed by a newline.

Jump to

Keyboard shortcuts

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