Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
contains * checks if a string is present in a slice (aka an array) * PARAM s: the list/slice of strings to check * PARAM str: the string to check for * RETURNS: true if the string is present in the slice, false otherwise * from: https://freshman.tech/snippets/go/check-if-slice-contains-element/
func GetUniqueName ¶
func RemoveMatching ¶
removeMatching (UNTESTED) * removes all elements from a slice that match elements from another slice * PARAM a: the slice to remove elements from * PARAM b: the slice of match elements to remove from a * RETURNS: the slice a with all matching elements removed
func RemoveString ¶
RemoveString removes a string from a slice of strings
Types ¶
type EventSub ¶
type EventSub[Typ any] struct { // contains filtered or unexported fields }
EventSub is a simple fan-out event subscription system using go channels. based on PubSub from https://eli.thegreenplace.net/2020/pubsub-using-channels-in-go/
func NewEventSub ¶
NewEventSub creates a new EventSub struct of the passed type with the given buffer amount bufferAmt is the number of messages that can be pushed onto the event sub without subscribers reading the message(s) before the channel blocks (1 or greater is recommended)
func (*EventSub[Typ]) UnSubscribe ¶
func (es *EventSub[Typ]) UnSubscribe(c *<-chan *Typ)
type UnblockSignal ¶
type UnblockSignal struct { HasTriggered bool // contains filtered or unexported fields }
UnblockSignal * simple wrapper around a go channel to make it easier to block a goroutine from continuing and then let it continue when Trigger() is called * EXAMPLE USE: exiting a goroutine when some error happens in another goroutine
func NewUnblockSignal ¶
func NewUnblockSignal() UnblockSignal
func (*UnblockSignal) GetError ¶
func (e *UnblockSignal) GetError() error
func (*UnblockSignal) GetSignal ¶
func (e *UnblockSignal) GetSignal() chan bool
func (*UnblockSignal) Trigger ¶
func (e *UnblockSignal) Trigger()
func (*UnblockSignal) TriggerWithError ¶
func (e *UnblockSignal) TriggerWithError(err error)
func (*UnblockSignal) Wait ¶
func (e *UnblockSignal) Wait() error