Documentation
¶
Overview ¶
Package safety is a package that provides a map with safety.
Index ¶
- func CopyValueCtx(ctx context.Context) context.Context
- func Go(ctx context.Context, name string, f func(context.Context) error, ...)
- type Map
- func (m *Map[K, V]) Append(ms ...map[K]V) *Map[K, V]
- func (m *Map[K, V]) Clear() *Map[K, V]
- func (m *Map[K, V]) Clone() *Map[K, V]
- func (m *Map[K, V]) Delete(k K) *Map[K, V]
- func (m *Map[K, V]) DeleteFunc(f func(k K, v V) bool) *Map[K, V]
- func (m *Map[K, V]) Get(k K) (V, bool)
- func (m *Map[K, V]) Keys() []K
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Map() map[K]V
- func (m *Map[K, V]) MarshalBinary() (data []byte, err error)
- func (m *Map[K, V]) Range(f func(k K, v V) bool)
- func (m *Map[K, V]) Scan(src any) error
- func (m *Map[K, V]) Set(k K, v V) *Map[K, V]
- func (m *Map[K, V]) String() string
- func (m *Map[K, V]) UnmarshalBinary(data []byte) error
- func (m *Map[K, V]) Value() (driver.Value, error)
- func (m *Map[K, V]) Values() []V
- type Slice
- func (s *Slice[T]) Append(v T) *Slice[T]
- func (s *Slice[T]) AppendSlice(ss ...[]T) *Slice[T]
- func (s *Slice[T]) Clear() *Slice[T]
- func (s *Slice[T]) Clone() *Slice[T]
- func (s *Slice[T]) Delete(i int) *Slice[T]
- func (s *Slice[T]) DeleteFunc(f func(v T) bool) *Slice[T]
- func (s *Slice[T]) Get(i int) T
- func (s *Slice[T]) Len() int
- func (s *Slice[T]) List() []T
- func (s *Slice[T]) MarshalBinary() ([]byte, error)
- func (s *Slice[T]) Range(f func(v T) bool)
- func (s *Slice[T]) Set(i int, v T) *Slice[T]
- func (s *Slice[T]) String() string
- func (s *Slice[T]) UnmarshalBinary(data []byte) error
- type SyncMap
- func (m *SyncMap[K, V]) Append(ms ...map[K]V) *SyncMap[K, V]
- func (m *SyncMap[K, V]) Clear() *SyncMap[K, V]
- func (m *SyncMap[K, V]) Clone() *SyncMap[K, V]
- func (m *SyncMap[K, V]) Delete(k K) *SyncMap[K, V]
- func (m *SyncMap[K, V]) DeleteFunc(f func(k K, v V) bool) *SyncMap[K, V]
- func (m *SyncMap[K, V]) Get(k K) (V, bool)
- func (m *SyncMap[K, V]) Keys() []K
- func (m *SyncMap[K, V]) Len() int
- func (m *SyncMap[K, V]) Map() map[K]V
- func (m *SyncMap[K, V]) MarshalBinary() ([]byte, error)
- func (m *SyncMap[K, V]) Range(f func(k K, v V) bool)
- func (m *SyncMap[K, V]) Set(k K, v V) *SyncMap[K, V]
- func (m *SyncMap[K, V]) String() string
- func (m *SyncMap[K, V]) UnmarshalBinary(data []byte) error
- func (m *SyncMap[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func NewMap ¶
func NewMap[K comparable, V any](m map[K]V) *Map[K, V]
func (*Map[K, V]) DeleteFunc ¶
func (*Map[K, V]) MarshalBinary ¶
func (*Map[K, V]) UnmarshalBinary ¶
type Slice ¶
type Slice[T any] struct { // contains filtered or unexported fields }
func (*Slice[T]) AppendSlice ¶
func (*Slice[T]) DeleteFunc ¶
func (*Slice[T]) MarshalBinary ¶
func (*Slice[T]) UnmarshalBinary ¶
type SyncMap ¶
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap is a thread-safe map that wraps sync.Map. The mu mutex is only used to protect the m pointer during replacement (e.g., Clear, Unmarshal). All other operations rely on sync.Map's internal concurrency safety.
func NewSyncMap ¶
func NewSyncMap[K comparable, V any](m map[K]V) *SyncMap[K, V]
func (*SyncMap[K, V]) DeleteFunc ¶
func (*SyncMap[K, V]) MarshalBinary ¶
func (*SyncMap[K, V]) UnmarshalBinary ¶
Click to show internal directories.
Click to hide internal directories.