Skip to content
Snippets Groups Projects
Commit 9fa38960 authored by cvictory's avatar cvictory
Browse files

add WithParameterTypeNames in Invocation

parent 04fa9b0e
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,8 @@ import (
type Invocation interface {
// MethodName gets invocation method name.
MethodName() string
// ParameterTypeNames gets invocation parameter type names.
ParameterTypeNames() []string
// ParameterTypes gets invocation parameter types.
ParameterTypes() []reflect.Type
// ParameterValues gets invocation parameter values.
......
......@@ -35,8 +35,11 @@ import (
// todo: is it necessary to separate fields of consumer(provider) from RPCInvocation
// nolint
type RPCInvocation struct {
methodName string
parameterTypes []reflect.Type
methodName string
// Parameter Type Names. It is used to specify the parameterType
parameterTypeNames []string
parameterTypes []reflect.Type
parameterValues []reflect.Value
arguments []interface{}
reply interface{}
......@@ -80,6 +83,11 @@ func (r *RPCInvocation) ParameterTypes() []reflect.Type {
return r.parameterTypes
}
// ParameterTypeNames gets RPC invocation parameter types of string expression.
func (r *RPCInvocation) ParameterTypeNames() []string {
return r.parameterTypeNames
}
// ParameterValues gets RPC invocation parameter values.
func (r *RPCInvocation) ParameterValues() []reflect.Value {
return r.parameterValues
......@@ -213,6 +221,13 @@ func WithParameterTypes(parameterTypes []reflect.Type) option {
}
}
// WithParameterTypeNames creates option with @parameterTypeNames.
func WithParameterTypeNames(parameterTypeNames []string) option {
return func(invo *RPCInvocation) {
invo.parameterTypeNames = parameterTypeNames
}
}
// WithParameterValues creates option with @parameterValues
func WithParameterValues(parameterValues []reflect.Value) option {
return func(invo *RPCInvocation) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment