streambridge

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package streambridge holds the shared translation helpers every backend bridge uses to convert a provider's native types into the public capabilities types: Forward for the streaming event channel, Map for List* slice results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Forward

func Forward[T any](ctx context.Context, in <-chan T, conv func(T) capabilities.StreamEvent) <-chan capabilities.StreamEvent

Forward translates every event from in through conv onto a buffered output channel, closing it when in is drained. It selects on ctx.Done() for each send so that when the consumer stops reading (stream cancelled, backend switched) the goroutine exits instead of blocking forever on the send — the provider shares ctx and closes in on the same cancellation.

func Map

func Map[T, U any](in []T, conv func(T) U) []U

Map converts each element of in through conv. It always returns a non-nil slice (empty for empty/nil input), matching the bridges' List* contract of never handing the runtime a nil slice on success.

func Ptr

func Ptr[T, U any](v *T, conv func(T) U) *U

Ptr converts an optional value: nil in yields nil out, otherwise conv is applied and its result returned by address. It collapses the bridges' repeated nil-guarded pointer wrappers (a *provider.Session into a *capabilities.Session).

Types

This section is empty.

Jump to

Keyboard shortcuts

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