common

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateQuestion = errors.New("duplicate question")
	ErrNoQuestions       = errors.New("no questions")
)

Functions

This section is empty.

Types

type Answerer

type Answerer[K comparable, V any] interface {
	Answer(ctx context.Context, key K, answer V) error
}

type AskFunc

type AskFunc[K comparable] func(ctx context.Context, key K) error

type Asker

type Asker[K comparable, V any] interface {
	Ask(ctx context.Context, key K, fn AskFunc[K]) (V, error)
}

type MultiMutex

type MultiMutex[K comparable] struct {
	// contains filtered or unexported fields
}

func (*MultiMutex[K]) TryLock

func (m *MultiMutex[K]) TryLock(key K) (func(), error)

type Questions

type Questions[K comparable, V any] interface {
	Asker[K, V]
	Answerer[K, V]
}

func NewQuestions

func NewQuestions[K comparable, V any]() Questions[K, V]

type Stack

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

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (T, bool)

func (*Stack[T]) Push

func (s *Stack[T]) Push(values ...T)

Jump to

Keyboard shortcuts

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