datastructures

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found in Index")

Functions

func AllExists

func AllExists[T any](idx Index[T], keys ...string) bool

func Any added in v0.0.28

func Any[T any](elements []T, fn func(T) bool) bool

func Find added in v0.0.30

func Find[T any](elements []T, fn func(T) bool) *T

func Get

func Get[T any](idx Index[T], key string) (T, error)

func Has added in v0.37.0

func Has[T any](idx Index[T], key string) bool

func Keys

func Keys[T any](idx Index[T]) []string

func Merge added in v0.0.28

func Merge[T any](slices ...[]T) []T

func Remove added in v0.0.28

func Remove[T any](elements []T, fn func(T) bool) []T

func Unique added in v0.0.28

func Unique[T comparable](elements ...T) []T

Types

type DiffResult

type DiffResult struct {
	Added   []string
	Deleted []string
	Rest    []string
}

func Diff

func Diff[C, P any](current Index[C], previous Index[P]) DiffResult

func (DiffResult) String

func (d DiffResult) String() string

type Index

type Index[T any] map[string]T

func Filter

func Filter[T any](idx Index[T], keys ...string) Index[T]

func NewIndex

func NewIndex[T any](items []T, getID func(T) string) Index[T]

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy