utils

package
v0.0.0-...-da4b772 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseBodyReader

func CloseBodyReader(ctx context.Context, bodyReader io.ReadCloser)

func ContextWithIps

func ContextWithIps(ctx context.Context, request *http.Request) context.Context

func DefaultHttpTransport

func DefaultHttpTransport() *http.Transport

func GetCustomCAPool

func GetCustomCAPool(caFilePath string) (*x509.CertPool, error)

func IpsFromContext

func IpsFromContext(ctx context.Context) mapset.Set[string]

func Map

func Map[T any, V any](a <-chan T, f func(T) V) chan V

func MatchWildcards

func MatchWildcards(pattern string, value string) bool

func WildcardToRegex

func WildcardToRegex(pattern string) string

Types

type Atomic

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

func NewAtomic

func NewAtomic[T any]() *Atomic[T]

func (*Atomic[T]) CompareAndSwap

func (a *Atomic[T]) CompareAndSwap(old T, new T) bool

func (*Atomic[T]) Has

func (a *Atomic[T]) Has() bool

func (*Atomic[T]) Load

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

func (*Atomic[T]) Store

func (a *Atomic[T]) Store(val T)

type BaseLifecycle

type BaseLifecycle struct {
	// contains filtered or unexported fields
}

func NewBaseLifecycle

func NewBaseLifecycle(name string, parentCtx context.Context) *BaseLifecycle

func (*BaseLifecycle) GetParentContext

func (l *BaseLifecycle) GetParentContext() context.Context

func (*BaseLifecycle) Running

func (l *BaseLifecycle) Running() bool

func (*BaseLifecycle) Start

func (l *BaseLifecycle) Start(f func(ctx context.Context) error)

func (*BaseLifecycle) Stop

func (l *BaseLifecycle) Stop()

type CMap

type CMap[K any, V any] struct {
	// contains filtered or unexported fields
}

func NewCMap

func NewCMap[K any, V any]() *CMap[K, V]

func (*CMap[K, V]) CompareAndSwap

func (mp *CMap[K, V]) CompareAndSwap(key K, old V, new V) bool

func (*CMap[K, V]) Delete

func (mp *CMap[K, V]) Delete(key K)

func (*CMap[K, V]) Load

func (mp *CMap[K, V]) Load(key K) (V, bool)

func (*CMap[K, V]) LoadAndDelete

func (mp *CMap[K, V]) LoadAndDelete(key K) (V, bool)

func (*CMap[K, V]) LoadOrStore

func (mp *CMap[K, V]) LoadOrStore(key K, val V) (V, bool)

func (*CMap[K, V]) Range

func (mp *CMap[K, V]) Range(f func(key K, val V) bool)

func (*CMap[K, V]) Store

func (mp *CMap[K, V]) Store(key K, val V)

type Lifecycle

type Lifecycle interface {
	Start()
	Stop()
	Running() bool
}

type Subscription

type Subscription[T any] struct {
	Events chan T
	// contains filtered or unexported fields
}

func (*Subscription[T]) Unsubscribe

func (s *Subscription[T]) Unsubscribe()

type SubscriptionManager

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

func NewSubscriptionManager

func NewSubscriptionManager[T any](name string) *SubscriptionManager[T]

func (*SubscriptionManager[T]) Publish

func (sm *SubscriptionManager[T]) Publish(event T)

func (*SubscriptionManager[T]) Subscribe

func (sm *SubscriptionManager[T]) Subscribe(name string) *Subscription[T]

func (*SubscriptionManager[T]) SubscribeWithInitialState

func (sm *SubscriptionManager[T]) SubscribeWithInitialState(name string, size int, initialState T) *Subscription[T]

func (*SubscriptionManager[T]) SubscribeWithSize

func (sm *SubscriptionManager[T]) SubscribeWithSize(name string, size int) *Subscription[T]

Jump to

Keyboard shortcuts

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