set

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Typ

type Typ[T comparable] map[T]string

Typ is a generic type for a set data structure. It can only be used on comparable data types though

func New

func New[T comparable]() Typ[T]

New creates a new set.

func NewFromSlice added in v0.1.13

func NewFromSlice[T comparable](s []T) Typ[T]

NewFromSlice creates a new set from provided slice.

func (Typ[T]) Add

func (s Typ[T]) Add(element T, withVal ...string)

Add adds an element to the set.

func (Typ[T]) AsSlice added in v0.1.13

func (s Typ[T]) AsSlice() []T

func (Typ[T]) Contains

func (s Typ[T]) Contains(element T) bool

Contains checks if an element is in the set.

func (Typ[T]) Empty added in v0.1.10

func (s Typ[T]) Empty()

func (Typ[T]) Remove

func (s Typ[T]) Remove(element T)

Remove removes an element from the set.

func (Typ[T]) Size

func (s Typ[T]) Size() int

Size returns the number of elements in the set.

func (Typ[T]) Subtract added in v0.1.13

func (s Typ[T]) Subtract(another Typ[T]) Typ[T]

func (Typ[T]) Union added in v0.1.13

func (s Typ[T]) Union(with Typ[T]) Typ[T]

func (Typ[T]) Value

func (s Typ[T]) Value(element T) (string, bool)

Value will return the element value

Jump to

Keyboard shortcuts

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