set

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 1 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 (Typ[T]) Add

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

Add adds an element to the set.

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]) 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