aboutsummaryrefslogtreecommitdiff
path: root/pathrouter/variable.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-10-05 22:21:26 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-10-05 22:21:26 +0200
commit43a403b45d9644e634c2c560d16331305d83a4b0 (patch)
tree8ec3825579b388c205edfebed76b04906ae5368f /pathrouter/variable.go
parent6e5880aca9744d5e21434708f550f383400966e4 (diff)
downloadgo-gg-43a403b45d9644e634c2c560d16331305d83a4b0.tar.gz
pathrouter: remove type Context from public interface
Diffstat (limited to 'pathrouter/variable.go')
-rw-r--r--pathrouter/variable.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/pathrouter/variable.go b/pathrouter/variable.go
index 0cb44aa..78bf394 100644
--- a/pathrouter/variable.go
+++ b/pathrouter/variable.go
@@ -3,12 +3,16 @@
package pathrouter
-import "go.xyrillian.de/gg/options"
+import (
+ "net/http"
+
+ "go.xyrillian.de/gg/options"
+)
// Variable is a [Matcher] that accepts subpaths with at least one path element.
-// The value of the first path element will be collected into the [Context],
+// The value of the first path element will be collected
+// (to be retrieved inside the request handler using [VariableValue]),
// and the remaining subpath will have to be accepted by the next matcher.
-// The collected path element can be retrieved with [Context.Variable].
func Variable(name string, matcher Matcher) Matcher {
return variable(name, matcher.downcast())
}
@@ -17,7 +21,7 @@ func variable(name string, matcher realMatcher) Matcher {
return realMatcher{
minLength: matcher.minLength + 1,
maxLength: options.Map(matcher.maxLength, increment),
- accept: func(path []string, rc Context) HandlerFunc {
+ accept: func(path []string, rc routingContext) http.HandlerFunc {
if len(path) == 0 || path[0] == "" {
return nil
}