wails
wails copied to clipboard
Proposal: introduce a standard api interface to make interceptors possible
Is your feature request related to a problem? Please describe.
Recently wails introduced an error formatting function which is very useful and can remove a bunch of boilerplate.
In my experience I miss such a function to handle not only an error, the the request/response data as well.
Describe the solution you'd like
Let’s say we have a bind method: type Method func(req interface{}) (res interface, err error)
And an interceptor function: type Interceptor func(f Method, name string, req interface{})
In case of satisfying a Method function definition the Interceptor type allows to handle pre/post calls.
Describe alternatives you've considered
The current solution doesn’t allow to wrap the methods manually since there is no such option to assign a method to a struct
Additional context
No response