Skip to content

Commit

Permalink
feat(grpc): add client interceptor option
Browse files Browse the repository at this point in the history
  • Loading branch information
bradub committed Jan 30, 2023
1 parent a1e44dc commit bbfb852
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ linters-settings:
- name: max-public-structs
disabled: true
- name: line-length-limit
arguments: [ 80 ]
arguments: [ 100 ]
- name: argument-limit
disabled: true
- name: cyclomatic
Expand Down
10 changes: 10 additions & 0 deletions grpc/grpcclient/grpc_client_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ func WithContextDialer(
)
})
}

// WithClientUnaryInterceptor adds an interceptor for client calls.
func WithClientUnaryInterceptor(interceptor grpc.UnaryClientInterceptor) OptionConn {
return newFuncConnOption(func(o *connOptions) {
o.dialOptions = append(
o.dialOptions,
grpc.WithUnaryInterceptor(interceptor),
)
})
}

0 comments on commit bbfb852

Please sign in to comment.