diff --git a/protocol/invocation.go b/protocol/invocation.go index 452f619e2dd9a5835141d91d7adfed37bb9f6859..2ecc817cc91e08fb6be10a0348477943d05bb1e3 100644 --- a/protocol/invocation.go +++ b/protocol/invocation.go @@ -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. diff --git a/protocol/invocation/rpcinvocation.go b/protocol/invocation/rpcinvocation.go index 4e806324bf7b236d80a932a92898ba117fb1638d..5831c637fd3f7191ab27ecd53f5d13a58e44657e 100644 --- a/protocol/invocation/rpcinvocation.go +++ b/protocol/invocation/rpcinvocation.go @@ -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) {