mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
18 lines
320 B
Go
18 lines
320 B
Go
package backend
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type ledgerKey struct{}
|
|
|
|
var _ledgerKey = ledgerKey{}
|
|
|
|
func ContextWithLedger(ctx context.Context, ledger Ledger) context.Context {
|
|
return context.WithValue(ctx, _ledgerKey, ledger)
|
|
}
|
|
|
|
func LedgerFromContext(ctx context.Context) Ledger {
|
|
return ctx.Value(_ledgerKey).(Ledger)
|
|
}
|