util

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromProto

func ConvertFromProto(data map[string]*structpb.Value) map[string]any

func ConvertMapToStructPb

func ConvertMapToStructPb(data map[string]any) *structpb.Value

func ConvertToProto

func ConvertToProto(data map[string]any) map[string]*structpb.Value

func Shuffle

func Shuffle(in []int)

Types

type EncoderDecoder

type EncoderDecoder[T any] interface {
	Encode(value T) ([]byte, error)
	Decode(data []byte) (*T, error)
}

type JsonEncDec

type JsonEncDec[T any] struct{}

func NewJsonEncoderDecoder

func NewJsonEncoderDecoder[T any]() *JsonEncDec[T]

func (*JsonEncDec[T]) Decode

func (encdec *JsonEncDec[T]) Decode(data []byte) (*T, error)

func (*JsonEncDec[T]) Encode

func (encdec *JsonEncDec[T]) Encode(value T) ([]byte, error)

type Task

type Task any

type TickWorker

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

func NewTickWorker

func NewTickWorker(name string, interval int, stop chan struct{}, fn func(), wg *sync.WaitGroup) *TickWorker

func (*TickWorker) Start

func (tw *TickWorker) Start()

func (*TickWorker) Stop

func (tw *TickWorker) Stop()

type Worker

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

func NewWorker

func NewWorker(name string, wg *sync.WaitGroup, handler func(Task) error, capacity int) *Worker

func (*Worker) Sender

func (w *Worker) Sender() chan<- Task

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

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