routine

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGoroutineId

func GetGoroutineId() uint64

GetGoroutineId 获取当前协程id

Types

type Supplier

type Supplier[T any] func() T

Supplier 创建初始化值的提供者

type ThreadLocal

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

ThreadLocal ThreadLocalStorage 线程本地存储

func NewThreadLocal

func NewThreadLocal[T any](supplier ...Supplier[T]) *ThreadLocal[T]

NewThreadLocal 创建线程本地存储

func NewTraceIdThreadLocal

func NewTraceIdThreadLocal(supplier Supplier[string]) *ThreadLocal[string]

NewTraceIdThreadLocal 基于GoRoutine的TraceId处理器 如果不指定supplier则使用默认策略 uuid

func (*ThreadLocal[T]) Delete

func (l *ThreadLocal[T]) Delete()

Delete 删除值

func (*ThreadLocal[T]) Get

func (l *ThreadLocal[T]) Get() T

Get 获取值

func (*ThreadLocal[T]) Set

func (l *ThreadLocal[T]) Set(value T)

Set 设置值

Jump to

Keyboard shortcuts

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