Documentation ¶
Overview ¶
Package mocks contains mocks of interfaces.
Index ¶
- Constants
- func MockFuncHandler(mf func(ctx context.Context, req *MyRequest) (r *MyResponse, err error)) interface{}
- func MyServiceHandler() interface{}
- func NewMockArgs() interface{}
- func NewMockCliTransHandlerFactory(hdrl *MockCliTransHandler) remote.ClientTransHandlerFactory
- func NewMockResult() interface{}
- func NewMockSvrTransHandlerFactory(hdrl *MockSvrTransHandler) remote.ServerTransHandlerFactory
- func NewMockTransServerFactory(transSvr *MockTransServer) remote.TransServerFactory
- func ServiceInfo() *serviceinfo.ServiceInfo
- type Conn
- func (m Conn) Close() (e error)
- func (m Conn) LocalAddr() (r net.Addr)
- func (m Conn) Read(b []byte) (n int, err error)
- func (m Conn) RemoteAddr() (r net.Addr)
- func (m Conn) SetDeadline(t time.Time) (e error)
- func (m Conn) SetReadDeadline(t time.Time) (e error)
- func (m Conn) SetWriteDeadline(t time.Time) (e error)
- func (m Conn) Write(b []byte) (n int, err error)
- type MockCliTransHandler
- func (t *MockCliTransHandler) OnActive(ctx context.Context, conn net.Conn) (context.Context, error)
- func (t *MockCliTransHandler) OnError(ctx context.Context, err error, conn net.Conn)
- func (t *MockCliTransHandler) OnInactive(ctx context.Context, conn net.Conn)
- func (t *MockCliTransHandler) OnMessage(ctx context.Context, args, result remote.Message) (context.Context, error)
- func (t *MockCliTransHandler) Read(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error)
- func (t *MockCliTransHandler) SetPipeline(p *remote.TransPipeline)
- func (t *MockCliTransHandler) Write(ctx context.Context, conn net.Conn, send remote.Message) (nctx context.Context, err error)
- type MockSvrTransHandler
- func (t *MockSvrTransHandler) OnActive(ctx context.Context, conn net.Conn) (context.Context, error)
- func (t *MockSvrTransHandler) OnError(ctx context.Context, err error, conn net.Conn)
- func (t *MockSvrTransHandler) OnInactive(ctx context.Context, conn net.Conn)
- func (t *MockSvrTransHandler) OnMessage(ctx context.Context, args, result remote.Message) (context.Context, error)
- func (t *MockSvrTransHandler) OnRead(ctx context.Context, conn net.Conn) (err error)
- func (t *MockSvrTransHandler) Read(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error)
- func (t *MockSvrTransHandler) SetPipeline(p *remote.TransPipeline)
- func (t *MockSvrTransHandler) Write(ctx context.Context, conn net.Conn, send remote.Message) (nctx context.Context, err error)
- type MockThriftTTransport
- func (m *MockThriftTTransport) Flush(ctx context.Context) (err error)
- func (m *MockThriftTTransport) ReadBinary() (value []byte, err error)
- func (m *MockThriftTTransport) ReadBool() (value bool, err error)
- func (m *MockThriftTTransport) ReadByte() (value int8, err error)
- func (m *MockThriftTTransport) ReadDouble() (value float64, err error)
- func (m *MockThriftTTransport) ReadFieldBegin() (name string, typeID thrift.TType, id int16, err error)
- func (m *MockThriftTTransport) ReadFieldEnd() error
- func (m *MockThriftTTransport) ReadI16() (value int16, err error)
- func (m *MockThriftTTransport) ReadI32() (value int32, err error)
- func (m *MockThriftTTransport) ReadI64() (value int64, err error)
- func (m *MockThriftTTransport) ReadListBegin() (elemType thrift.TType, size int, err error)
- func (m *MockThriftTTransport) ReadListEnd() error
- func (m *MockThriftTTransport) ReadMapBegin() (keyType, valueType thrift.TType, size int, err error)
- func (m *MockThriftTTransport) ReadMapEnd() error
- func (m *MockThriftTTransport) ReadMessageBegin() (name string, typeID thrift.TMessageType, seqID int32, err error)
- func (m *MockThriftTTransport) ReadMessageEnd() error
- func (m *MockThriftTTransport) ReadSetBegin() (elemType thrift.TType, size int, err error)
- func (m *MockThriftTTransport) ReadSetEnd() error
- func (m *MockThriftTTransport) ReadString() (value string, err error)
- func (m *MockThriftTTransport) ReadStructBegin() (name string, err error)
- func (m *MockThriftTTransport) ReadStructEnd() error
- func (m *MockThriftTTransport) Skip(fieldType thrift.TType) (err error)
- func (m *MockThriftTTransport) Transport() thrift.TTransport
- func (m *MockThriftTTransport) WriteBinary(value []byte) error
- func (m *MockThriftTTransport) WriteBool(value bool) error
- func (m *MockThriftTTransport) WriteByte(value int8) error
- func (m *MockThriftTTransport) WriteDouble(value float64) error
- func (m *MockThriftTTransport) WriteFieldBegin(name string, typeID thrift.TType, id int16) error
- func (m *MockThriftTTransport) WriteFieldEnd() error
- func (m *MockThriftTTransport) WriteFieldStop() error
- func (m *MockThriftTTransport) WriteI16(value int16) error
- func (m *MockThriftTTransport) WriteI32(value int32) error
- func (m *MockThriftTTransport) WriteI64(value int64) error
- func (m *MockThriftTTransport) WriteListBegin(elemType thrift.TType, size int) error
- func (m *MockThriftTTransport) WriteListEnd() error
- func (m *MockThriftTTransport) WriteMapBegin(keyType, valueType thrift.TType, size int) error
- func (m *MockThriftTTransport) WriteMapEnd() error
- func (m *MockThriftTTransport) WriteMessageBegin(name string, typeID thrift.TMessageType, seqID int32) error
- func (m *MockThriftTTransport) WriteMessageEnd() error
- func (m *MockThriftTTransport) WriteSetBegin(elemType thrift.TType, size int) error
- func (m *MockThriftTTransport) WriteSetEnd() error
- func (m *MockThriftTTransport) WriteString(value string) error
- func (m *MockThriftTTransport) WriteStructBegin(name string) error
- func (m *MockThriftTTransport) WriteStructEnd() error
- type MockTransServer
- type MockTransServerFactory
- type MyException
- type MyRequest
- type MyResponse
- type MyService
Constants ¶
const ( MockServiceName = "MockService" MockMethod string = "mock" MockExceptionMethod string = "mockException" MockErrorMethod string = "mockError" MockOnewayMethod string = "mockOneway" )
method name of mock
Variables ¶
This section is empty.
Functions ¶
func MockFuncHandler ¶
func MockFuncHandler(mf func(ctx context.Context, req *MyRequest) (r *MyResponse, err error)) interface{}
MockFuncHandler .
func NewMockArgs ¶
func NewMockArgs() interface{}
func NewMockCliTransHandlerFactory ¶
func NewMockCliTransHandlerFactory(hdrl *MockCliTransHandler) remote.ClientTransHandlerFactory
NewMockCliTransHandlerFactory .
func NewMockResult ¶
func NewMockResult() interface{}
func NewMockSvrTransHandlerFactory ¶
func NewMockSvrTransHandlerFactory(hdrl *MockSvrTransHandler) remote.ServerTransHandlerFactory
NewMockSvrTransHandlerFactory .
func NewMockTransServerFactory ¶
func NewMockTransServerFactory(transSvr *MockTransServer) remote.TransServerFactory
NewMockTransServerFactory .
Types ¶
type Conn ¶
type Conn struct { ReadFunc func(b []byte) (n int, err error) WriteFunc func(b []byte) (n int, err error) CloseFunc func() (e error) LocalAddrFunc func() (r net.Addr) RemoteAddrFunc func() (r net.Addr) SetDeadlineFunc func(t time.Time) (e error) SetReadDeadlineFunc func(t time.Time) (e error) SetWriteDeadlineFunc func(t time.Time) (e error) }
Conn implements the net.Conn interface.
func (Conn) RemoteAddr ¶
RemoteAddr implements the net.Conn interface.
func (Conn) SetDeadline ¶
SetDeadline implements the net.Conn interface.
func (Conn) SetReadDeadline ¶
SetReadDeadline implements the net.Conn interface.
func (Conn) SetWriteDeadline ¶
SetWriteDeadline implements the net.Conn interface.
type MockCliTransHandler ¶
type MockCliTransHandler struct { WriteFunc func(ctx context.Context, conn net.Conn, send remote.Message) (nctx context.Context, err error) ReadFunc func(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error) OnMessageFunc func(ctx context.Context, args, result remote.Message) (context.Context, error) // contains filtered or unexported fields }
MockCliTransHandler .
func (*MockCliTransHandler) OnInactive ¶
func (t *MockCliTransHandler) OnInactive(ctx context.Context, conn net.Conn)
OnInactive implements the remote.TransHandler interface.
func (*MockCliTransHandler) OnMessage ¶
func (t *MockCliTransHandler) OnMessage(ctx context.Context, args, result remote.Message) (context.Context, error)
OnMessage implements the remote.TransHandler interface.
func (*MockCliTransHandler) Read ¶
func (t *MockCliTransHandler) Read(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error)
Read implements the remote.TransHandler interface.
func (*MockCliTransHandler) SetPipeline ¶
func (t *MockCliTransHandler) SetPipeline(p *remote.TransPipeline)
SetPipeline implements the remote.TransHandler interface.
type MockSvrTransHandler ¶
type MockSvrTransHandler struct { Opt *remote.ServerOption OnReadFunc func(ctx context.Context, conn net.Conn) error WriteFunc func(ctx context.Context, conn net.Conn, send remote.Message) (nctx context.Context, err error) ReadFunc func(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error) // contains filtered or unexported fields }
MockSvrTransHandler .
func (*MockSvrTransHandler) OnInactive ¶
func (t *MockSvrTransHandler) OnInactive(ctx context.Context, conn net.Conn)
OnInactive implements the remote.TransHandler interface.
func (*MockSvrTransHandler) OnMessage ¶
func (t *MockSvrTransHandler) OnMessage(ctx context.Context, args, result remote.Message) (context.Context, error)
OnMessage implements the remote.TransHandler interface.
func (*MockSvrTransHandler) Read ¶
func (t *MockSvrTransHandler) Read(ctx context.Context, conn net.Conn, msg remote.Message) (nctx context.Context, err error)
Read implements the remote.TransHandler interface.
func (*MockSvrTransHandler) SetPipeline ¶
func (t *MockSvrTransHandler) SetPipeline(p *remote.TransPipeline)
SetPipeline implements the remote.TransHandler interface.
type MockThriftTTransport ¶
type MockThriftTTransport struct { WriteMessageBeginFunc func(name string, typeID thrift.TMessageType, seqID int32) error WriteMessageEndFunc func() error WriteStructBeginFunc func(name string) error WriteStructEndFunc func() error WriteFieldBeginFunc func(name string, typeID thrift.TType, id int16) error WriteFieldEndFunc func() error WriteFieldStopFunc func() error WriteMapBeginFunc func(keyType, valueType thrift.TType, size int) error WriteMapEndFunc func() error WriteListBeginFunc func(elemType thrift.TType, size int) error WriteListEndFunc func() error WriteSetBeginFunc func(elemType thrift.TType, size int) error WriteSetEndFunc func() error WriteBoolFunc func(value bool) error WriteByteFunc func(value int8) error WriteI16Func func(value int16) error WriteI32Func func(value int32) error WriteI64Func func(value int64) error WriteDoubleFunc func(value float64) error WriteStringFunc func(value string) error WriteBinaryFunc func(value []byte) error ReadMessageBeginFunc func() (name string, typeID thrift.TMessageType, seqID int32, err error) ReadMessageEndFunc func() error ReadStructBeginFunc func() (name string, err error) ReadStructEndFunc func() error ReadFieldBeginFunc func() (name string, typeID thrift.TType, id int16, err error) ReadFieldEndFunc func() error ReadMapBeginFunc func() (keyType, valueType thrift.TType, size int, err error) ReadMapEndFunc func() error ReadListBeginFunc func() (elemType thrift.TType, size int, err error) ReadListEndFunc func() error ReadSetBeginFunc func() (elemType thrift.TType, size int, err error) ReadSetEndFunc func() error ReadBoolFunc func() (value bool, err error) ReadByteFunc func() (value int8, err error) ReadI16Func func() (value int16, err error) ReadI32Func func() (value int32, err error) ReadI64Func func() (value int64, err error) ReadDoubleFunc func() (value float64, err error) ReadStringFunc func() (value string, err error) ReadBinaryFunc func() (value []byte, err error) SkipFunc func(fieldType thrift.TType) (err error) FlushFunc func(ctx context.Context) (err error) TransportFunc func() thrift.TTransport }
func (*MockThriftTTransport) Flush ¶
func (m *MockThriftTTransport) Flush(ctx context.Context) (err error)
func (*MockThriftTTransport) ReadBinary ¶
func (m *MockThriftTTransport) ReadBinary() (value []byte, err error)
func (*MockThriftTTransport) ReadBool ¶
func (m *MockThriftTTransport) ReadBool() (value bool, err error)
func (*MockThriftTTransport) ReadByte ¶
func (m *MockThriftTTransport) ReadByte() (value int8, err error)
func (*MockThriftTTransport) ReadDouble ¶
func (m *MockThriftTTransport) ReadDouble() (value float64, err error)
func (*MockThriftTTransport) ReadFieldBegin ¶
func (*MockThriftTTransport) ReadFieldEnd ¶
func (m *MockThriftTTransport) ReadFieldEnd() error
func (*MockThriftTTransport) ReadI16 ¶
func (m *MockThriftTTransport) ReadI16() (value int16, err error)
func (*MockThriftTTransport) ReadI32 ¶
func (m *MockThriftTTransport) ReadI32() (value int32, err error)
func (*MockThriftTTransport) ReadI64 ¶
func (m *MockThriftTTransport) ReadI64() (value int64, err error)
func (*MockThriftTTransport) ReadListBegin ¶
func (m *MockThriftTTransport) ReadListBegin() (elemType thrift.TType, size int, err error)
func (*MockThriftTTransport) ReadListEnd ¶
func (m *MockThriftTTransport) ReadListEnd() error
func (*MockThriftTTransport) ReadMapBegin ¶
func (m *MockThriftTTransport) ReadMapBegin() (keyType, valueType thrift.TType, size int, err error)
func (*MockThriftTTransport) ReadMapEnd ¶
func (m *MockThriftTTransport) ReadMapEnd() error
func (*MockThriftTTransport) ReadMessageBegin ¶
func (m *MockThriftTTransport) ReadMessageBegin() (name string, typeID thrift.TMessageType, seqID int32, err error)
func (*MockThriftTTransport) ReadMessageEnd ¶
func (m *MockThriftTTransport) ReadMessageEnd() error
func (*MockThriftTTransport) ReadSetBegin ¶
func (m *MockThriftTTransport) ReadSetBegin() (elemType thrift.TType, size int, err error)
func (*MockThriftTTransport) ReadSetEnd ¶
func (m *MockThriftTTransport) ReadSetEnd() error
func (*MockThriftTTransport) ReadString ¶
func (m *MockThriftTTransport) ReadString() (value string, err error)
func (*MockThriftTTransport) ReadStructBegin ¶
func (m *MockThriftTTransport) ReadStructBegin() (name string, err error)
func (*MockThriftTTransport) ReadStructEnd ¶
func (m *MockThriftTTransport) ReadStructEnd() error
func (*MockThriftTTransport) Skip ¶
func (m *MockThriftTTransport) Skip(fieldType thrift.TType) (err error)
func (*MockThriftTTransport) Transport ¶
func (m *MockThriftTTransport) Transport() thrift.TTransport
func (*MockThriftTTransport) WriteBinary ¶
func (m *MockThriftTTransport) WriteBinary(value []byte) error
func (*MockThriftTTransport) WriteBool ¶
func (m *MockThriftTTransport) WriteBool(value bool) error
func (*MockThriftTTransport) WriteByte ¶
func (m *MockThriftTTransport) WriteByte(value int8) error
func (*MockThriftTTransport) WriteDouble ¶
func (m *MockThriftTTransport) WriteDouble(value float64) error
func (*MockThriftTTransport) WriteFieldBegin ¶
func (*MockThriftTTransport) WriteFieldEnd ¶
func (m *MockThriftTTransport) WriteFieldEnd() error
func (*MockThriftTTransport) WriteFieldStop ¶
func (m *MockThriftTTransport) WriteFieldStop() error
func (*MockThriftTTransport) WriteI16 ¶
func (m *MockThriftTTransport) WriteI16(value int16) error
func (*MockThriftTTransport) WriteI32 ¶
func (m *MockThriftTTransport) WriteI32(value int32) error
func (*MockThriftTTransport) WriteI64 ¶
func (m *MockThriftTTransport) WriteI64(value int64) error
func (*MockThriftTTransport) WriteListBegin ¶
func (m *MockThriftTTransport) WriteListBegin(elemType thrift.TType, size int) error
func (*MockThriftTTransport) WriteListEnd ¶
func (m *MockThriftTTransport) WriteListEnd() error
func (*MockThriftTTransport) WriteMapBegin ¶
func (m *MockThriftTTransport) WriteMapBegin(keyType, valueType thrift.TType, size int) error
func (*MockThriftTTransport) WriteMapEnd ¶
func (m *MockThriftTTransport) WriteMapEnd() error
func (*MockThriftTTransport) WriteMessageBegin ¶
func (m *MockThriftTTransport) WriteMessageBegin(name string, typeID thrift.TMessageType, seqID int32) error
func (*MockThriftTTransport) WriteMessageEnd ¶
func (m *MockThriftTTransport) WriteMessageEnd() error
func (*MockThriftTTransport) WriteSetBegin ¶
func (m *MockThriftTTransport) WriteSetBegin(elemType thrift.TType, size int) error
func (*MockThriftTTransport) WriteSetEnd ¶
func (m *MockThriftTTransport) WriteSetEnd() error
func (*MockThriftTTransport) WriteString ¶
func (m *MockThriftTTransport) WriteString(value string) error
func (*MockThriftTTransport) WriteStructBegin ¶
func (m *MockThriftTTransport) WriteStructBegin(name string) error
func (*MockThriftTTransport) WriteStructEnd ¶
func (m *MockThriftTTransport) WriteStructEnd() error
type MockTransServer ¶
type MockTransServer struct { CreateListenerFunc func(net.Addr) (net.Listener, error) BootstrapServerFunc func(net.Listener) (err error) ShutdownFunc func() (err error) ConnCountFunc func() utils.AtomicInt // contains filtered or unexported fields }
MockTransServer .
func (*MockTransServer) BootstrapServer ¶
func (t *MockTransServer) BootstrapServer(ln net.Listener) (err error)
BootstrapServer .
func (*MockTransServer) ConnCount ¶
func (t *MockTransServer) ConnCount() (r utils.AtomicInt)
ConnCount .
func (*MockTransServer) CreateListener ¶
CreateListener .
type MockTransServerFactory ¶
type MockTransServerFactory struct {
// contains filtered or unexported fields
}
MockTransServerFactory .
func (*MockTransServerFactory) NewTransServer ¶
func (t *MockTransServerFactory) NewTransServer(opt *remote.ServerOption, transHdlr remote.ServerTransHandler) remote.TransServer
NewTransServer .
type MyException ¶
type MyException struct {
Message string `thrift:"message,1" json:"message"`
}
MyException .
func (*MyException) Error ¶
func (p *MyException) Error() string
type MyService ¶
type MyService interface { Mock(ctx context.Context, req *MyRequest) (r *MyResponse, err error) MockException(ctx context.Context, req *MyRequest) (r *MyResponse, err error) MockError(ctx context.Context, req *MyRequest) (r *MyResponse, err error) MockOneway(ctx context.Context, req *MyRequest) (err error) }
MyService .
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package remote is a generated GoMock package.
|
Package remote is a generated GoMock package. |
Package discovery is a generated GoMock package.
|
Package discovery is a generated GoMock package. |
Package generic is a generated GoMock package.
|
Package generic is a generated GoMock package. |
Package klog is a generated GoMock package.
|
Package klog is a generated GoMock package. |
Package limiter is a generated GoMock package.
|
Package limiter is a generated GoMock package. |
Package loadbalance is a generated GoMock package.
|
Package loadbalance is a generated GoMock package. |
Package net is a generated GoMock package.
|
Package net is a generated GoMock package. |
Package netpoll is a generated GoMock package.
|
Package netpoll is a generated GoMock package. |
Package proxy is a generated GoMock package.
|
Package proxy is a generated GoMock package. |
Package remote is a generated GoMock package.
|
Package remote is a generated GoMock package. |
Package rpc_info is a generated GoMock package.
|
Package rpc_info is a generated GoMock package. |
Package tracer is a generated GoMock package.
|
Package tracer is a generated GoMock package. |
Package utils is a generated GoMock package.
|
Package utils is a generated GoMock package. |