readonly

package
v0.0.0-...-800b31a Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[Key comparable, Value any] struct {
	// contains filtered or unexported fields
}

Map provides a read-only wrapper around a map.

func (*Map[Key, Value]) All

func (r *Map[Key, Value]) All() iter.Seq2[Key, Value]

All iterates over the key/value pairs of the map.

func (*Map[Key, Value]) Fetch

func (r *Map[Key, Value]) Fetch(key Key) (Value, bool)

Fetch retrieves the value associated with the given key and a boolean indicating if the key exists.

func (*Map[Key, Value]) Get

func (r *Map[Key, Value]) Get(key Key) Value

Get retrieves the value associated with the given key. Returns the zero value of Value if the key does not exist.

func (*Map[Key, Value]) Has

func (r *Map[Key, Value]) Has(key Key) bool

Has checks if the key exists in the map.

func (*Map[Key, Value]) Keys

func (r *Map[Key, Value]) Keys() []Key

Keys returns a slice of all keys in the map.

func (*Map[Key, Value]) Size

func (r *Map[Key, Value]) Size() int

Size returns the number of entries in the map.

type MapBuilder

type MapBuilder[Key comparable, Value any] struct {
	// contains filtered or unexported fields
}

MapBuilder builds a Map.

func NewMapBuilder

func NewMapBuilder[Key comparable, Value any]() *MapBuilder[Key, Value]

NewMapBuilder returns a new MapBuilder.

func (*MapBuilder[Key, Value]) Build

func (b *MapBuilder[Key, Value]) Build() *Map[Key, Value]

Build creates a Map from the MapBuilder's entries.

func (*MapBuilder[Key, Value]) Set

func (b *MapBuilder[Key, Value]) Set(entries ...MapEntry[Key, Value]) *MapBuilder[Key, Value]

Set adds entries to the MapBuilder.

func (*MapBuilder[Key, Value]) SetMap

func (b *MapBuilder[Key, Value]) SetMap(otherMap map[Key]Value) *MapBuilder[Key, Value]

SetMap adds entries from another map to the MapBuilder.

type MapEntry

type MapEntry[Key comparable, Value any] struct {
	Key   Key
	Value Value
}

MapEntry is a key-value pair for the MapBuilder.

type Slice

type Slice[T any] struct {
	// contains filtered or unexported fields
}

Slice provides a read-only wrapper around a slice.

func (*Slice[T]) All

func (s *Slice[T]) All() iter.Seq2[int, T]

All iterates over the elements of the slice.

func (*Slice[T]) At

func (s *Slice[T]) At(index int) T

At retrieves the element at the given index.

func (*Slice[T]) Size

func (s *Slice[T]) Size() int

Size returns the number of elements in the slice.

type SliceBuilder

type SliceBuilder[T any] struct {
	// contains filtered or unexported fields
}

SliceBuilder builds a Slice.

func NewSliceBuilder

func NewSliceBuilder[T any]() *SliceBuilder[T]

NewSliceBuilder returns a new SliceBuilder.

func (*SliceBuilder[T]) Append

func (b *SliceBuilder[T]) Append(elements ...T) *SliceBuilder[T]

Append adds elements to the SliceBuilder.

func (*SliceBuilder[T]) Build

func (b *SliceBuilder[T]) Build() *Slice[T]

Build creates a Slice from the SliceBuilder's elements.

Jump to

Keyboard shortcuts

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