utilds

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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 Errorf

func Errorf(code string, format string, args ...interface{}) error

Errorf creates a formatted error wrapped in a CodedError. This is a convenience function that combines fmt.Errorf with MakeCodedError.

func GetErrorCode

func GetErrorCode(err error) string

GetErrorCode extracts the error code from anywhere in the error chain. Returns empty string if no CodedError is found.

func GetErrorSubCode

func GetErrorSubCode(err error) string

GetErrorSubCode extracts the error subcode from anywhere in the error chain. Returns empty string if no CodedError is found or if SubCode is not set.

Types

type CodedError

type CodedError struct {
	Code    string
	SubCode string
	Err     error
}

CodedError wraps an error with a string code for categorization. The code can be extracted from anywhere in an error chain using GetErrorCode. SubCode provides additional granularity for error classification.

func MakeCodedError

func MakeCodedError(code string, err error) CodedError

MakeCodedError creates a new CodedError with the given code and error.

func MakeSubCodedError

func MakeSubCodedError(code string, subCode string, err error) CodedError

MakeSubCodedError creates a new CodedError with the given code, subcode, and error.

func (CodedError) Error

func (e CodedError) Error() string

func (CodedError) Unwrap

func (e CodedError) Unwrap() error

type QuickReorderQueue

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

func MakeQuickReorderQueue

func MakeQuickReorderQueue[T any](bufSize int, timeout time.Duration) *QuickReorderQueue[T]

func (*QuickReorderQueue[T]) C

func (q *QuickReorderQueue[T]) C() <-chan T

func (*QuickReorderQueue[T]) Close

func (q *QuickReorderQueue[T]) Close()

func (*QuickReorderQueue[T]) QueueItem

func (q *QuickReorderQueue[T]) QueueItem(sessionId string, seqNum int, data T) error

func (*QuickReorderQueue[T]) SetNextSeqNum

func (q *QuickReorderQueue[T]) SetNextSeqNum(seqNum int)

type SyncCache

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

func MakeSyncCache

func MakeSyncCache[T any](computeFn func() (T, error)) *SyncCache[T]

func (*SyncCache[T]) Get

func (sc *SyncCache[T]) Get(force bool) (T, error)

type VersionTs

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

func (*VersionTs) GetVersionTs

func (v *VersionTs) GetVersionTs() int64

type WorkQueue

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

func NewWorkQueue

func NewWorkQueue[T any](workFn func(T)) *WorkQueue[T]

func (*WorkQueue[T]) Close

func (wq *WorkQueue[T]) Close(immediate bool)

func (*WorkQueue[T]) Enqueue

func (wq *WorkQueue[T]) Enqueue(item T) bool

func (*WorkQueue[T]) Wait

func (wq *WorkQueue[T]) Wait()

Jump to

Keyboard shortcuts

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