Skip to content

Commit

Permalink
add Limited method
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannm committed May 12, 2022
1 parent f276d19 commit 41b7c90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ func (ctx *Context) HasError() bool {
return ctx.err != nil
}

// Limited returns a LimitedContext. This is useful when you don't want to give all
// capabilities of the Context to some other function/method.
func (ctx *Context) Limited() *LimitedContext {
return newLimitedContext(ctx)
}

func (ctx *Context) reset() {
for k := range ctx.kv {
delete(ctx.kv, k)
Expand Down
4 changes: 0 additions & 4 deletions ctx_limited.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,3 @@ func (ctx *LimitedContext) Route() string {
func (ctx *LimitedContext) ServiceName() string {
return ctx.ctx.ServiceName()
}

func (ctx *LimitedContext) Cluster() Cluster {
panic("not implemented")
}

0 comments on commit 41b7c90

Please sign in to comment.