Documentation
¶
Index ¶
- func AppName() string
- func BatchSliceOfStrings(ctx context.Context, keys []string, count int) <-chan []string
- func ChanFromSlice[T any](values []T) <-chan T
- func Checksum(data interface{}) []byte
- func Ellipsize(s string, limit int) string
- func IsContextCanceled(err error) bool
- func IsDeadlock(err error) bool
- func IsUnixAddr(host string) bool
- func JoinHostPort(host string, port int) string
- func PrintErrorThenExit(err error, exitCode int)
- func Timed(start time.Time, callback func(elapsed time.Duration))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppName ¶
func AppName() string
AppName returns the name of the executable that started this program (process).
func BatchSliceOfStrings ¶
BatchSliceOfStrings groups the given keys into chunks of size count and streams them into a returned channel. Panics if count is less than or equal to zero.
func ChanFromSlice ¶
func ChanFromSlice[T any](values []T) <-chan T
ChanFromSlice takes a slice of values and returns a channel from which these values can be received. This channel is closed after the last value was sent.
func Checksum ¶
func Checksum(data interface{}) []byte
Checksum returns the SHA-1 checksum of the data.
func IsContextCanceled ¶
IsContextCanceled returns whether the given error is context.Canceled.
func IsDeadlock ¶
IsDeadlock returns whether the given error signals serialization failure.
func IsUnixAddr ¶
IsUnixAddr indicates whether the given host string represents a Unix socket address.
A host string that begins with a forward slash ('/') is considered Unix socket address.
func JoinHostPort ¶
JoinHostPort is like its equivalent in net., but handles UNIX sockets as well.
func PrintErrorThenExit ¶
PrintErrorThenExit prints the given error to os.Stderr and exits with the specified error code.
Types ¶
This section is empty.