native

package module
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

https://h12.io/article/go-pattern-context-aware-lock

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertSetup added in v0.0.2

func CertSetup() (serverCert *tls.Certificate, err error)

https://gist.github.com/shaneutt/5e1995295cff6721c89a71d13a71c251

func ConcatSlices added in v0.0.10

func ConcatSlices[T any](slices ...[]T) []T

func FilterSlices added in v0.0.12

func FilterSlices[T any](filter func(T) bool, slices ...[]T) []T

func MapSlices added in v0.0.13

func MapSlices[I any, O any](fn func(I) O, slices ...[]I) []O

func Must2

func Must2[T any](data T, err error) T

func NewCloseSignal

func NewCloseSignal() <-chan os.Signal

func NewReloadSignal

func NewReloadSignal() <-chan os.Signal

func NewTLSServer added in v0.0.2

func NewTLSServer(addr string, handler http.Handler, errorLog *log.Logger) *http.Server

func Pointer

func Pointer[T interface{}](data T) *T

Types

type ContextLocker added in v0.0.4

type ContextLocker interface {
	Lock(ctx context.Context) bool
	Unlock()
	Locked() bool
}

func ContextMutex added in v0.0.4

func ContextMutex() ContextLocker

type Set added in v0.0.6

type Set[K comparable] map[K]struct{}

func NewSetFromSlice added in v0.0.6

func NewSetFromSlice[K comparable](slices ...[]K) Set[K]

func NewSetFromSliceFn added in v0.0.9

func NewSetFromSliceFn[T any, K comparable](getKey func(T) (K, bool), slices ...[]T) Set[K]

func (Set[K]) Has added in v0.0.6

func (t Set[K]) Has(value K) bool

func (Set[K]) HasAll added in v0.0.7

func (t Set[K]) HasAll(values []K) bool

func (Set[K]) HasAny added in v0.0.6

func (t Set[K]) HasAny(values []K) bool

Directories

Path Synopsis
Package singleflight provides a duplicate function call suppression mechanism.
Package singleflight provides a duplicate function call suppression mechanism.

Jump to

Keyboard shortcuts

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