Documentation ¶
Index ¶
- func CheckEmpty[R any](value string, emptyFn func() R, notEmptyFn func(string) R) R
- func CheckEmptyRun(value string, emptyFn func(), notEmptyFn func(string))
- func CheckZero[T any, R any](value T, zeroFn func() R, notZeroFn func(T) R) R
- func CheckZeroRun[T any](value T, zeroFn func(), notZeroFn func(T))
- func DumpRequestBody(request *http.Request) (body []byte, err error)
- func DumpResponseBody(response *http.Response) (body []byte, err error)
- func EmptyThen(value string, emptyFn func() string) string
- func EmptyThenRun(value string, emptyFn func())
- func MapWithDefault[K string | int, V any](v, def map[K]V) map[K]V
- func MapWithItemKeyFunc[T any, K string | int](s []T, mapper fn.Function[T, K]) map[K]T
- func MapWithItemKeyValueFunc[T any, K string | int, V any](s []T, keyMapper fn.Function[T, K], valueMapper fn.Function[T, V]) map[K]V
- func MapWithKeyValueFunc[K string | int, V any, R any](v map[K]V, mapper fn.BiFunction[K, V, R]) map[K]R
- func MapWithValueFunc[K string | int, V any, R any](v map[K]V, mapper fn.Function[V, R]) map[K]R
- func NotEmptyThen[R any](value string, notEmptyFn func(string) R) R
- func NotEmptyThenRun(value string, notEmptyFn func(string))
- func NotZeroThen[T any, R any](value T, notZeroFn func(T) R) R
- func NotZeroThenRun[T any](value T, notZeroFn func(T))
- func Publish(topic string, msg any)
- func SliceWithItemFunc[T any, R any](s []T, mapper fn.Function[T, R]) []R
- func Subscribe(topic string, subscriber Subscriber)
- func Unsubscribe(topic string, subscriber Subscriber)
- func ZeroThen[T any](value T, zeroFn func() T) T
- func ZeroThenRun[T any](value T, zeroFn func())
- type Consumers
- type Ordered
- type OrderedSlice
- type PubSub
- type Registry
- type RegistryError
- type SubscribeConsumer
- type Subscriber
- type Subscribers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEmpty ¶
func CheckEmptyRun ¶
func CheckZeroRun ¶
func CheckZeroRun[T any](value T, zeroFn func(), notZeroFn func(T))
func EmptyThenRun ¶
func EmptyThenRun(value string, emptyFn func())
func MapWithDefault ¶
func MapWithItemKeyFunc ¶ added in v0.4.0
func MapWithItemKeyValueFunc ¶ added in v0.4.0
func MapWithKeyValueFunc ¶ added in v0.4.0
func MapWithValueFunc ¶ added in v0.4.0
func NotEmptyThen ¶
func NotEmptyThenRun ¶
func NotZeroThen ¶
func NotZeroThenRun ¶
func NotZeroThenRun[T any](value T, notZeroFn func(T))
func SliceWithItemFunc ¶ added in v0.4.0
func Subscribe ¶
func Subscribe(topic string, subscriber Subscriber)
func Unsubscribe ¶
func Unsubscribe(topic string, subscriber Subscriber)
func ZeroThenRun ¶
func ZeroThenRun[T any](value T, zeroFn func())
Types ¶
type Consumers ¶
type Consumers[T any] interface { Accept(T) CheckedAccept(T) error AppendConsumer(fn.Consumer[T]) Consumers[T] RemoveConsumer(fn.Consumer[T]) Consumers[T] }
func NewConsumers ¶ added in v0.2.0
type OrderedSlice ¶
type OrderedSlice[T Ordered] []T
func JoinOrdered ¶
func JoinOrdered[T Ordered](items ...T) OrderedSlice[T]
func (OrderedSlice[T]) Len ¶
func (x OrderedSlice[T]) Len() int
func (OrderedSlice[T]) Less ¶
func (x OrderedSlice[T]) Less(i, j int) bool
func (OrderedSlice[T]) Sort ¶
func (x OrderedSlice[T]) Sort()
func (OrderedSlice[T]) Swap ¶
func (x OrderedSlice[T]) Swap(i, j int)
type PubSub ¶
type PubSub interface { Subscribe(string, Subscriber) Unsubscribe(string, Subscriber) Publish(string, any) }
type RegistryError ¶
type RegistryError struct {
// contains filtered or unexported fields
}
func (*RegistryError) Error ¶
func (e *RegistryError) Error() string
type SubscribeConsumer ¶
func (SubscribeConsumer[T]) Subscribe ¶
func (s SubscribeConsumer[T]) Subscribe(msg any)
type Subscriber ¶
type Subscriber interface {
Subscribe(any)
}
func JoinSubscribers ¶
func JoinSubscribers(subscribers ...Subscriber) Subscriber
func SubChan ¶
func SubChan[T any](ch chan T) Subscriber
func SubConsumer ¶
func SubConsumer[T any](c fn.Consumer[T]) Subscriber
func SubFn ¶
func SubFn[T any](f func(T)) Subscriber
type Subscribers ¶
type Subscribers []Subscriber
func (Subscribers) Subscribe ¶
func (s Subscribers) Subscribe(msg any)
Click to show internal directories.
Click to hide internal directories.