utils

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

Taken from https://gist.github.com/dopey/c69559607800d2f2f90b1b1ed4e550fb GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func InStringSlice

func InStringSlice(in []string, search string) bool

func RemoveFromStringSlice

func RemoveFromStringSlice(s []string, i int) []string

func SortInt32Slice

func SortInt32Slice(x []int32)

Types

type Broker

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

func NewBroker

func NewBroker[T any](ctx context.Context) *Broker[T]

func (*Broker[T]) Publish

func (b *Broker[T]) Publish(msg T)

func (*Broker[T]) Start

func (b *Broker[T]) Start()

func (*Broker[T]) Stop

func (b *Broker[T]) Stop()

func (*Broker[T]) Subscribe

func (b *Broker[T]) Subscribe() chan T

func (*Broker[T]) Unsubscribe

func (b *Broker[T]) Unsubscribe(msgCh chan T)

type Int32Slice

type Int32Slice []int32

Int32Slice attaches the methods of Interface to []int32, sorting in increasing order.

func (Int32Slice) Len

func (x Int32Slice) Len() int

func (Int32Slice) Less

func (x Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (x Int32Slice) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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