behavior

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior[S, T any] interface {
	Run(context.Context, S, CacheableFn[S, T]) (T, error)
}

func New

func New[S, T any](entry Entry[T], t BehaviorType) Behavior[S, T]

type BehaviorType

type BehaviorType int
const (
	CacheType BehaviorType = iota
	WriteOnlyType
	BypassType
)

type CacheableFn

type CacheableFn[S, T any] func(context.Context, S) (T, error)

type Entry

type Entry[T any] interface {
	Get(context.Context) (*T, error)
	Set(context.Context, T) error
}

Jump to

Keyboard shortcuts

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