feat: initial commit

This commit is contained in:
2025-02-21 18:42:56 +01:00
commit ee4a65b345
81 changed files with 3441 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package context
import (
"context"
"github.com/markbates/goth"
"github.com/pkg/errors"
)
const keyUser = "user"
func User(ctx context.Context) *goth.User {
user, ok := ctx.Value(keyUser).(*goth.User)
if !ok {
panic(errors.New("no user in context"))
}
return user
}
func SetUser(ctx context.Context, user *goth.User) context.Context {
return context.WithValue(ctx, keyUser, user)
}