tools

package
v0.0.0-...-f5d7580 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapCopy

func MapCopy[K comparable, V any](m map[K]V) map[K]V

func RemoveByValueSlice

func RemoveByValueSlice[V comparable](slice *SliceWithCounter[V], value V)

Sadly can't define a generic function whose type is more restrictive directly on the struct... so have to do like this.

Types

type ConfigLoader

type ConfigLoader struct {
	// contains filtered or unexported fields
}
var (
	SharedConfig *ConfigLoader
)

func (*ConfigLoader) GetAndHasConfig

func (config *ConfigLoader) GetAndHasConfig(key string) (value string, has bool)

func (*ConfigLoader) GetBoolConfig

func (config *ConfigLoader) GetBoolConfig(key string, def bool) bool

func (*ConfigLoader) GetConfig

func (config *ConfigLoader) GetConfig(key string) (value string)

func (*ConfigLoader) GetFloatConfig

func (config *ConfigLoader) GetFloatConfig(key string, def float64) float64

func (*ConfigLoader) GetInt32Config

func (config *ConfigLoader) GetInt32Config(key string, def int32) int32

func (*ConfigLoader) GetInt64Config

func (config *ConfigLoader) GetInt64Config(key string, def int64) int64

func (*ConfigLoader) GetIntConfig

func (config *ConfigLoader) GetIntConfig(key string, def int) int

func (*ConfigLoader) GetOrDefault

func (config *ConfigLoader) GetOrDefault(key string, def string) (value string)

func (*ConfigLoader) GetStringSliceCommaConfig

func (config *ConfigLoader) GetStringSliceCommaConfig(key string, def string) []string

Splits by comma instead of space.

func (*ConfigLoader) GetStringSliceConfig

func (config *ConfigLoader) GetStringSliceConfig(key string, def string) []string

Uses a whitespace to slice the string into different substrings

func (*ConfigLoader) HasConfig

func (config *ConfigLoader) HasConfig(key string) (has bool)

func (*ConfigLoader) InitEmptyConfig

func (config *ConfigLoader) InitEmptyConfig()

func (*ConfigLoader) LoadConfigs

func (config *ConfigLoader) LoadConfigs(folder string)

func (*ConfigLoader) ReplaceConfig

func (config *ConfigLoader) ReplaceConfig(key string, value string)

type SliceWithCounter

type SliceWithCounter[T any] struct {
	Slice []T
	Len   int
}

func NewSliceWithCounter

func NewSliceWithCounter[T any](size int) SliceWithCounter[T]

func (*SliceWithCounter[T]) AddToEnd

func (slice *SliceWithCounter[T]) AddToEnd(value T)

func (*SliceWithCounter[T]) Append

func (slice *SliceWithCounter[T]) Append(value T)

func (*SliceWithCounter[T]) Cap

func (slice *SliceWithCounter[T]) Cap() int

func (*SliceWithCounter[T]) Clear

func (slice *SliceWithCounter[T]) Clear()

func (*SliceWithCounter[T]) Copy

func (slice *SliceWithCounter[T]) Copy() SliceWithCounter[T]

func (*SliceWithCounter[T]) DeepClear

func (slice *SliceWithCounter[T]) DeepClear()

func (*SliceWithCounter[T]) Get

func (slice *SliceWithCounter[T]) Get(index int) T

func (*SliceWithCounter[T]) IsEmpty

func (slice *SliceWithCounter[T]) IsEmpty() bool

func (*SliceWithCounter[T]) Remove

func (slice *SliceWithCounter[T]) Remove(index int)

Shifts elements to the left

func (*SliceWithCounter[T]) RemoveAndGet

func (slice *SliceWithCounter[T]) RemoveAndGet(index int) (removed T)

func (*SliceWithCounter[T]) RemoveLast

func (slice *SliceWithCounter[T]) RemoveLast()

func (*SliceWithCounter[T]) Set

func (slice *SliceWithCounter[T]) Set(index int, value T)

func (*SliceWithCounter[T]) ToSlice

func (slice *SliceWithCounter[T]) ToSlice() []T

Jump to

Keyboard shortcuts

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