feat: initial commit

This commit is contained in:
2025-06-10 21:09:58 +02:00
commit 1fb753469e
84 changed files with 3912 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package context
import (
"context"
"net/url"
"github.com/pkg/errors"
)
const keyCurrentURL = "currentURL"
func CurrentURL(ctx context.Context) *url.URL {
currentURL, ok := ctx.Value(keyCurrentURL).(*url.URL)
if !ok {
panic(errors.New("no current url in context"))
}
return currentURL
}
func SetCurrentURL(ctx context.Context, u *url.URL) context.Context {
return context.WithValue(ctx, keyCurrentURL, u)
}