util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UuidKey = "uuid"
)

Variables

View Source
var (
	HostRegex       = regexp.MustCompile(`^(?:[\w-]+\.)+\w+$`)
	IpAddressRegex  = regexp.MustCompile(`^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$`)
	UriRegex        = regexp.MustCompile(`^/?(?:[\w-]+/)*[\w-]+/?(?:\?(?:[\w-]+=[\w-]+)(?:&[\w-]+=[\w-]+)*)?$`)
	HttpMethodRegex = regexp.MustCompile(fmt.Sprintf(`^(%s)$`, strings.Join([]string{
		http.MethodGet,
		http.MethodHead,
		http.MethodPost,
		http.MethodPut,
		http.MethodPatch,
		http.MethodDelete,
		http.MethodConnect,
		http.MethodOptions,
		http.MethodTrace,
	}, "|")))
)

Functions

This section is empty.

Types

type Broadcaster

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

func (*Broadcaster[T]) Publish

func (b *Broadcaster[T]) Publish(event T, uuid string)

func (*Broadcaster[T]) PublishAsync

func (b *Broadcaster[T]) PublishAsync(event T, uuid string) *sync.WaitGroup

func (*Broadcaster[T]) Subscribe

func (b *Broadcaster[T]) Subscribe(subscriberId string, acceptFn func(event T) bool) <-chan T

func (*Broadcaster[T]) Unsubscribe

func (b *Broadcaster[T]) Unsubscribe(subscriberId string)

Jump to

Keyboard shortcuts

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