func QueryMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() queryVals := r.URL.Query() ctx = context.WithValue(ctx, "query_params", queryVals) r = r.WithContext(ctx) next.ServeHTTP(w, r) }) }In this example, the QueryMiddleware function takes another http.Handler function as an argument and returns an instance of the http.Handler interface. The http.Handler that is passed to the function is, in turn, wrapped with the QueryMiddleware. The wrapper QueryMiddleware function creates a new context.Context from the existing request context and adds key-value pairs of the URL query string parameters to the new context. The new context is then used in a new Request instance, which is then passed to the next http.Handler in the pipeline. This package can be used to extract URL query values from an HTTP request and make them available to downstream http.Handlers or application code.