19 lines
364 B
Go
19 lines
364 B
Go
package shared
|
|
|
|
import (
|
|
th "github.com/mymmrac/telego/telegohandler"
|
|
|
|
"git.entityseven.com/rilaxik/pllist/internal/domain"
|
|
)
|
|
|
|
type userKey struct{}
|
|
|
|
func WithUser(ctx *th.Context, user domain.User) *th.Context {
|
|
return ctx.WithValue(userKey{}, user)
|
|
}
|
|
|
|
func UserFrom(ctx *th.Context) domain.User {
|
|
user, _ := ctx.Value(userKey{}).(domain.User)
|
|
return user
|
|
}
|