Documentation
¶
Index ¶
- Constants
- func GetRequestIDFromContext(ctx context.Context) string
- func MonkeyTime(with time.Time) func()
- func SetRequestIDToContext(ctx context.Context, requestID string) context.Context
- func SlogContextWrapper(h slog.Handler) slog.Handler
- func TraceNoReturn(ctx context.Context, tracerName string, spanName string, ...)
- func TraceReturnErr(ctx context.Context, tracerName string, spanName string, ...) error
- func TraceReturnT[T any](ctx context.Context, tracerName string, spanName string, ...) T
- func TraceReturnTWithErr[T any](ctx context.Context, tracerName string, spanName string, ...) (T, error)
- func ValidateStructCompact(s interface{}) error
- type ContextFieldsHandler
- type PriorityQueue
- type RateLimiter
- type ValidationError
Constants ¶
View Source
const ( BufferSize1024 = 2 << 10 BufferSize2048 = 2 << 11 BufferSize4096 = 2 << 12 BufferSize8192 = 2 << 13 BufferSize16384 = 2 << 14 BufferSize32768 = 2 << 15 BufferSize65536 = 2 << 16 )
View Source
const ValidateRulesTagName = "v"
Variables ¶
This section is empty.
Functions ¶
func GetRequestIDFromContext ¶
func MonkeyTime ¶
nolint:unused MonkeyTime patches time.Now() function to return predefined value
func SetRequestIDToContext ¶
func TraceNoReturn ¶
func TraceReturnErr ¶
func TraceReturnT ¶
func TraceReturnTWithErr ¶
func ValidateStructCompact ¶
func ValidateStructCompact(s interface{}) error
ValidateStructCompact calls ValidateStruct but returns single error instance
Types ¶
type ContextFieldsHandler ¶
ContextFieldsHandler is wrapper around slog handler which automatically adds predefined fields to logs taking values from context.
type PriorityQueue ¶
type PriorityQueue[T any] struct { // contains filtered or unexported fields }
PriorityQueue is a simple priority queue implementation with FIFO per Priority.
func NewPriorityQueue ¶
func NewPriorityQueue[T any]() *PriorityQueue[T]
func (*PriorityQueue[T]) Dequeue ¶
func (pq *PriorityQueue[T]) Dequeue() (T, bool)
func (*PriorityQueue[T]) Enqueue ¶
func (pq *PriorityQueue[T]) Enqueue(priority int, value T)
func (*PriorityQueue[T]) Extract ¶
func (pq *PriorityQueue[T]) Extract() []T
func (*PriorityQueue[T]) IsEmpty ¶
func (pq *PriorityQueue[T]) IsEmpty() bool
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter applies a cache-backed rate limit to hashed, namespaced client keys.
func NewRateLimiter ¶
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func ValidateStruct ¶
func ValidateStruct(s interface{}) []ValidationError
ValidateStruct validates arbitrary struct
func (ValidationError) Code ¶
func (e ValidationError) Code() string
func (ValidationError) Detail ¶
func (e ValidationError) Detail() string
func (ValidationError) Pointer ¶
func (e ValidationError) Pointer() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.