Add db-connect, a SQL over HTTPS server

This commit is contained in:
Ashcon Partovi
2019-11-12 10:50:41 -08:00
parent 13bf65ce4e
commit 759cd019be
396 changed files with 362808 additions and 649 deletions

View File

@@ -0,0 +1,23 @@
package servertiming
import (
"context"
)
// NewContext returns a new Context that carries the Header value h.
func NewContext(ctx context.Context, h *Header) context.Context {
return context.WithValue(ctx, contextKey, h)
}
// FromContext returns the *Header in the context, if any. If no Header
// value exists, nil is returned.
func FromContext(ctx context.Context) *Header {
h, _ := ctx.Value(contextKey).(*Header)
return h
}
type contextKeyType struct{}
// The key where the header value is stored. This is globally unique since
// it uses a custom unexported type. The struct{} costs zero allocations.
var contextKey = contextKeyType(struct{}{})