toolbox

package module
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 2

README

toolbox

various helpers we use daily

Golang

env

env.Get("KEY").Int()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CallNTimesWithDelay = toolbelt.CallNTimesWithDelay
View Source
var Debounce = toolbelt.Debounce
View Source
var FreePort = toolbelt.FreePort
View Source
var Throttle = toolbelt.Throttle

Functions

func BodyUnmarshal

func BodyUnmarshal(r io.ReadSeeker, store any) error

func Camel added in v0.0.4

func Camel(s string) string

func Cased added in v0.0.4

func Cased(s string, fn ...CasedFn) string

func Djb33 added in v0.0.10

func Djb33(seed uint32, k string) uint32

func Kebab added in v0.0.4

func Kebab(s string) string

func Lower added in v0.0.4

func Lower(s string) string

func Pascal added in v0.0.4

func Pascal(s string) string

func ReaderFromRequest added in v0.0.2

func ReaderFromRequest(r *http.Request) (io.ReadSeeker, error)

func ScreamingSnake added in v0.0.4

func ScreamingSnake(s string) string

func SlogInit added in v0.0.6

func SlogInit()

func Snake added in v0.0.4

func Snake(s string) string

func UUID added in v0.0.4

func UUID() string

func Upper added in v0.0.4

func Upper(s string) string

Types

type CasedFn added in v0.0.4

type CasedFn func(string) string

type CasedString added in v0.0.4

type CasedString struct {
	Original       string
	Pascal         string
	Camel          string
	Snake          string
	ScreamingSnake string
	Kebab          string
	Upper          string
	Lower          string
}

func ToCasedString added in v0.0.4

func ToCasedString(s string) CasedString

type LinkedList

type LinkedList[T any] struct {
	Head *Node[T] `json:"next"`
	Last *Node[T] `json:"-"` // Pointer to the last node
}

LinkedList is a generic linked list

func (*LinkedList[T]) Add

func (ll *LinkedList[T]) Add(value T)

Add adds a new node to the linked list

func (*LinkedList[T]) AsSlice

func (ll *LinkedList[T]) AsSlice() []T

func (*LinkedList[T]) RemoveById

func (ll *LinkedList[T]) RemoveById(matchFunc func(T) bool)

RemoveById removes a node from the list based on a function to match the ID

func (*LinkedList[T]) Reset

func (ll *LinkedList[T]) Reset()

func (*LinkedList[T]) Traverse

func (ll *LinkedList[T]) Traverse(callback func(T))

Traverse is a utility function to apply a callback function to each node

type Node

type Node[T any] struct {
	Value T        `json:"el"`
	Next  *Node[T] `json:"next"`
}

Node represents a generic node in a linked list

Directories

Path Synopsis
Package natsrouter provides a simple routing layer for NATS with unified request handling.
Package natsrouter provides a simple routing layer for NATS with unified request handling.

Jump to

Keyboard shortcuts

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