All checks were successful
continuous-integration/drone/push Build is passing
19 lines
349 B
Go
19 lines
349 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type contextKey struct{}
|
|
|
|
var recordIDKey = contextKey{}
|
|
|
|
func withRecord(ctx context.Context, rec *TunnelRecord) context.Context {
|
|
return context.WithValue(ctx, recordIDKey, rec)
|
|
}
|
|
|
|
func getRecord(ctx context.Context) (*TunnelRecord, bool) {
|
|
id, ok := ctx.Value(recordIDKey).(*TunnelRecord)
|
|
return id, ok
|
|
}
|