@@ -96,84 +96,70 @@ func (f CallWithJSONWrapperFunc) CallWithJSON(ctx context.Context, argsJSON []by
9696 return f (ctx , argsJSON )
9797}
9898
99- // PlainFuncWrapper returns a Wrapper for a function call
99+ // VoidFuncWrapper returns a Wrapper for a function call
100100// without arguments and without results.
101- func PlainFuncWrapper (name string , call func ()) Wrapper {
102- return plainFuncWrapper {name , call }
103- }
104-
105- type plainFuncWrapper struct {
106- name string
107- call func ()
108- }
109-
110- func (f plainFuncWrapper ) String () string { return f .name }
111- func (f plainFuncWrapper ) Name () string { return f .name }
112-
113- func (plainFuncWrapper ) NumArgs () int { return 0 }
114- func (plainFuncWrapper ) ContextArg () bool { return false }
115- func (plainFuncWrapper ) NumResults () int { return 0 }
116- func (plainFuncWrapper ) ErrorResult () bool { return false }
117- func (plainFuncWrapper ) ArgNames () []string { return nil }
118- func (plainFuncWrapper ) ArgDescriptions () []string { return nil }
119- func (plainFuncWrapper ) ArgTypes () []reflect.Type { return nil }
120- func (plainFuncWrapper ) ResultTypes () []reflect.Type { return nil }
121-
122- func (f plainFuncWrapper ) Call (context.Context , []any ) ([]any , error ) {
123- f .call ()
101+ type VoidFuncWrapper func ()
102+
103+ func (VoidFuncWrapper ) String () string { return "func()" }
104+ func (VoidFuncWrapper ) Name () string { return "func()" }
105+
106+ func (VoidFuncWrapper ) NumArgs () int { return 0 }
107+ func (VoidFuncWrapper ) ContextArg () bool { return false }
108+ func (VoidFuncWrapper ) NumResults () int { return 0 }
109+ func (VoidFuncWrapper ) ErrorResult () bool { return false }
110+ func (VoidFuncWrapper ) ArgNames () []string { return nil }
111+ func (VoidFuncWrapper ) ArgDescriptions () []string { return nil }
112+ func (VoidFuncWrapper ) ArgTypes () []reflect.Type { return nil }
113+ func (VoidFuncWrapper ) ResultTypes () []reflect.Type { return nil }
114+
115+ func (f VoidFuncWrapper ) Call (context.Context , []any ) ([]any , error ) {
116+ f ()
124117 return nil , nil
125118}
126119
127- func (f plainFuncWrapper ) CallWithStrings (context.Context , ... string ) ([]any , error ) {
128- f . call ()
120+ func (f VoidFuncWrapper ) CallWithStrings (context.Context , ... string ) ([]any , error ) {
121+ f ()
129122 return nil , nil
130123}
131124
132- func (f plainFuncWrapper ) CallWithNamedStrings (context.Context , map [string ]string ) ([]any , error ) {
133- f . call ()
125+ func (f VoidFuncWrapper ) CallWithNamedStrings (context.Context , map [string ]string ) ([]any , error ) {
126+ f ()
134127 return nil , nil
135128}
136129
137- func (f plainFuncWrapper ) CallWithJSON (context.Context , []byte ) (results []any , err error ) {
138- f . call ()
130+ func (f VoidFuncWrapper ) CallWithJSON (context.Context , []byte ) (results []any , err error ) {
131+ f ()
139132 return nil , nil
140133}
141134
142- // PlainErrorFuncWrapper returns a Wrapper for a function call
135+ // ErrorFuncWrapper returns a Wrapper for a function call
143136// without arguments and with one error result.
144- func PlainErrorFuncWrapper (name string , call func () error ) Wrapper {
145- return plainErrorFuncWrapper {name , call }
146- }
147-
148- type plainErrorFuncWrapper struct {
149- name string
150- call func () error
151- }
137+ type ErrorFuncWrapper func () error
152138
153- func (f plainErrorFuncWrapper ) String () string { return f . name }
154- func (f plainErrorFuncWrapper ) Name () string { return f . name }
139+ func (ErrorFuncWrapper ) String () string { return "func() error" }
140+ func (ErrorFuncWrapper ) Name () string { return "func() error" }
155141
156- func (plainErrorFuncWrapper ) NumArgs () int { return 0 }
157- func (plainErrorFuncWrapper ) ContextArg () bool { return false }
158- func (plainErrorFuncWrapper ) NumResults () int { return 1 }
159- func (plainErrorFuncWrapper ) ErrorResult () bool { return true }
160- func (plainErrorFuncWrapper ) ArgNames () []string { return nil }
161- func (plainErrorFuncWrapper ) ArgDescriptions () []string { return nil }
162- func (plainErrorFuncWrapper ) ArgTypes () []reflect.Type { return nil }
163- func (plainErrorFuncWrapper ) ResultTypes () []reflect.Type { return []reflect.Type {typeOfError } }
142+ func (ErrorFuncWrapper ) NumArgs () int { return 0 }
143+ func (ErrorFuncWrapper ) ContextArg () bool { return false }
144+ func (ErrorFuncWrapper ) NumResults () int { return 1 }
145+ func (ErrorFuncWrapper ) ErrorResult () bool { return true }
146+ func (ErrorFuncWrapper ) ArgNames () []string { return nil }
147+ func (ErrorFuncWrapper ) ArgDescriptions () []string { return nil }
148+ func (ErrorFuncWrapper ) ArgTypes () []reflect.Type { return nil }
149+ func (ErrorFuncWrapper ) ResultTypes () []reflect.Type { return []reflect.Type {typeOfError } }
164150
165- func (f plainErrorFuncWrapper ) Call (context.Context , []any ) ([]any , error ) {
166- return nil , f . call ()
151+ func (f ErrorFuncWrapper ) Call (context.Context , []any ) ([]any , error ) {
152+ return nil , f ()
167153}
168154
169- func (f plainErrorFuncWrapper ) CallWithStrings (context.Context , ... string ) ([]any , error ) {
170- return nil , f . call ()
155+ func (f ErrorFuncWrapper ) CallWithStrings (context.Context , ... string ) ([]any , error ) {
156+ return nil , f ()
171157}
172158
173- func (f plainErrorFuncWrapper ) CallWithNamedStrings (context.Context , map [string ]string ) ([]any , error ) {
174- return nil , f . call ()
159+ func (f ErrorFuncWrapper ) CallWithNamedStrings (context.Context , map [string ]string ) ([]any , error ) {
160+ return nil , f ()
175161}
176162
177- func (f plainErrorFuncWrapper ) CallWithJSON (context.Context , []byte ) (results []any , err error ) {
178- return nil , f . call ()
163+ func (f ErrorFuncWrapper ) CallWithJSON (context.Context , []byte ) (results []any , err error ) {
164+ return nil , f ()
179165}
0 commit comments