 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ValueInContext ¶ added in v0.190.0
type ValueInContext[Key ~struct{}, Value any] struct{}
    Example ¶
package main
import (
	"context"
	"go.llib.dev/frameless/pkg/contextkit"
)
func main() {
	type MyContextKey struct{}
	type MyValueType string
	vic := contextkit.ValueInContext[MyContextKey, MyValueType]{}
	var ctx = context.Background() // empty context
	v, ok := vic.Lookup(ctx)
	_, _ = v, ok // "", false
	ctx = vic.ContextWith(ctx, "Hello, world!") // context with value
	v, ok = vic.Lookup(ctx)
	_, _ = v, ok // "Hello, world!", true
}
func (ValueInContext[Key, Value]) ContextWith ¶ added in v0.190.0
func (h ValueInContext[Key, Value]) ContextWith(ctx context.Context, v Value) context.Context
 Click to show internal directories. 
   Click to hide internal directories.