utils

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 9 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

View Source
var (
	// DefaultTerminateSignals default signals to handle
	// if not signals are provided
	// NOTE: we use the default st here instead of ALL signals
	// to avoid dying on signals like SIGCHLD and others that
	// are not intend to terminate the process
	DefaultTerminateSignals = []os.Signal{
		syscall.SIGTERM, syscall.SIGHUP, syscall.SIGINT,
		syscall.SIGQUIT,
	}
)

Functions

func NewRedisConn

func NewRedisConn(address string) (redis.Conn, error)

func NewRedisPool

func NewRedisPool(address string, size ...uint32) (*redis.Pool, error)

func OnDone

func OnDone(ctx context.Context, cb func(error))

OnDone registers a callback on a context when it's done The ctx.Err() is passed as is to the callback function

func WithSignal

func WithSignal(ctx context.Context, sig ...os.Signal) (context.Context, context.CancelFunc)

WithSignal return a context that is canceld if any of the specified signals was received

Types

type Mark

type Mark interface {
	Done(ctx context.Context) error
	Signal()
}

Mark defined a placeholder where multiple routines can use to synchronize their operation. Routines calling Done will be blocked until one calls Signal. After that all calls to Done should return immediately

func NewMark

func NewMark() Mark

type RedisDialParams

type RedisDialParams struct {
	Scheme  string
	Host    string
	Options []redis.DialOption
}

Jump to

Keyboard shortcuts

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