typ

package
v4.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectWithError added in v4.0.2

func CollectWithError[T any](seq iter.Seq2[T, error]) (res []T, _ error)

CollectWithError is a function that collects items from a iter.Seq2 with an error into a slice, returning an error if any.

func Filter added in v4.0.2

func Filter[T any](seq iter.Seq[T], predicate func(T) bool) iter.Seq[T]

Filter is a function that filters a iter.Seq based on a predicate.

func Filter2 added in v4.0.2

func Filter2[T any, U any](seq iter.Seq2[T, U], predicate func(T, U) bool) iter.Seq2[T, U]

Filter2 is a function that filters a iter.Seq based on a predicate.

func FilterE added in v4.0.2

func FilterE[T any](seq iter.Seq2[T, error], predicate func(T) (bool, error)) iter.Seq2[T, error]

FilterE is a function that filters a iter.Seq2 with an error based on a predicate.

func NilablePtr

func NilablePtr[T comparable](v T) *T

func Ptr

func Ptr[T any](v T) *T

Ptr converts a value of any type to a pointer to that value.

func Remap

func Remap[S comparable, V any](v *V, m map[S]V, s S) error

func WithError added in v4.0.2

func WithError[T any](seq iter.Seq[T], err error) iter.Seq2[T, error]

WithError is a function that wraps a iter.Seq and yields items with a error.

func WithNilError added in v4.0.2

func WithNilError[T any](seq iter.Seq[T]) iter.Seq2[T, error]

WithNilError is a function that wraps a iter.Seq and yields items with a nil error.

Types

type Map

type Map[TKey comparable, TVal any] map[TKey]TVal

func (*Map[TKey, TVal]) Delete

func (m *Map[TKey, TVal]) Delete(key TKey)

func (*Map[TKey, TVal]) GetOrSet

func (m *Map[TKey, TVal]) GetOrSet(key TKey, setValue TVal) TVal

func (*Map[TKey, TVal]) Has

func (m *Map[TKey, TVal]) Has(key TKey) bool

func (*Map[TKey, TVal]) Set

func (m *Map[TKey, TVal]) Set(key TKey, val TVal)

func (*Map[TKey, TVal]) TryGet

func (m *Map[TKey, TVal]) TryGet(key TKey) (TVal, bool)

type Set added in v4.0.2

type Set[T comparable, U interface{ ID() T }] struct {
	// contains filtered or unexported fields
}

func NewSet added in v4.0.2

func NewSet[T comparable, U interface{ ID() T }](sources ...U) *Set[T, U]

func (*Set[T, U]) Add added in v4.0.2

func (s *Set[T, U]) Add(item U) (added bool)

func (*Set[T, U]) At added in v4.0.2

func (s *Set[T, U]) At(i int) U

func (*Set[T, U]) Clear added in v4.0.2

func (s *Set[T, U]) Clear()

func (*Set[T, U]) GetByID added in v4.0.2

func (s *Set[T, U]) GetByID(id T) (U, bool)

func (*Set[T, U]) Has added in v4.0.2

func (s *Set[T, U]) Has(item U) bool

func (*Set[T, U]) HasID added in v4.0.2

func (s *Set[T, U]) HasID(id T) bool

func (*Set[T, U]) Iter added in v4.0.2

func (s *Set[T, U]) Iter() iter.Seq[U]

func (*Set[T, U]) Len added in v4.0.2

func (s *Set[T, U]) Len() int

func (*Set[T, U]) List added in v4.0.2

func (s *Set[T, U]) List() []U

func (*Set[T, U]) Remove added in v4.0.2

func (s *Set[T, U]) Remove(item U) (removed bool)

func (*Set[T, U]) RemoveByID added in v4.0.2

func (s *Set[T, U]) RemoveByID(id T) (removed bool)

func (*Set[T, U]) Set added in v4.0.2

func (s *Set[T, U]) Set(item U) (updated bool)

type Tristate added in v4.0.2

type Tristate int

Tristate represents a filter state for boolean repository attributes

const (
	// TristateZero indicates no filtering should be applied
	TristateZero Tristate = iota

	// TristateTrue filters for repositories where the attribute is true
	TristateTrue
	// TristateFalse filters for repositories where the attribute is false
	TristateFalse
)

func (Tristate) AsBoolPtr added in v4.0.2

func (f Tristate) AsBoolPtr() (*bool, error)

AsBoolPtr converts the BooleanFilter to a pointer to a boolean value

Jump to

Keyboard shortcuts

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