Documentation
¶
Index ¶
- Variables
- func InArrayContain[T comparable](item T, items []T) bool
- func LoadCertPool(certPaths ...string) (*x509.CertPool, error)
- func PrintEsRequest(reqFun func(ctx context.Context) (*http.Request, error))
- func RandInt(minV, maxV int) int
- func RandomWithProbability(probability float64) bool
- func SliceLast[T comparable](c []T) T
- func SliceOf[T any](val ...T) []T
- type Channel
- type Singleton
- type SingletonWithValue
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClosed = errors.New("subscriber closed") ErrFull = errors.New("message channel full") )
Functions ¶
func InArrayContain ¶
func InArrayContain[T comparable](item T, items []T) bool
func LoadCertPool ¶
LoadCertPool 从多个证书文件路径加载证书池
func RandomWithProbability ¶
RandomWithProbability 随机概率 0.01 -> 1.
func SliceLast ¶
func SliceLast[T comparable](c []T) T
Types ¶
type Channel ¶
type Channel[V any] struct { // contains filtered or unexported fields }
func (*Channel[V]) PushWithContext ¶
type Singleton ¶
type Singleton[T any] interface { Load() T Inject(newFn func() T) Replace(newObj T) }
func NewSingleton ¶
type SingletonWithValue ¶
func NewSingletonWithValue ¶
func NewSingletonWithValue[T any, I any](newFn func(I) T) SingletonWithValue[T, I]
Click to show internal directories.
Click to hide internal directories.