toolbox

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

README

toolbox

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyUnmarshal

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

func ReaderFromRequest added in v0.0.2

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

Types

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

Jump to

Keyboard shortcuts

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