types

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffMap

func DiffMap(oldMap, newMap map[string]any) map[string]Change

Types

type AtomicEnum

type AtomicEnum[T Integer] atomic.Uint64

func (*AtomicEnum[T]) CompareAndSwap

func (a *AtomicEnum[T]) CompareAndSwap(oldVal, newVal T) bool

func (*AtomicEnum[T]) Load

func (a *AtomicEnum[T]) Load() T

func (*AtomicEnum[T]) SetIf

func (a *AtomicEnum[T]) SetIf(newValue T, prevValue ...T) (T, bool)

SetIf updates the atomic value if the previous value matches one of the supplied values. It returns true if the value has been changed.

func (*AtomicEnum[T]) SetIfNot

func (a *AtomicEnum[T]) SetIfNot(newValue T, prevValue ...T) (T, bool)

SetIfNot updates the atomic value if the previous value does not match any of the supplied values.

func (*AtomicEnum[T]) Store

func (a *AtomicEnum[T]) Store(v T)

func (*AtomicEnum[T]) Swap

func (a *AtomicEnum[T]) Swap(newVal T) T

type Change

type Change struct {
	Old any
	New any
}

type FanOut

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

func NewFanOut

func NewFanOut[T any](buf int) *FanOut[T]

func (*FanOut[T]) Add

func (f *FanOut[T]) Add() chan T

func (*FanOut[T]) Close

func (f *FanOut[T]) Close()

func (*FanOut[T]) Remove

func (f *FanOut[T]) Remove(ch chan T)

func (*FanOut[T]) Send

func (f *FanOut[T]) Send(v T)

type Integer

type Integer interface {
	Signed | Unsigned
}

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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