remove context from client/server
This commit is contained in:
		| @@ -1,16 +0,0 @@ | |||||||
| package client |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type clientKey struct{} |  | ||||||
|  |  | ||||||
| func FromContext(ctx context.Context) (Client, bool) { |  | ||||||
| 	c, ok := ctx.Value(clientKey{}).(Client) |  | ||||||
| 	return c, ok |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewContext(ctx context.Context, c Client) context.Context { |  | ||||||
| 	return context.WithValue(ctx, clientKey{}, c) |  | ||||||
| } |  | ||||||
| @@ -1,16 +0,0 @@ | |||||||
| package server |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type serverKey struct{} |  | ||||||
|  |  | ||||||
| func FromContext(ctx context.Context) (Server, bool) { |  | ||||||
| 	c, ok := ctx.Value(serverKey{}).(Server) |  | ||||||
| 	return c, ok |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewContext(ctx context.Context, s Server) context.Context { |  | ||||||
| 	return context.WithValue(ctx, serverKey{}, s) |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user