this repo has no description
1package request 2 3import ( 4 "context" 5 6 "github.com/bluesky-social/indigo/atproto/identity" 7 "tangled.org/core/appview/models" 8) 9 10type ctxKeyOwner struct{} 11type ctxKeyRepo struct{} 12type ctxKeyIssue struct{} 13 14func WithOwner(ctx context.Context, owner *identity.Identity) context.Context { 15 return context.WithValue(ctx, ctxKeyOwner{}, owner) 16} 17 18func OwnerFromContext(ctx context.Context) (*identity.Identity, bool) { 19 owner, ok := ctx.Value(ctxKeyOwner{}).(*identity.Identity) 20 return owner, ok 21} 22 23func WithRepo(ctx context.Context, repo *models.Repo) context.Context { 24 return context.WithValue(ctx, ctxKeyRepo{}, repo) 25} 26 27func RepoFromContext(ctx context.Context) (*models.Repo, bool) { 28 repo, ok := ctx.Value(ctxKeyRepo{}).(*models.Repo) 29 return repo, ok 30} 31 32func WithIssue(ctx context.Context, issue *models.Issue) context.Context { 33 return context.WithValue(ctx, ctxKeyIssue{}, issue) 34} 35 36func IssueFromContext(ctx context.Context) (*models.Issue, bool) { 37 issue, ok := ctx.Value(ctxKeyIssue{}).(*models.Issue) 38 return issue, ok 39}