util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package util contains helper functions and data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToTop added in v0.2.0

func AppendToTop[T any](s *Stack[[]T], v T) error

AppendToTop Appends a new value to the top slice of the stack.

func AppendToTopChecked added in v0.2.0

func AppendToTopChecked[T any](component string, s *Stack[[]T], v T)

Types

type Stack added in v0.2.0

type Stack[T any] struct {
	// contains filtered or unexported fields
}

Stack implementation with generics

func (*Stack[T]) Clear added in v0.2.0

func (s *Stack[T]) Clear()

Clear drops all values from the stack

func (*Stack[T]) IsEmpty added in v0.2.0

func (s *Stack[T]) IsEmpty() bool

IsEmpty checks if the stack is empty

func (*Stack[T]) Peek added in v0.2.0

func (s *Stack[T]) Peek() (T, error)

Peek returns the top most value from the stack without removing it Throws and error if the stack is empty

func (*Stack[T]) Pop added in v0.2.0

func (s *Stack[T]) Pop() (T, error)

Pop takes the top most value from the stack Throws and error if the stack is empty

func (*Stack[T]) Push added in v0.2.0

func (s *Stack[T]) Push(v T)

Push adds a value v to the top of the stack

func (*Stack[T]) Size added in v0.2.0

func (s *Stack[T]) Size() int

Size returns the size of the stack

func (*Stack[T]) Values added in v0.2.0

func (s *Stack[T]) Values() []T

Values returns all stack values as a slice

type UTCFormatter

type UTCFormatter struct {
	log.Formatter
}

func (UTCFormatter) Format

func (u UTCFormatter) Format(e *log.Entry) ([]byte, error)

Format formats the time on log entries for the UTC location

Jump to

Keyboard shortcuts

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