48 lines
858 B
Go
48 lines
858 B
Go
package rpc
|
|
|
|
import (
|
|
"io"
|
|
|
|
"git.loafle.net/commons_go/rpc"
|
|
rpcServer "git.loafle.net/commons_go/rpc/server"
|
|
)
|
|
|
|
func NewServerHandler(registry rpc.Registry) *ServerHandlers {
|
|
sh := &ServerHandlers{}
|
|
sh.RPCRegistry = registry
|
|
|
|
return sh
|
|
}
|
|
|
|
type ServerHandlers struct {
|
|
rpcServer.ServerHandlers
|
|
}
|
|
|
|
func (sh *ServerHandlers) GetContentType(r io.Reader) string {
|
|
return "json"
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreRead(r io.Reader) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostRead(r io.Reader) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreWriteResult(w io.Writer, result interface{}) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostWriteResult(w io.Writer, result interface{}) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreWriteError(w io.Writer, err error) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostWriteError(w io.Writer, err error) {
|
|
// no op
|
|
}
|