router

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DerivAPI

type DerivAPI interface {
	Handle(*core.Conn, *request.Request) error
}

type HTTPAPI

type HTTPAPI interface {
	Handle(*core.Conn, *request.HTTPReq) error
}

type MockDerivAPI

type MockDerivAPI struct {
	mock.Mock
}

MockDerivAPI is an autogenerated mock type for the DerivAPI type

func NewMockDerivAPI

func NewMockDerivAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDerivAPI

NewMockDerivAPI creates a new instance of MockDerivAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockDerivAPI) EXPECT

func (_m *MockDerivAPI) EXPECT() *MockDerivAPI_Expecter

func (*MockDerivAPI) Handle

func (_m *MockDerivAPI) Handle(_a0 *core.Conn, _a1 *request.Request) error

Handle provides a mock function with given fields: _a0, _a1

type MockDerivAPI_Expecter

type MockDerivAPI_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockDerivAPI_Expecter) Handle

func (_e *MockDerivAPI_Expecter) Handle(_a0 interface{}, _a1 interface{}) *MockDerivAPI_Handle_Call

Handle is a helper method to define mock.On call

  • _a0 *core.Conn
  • _a1 *request.Request

type MockDerivAPI_Handle_Call

type MockDerivAPI_Handle_Call struct {
	*mock.Call
}

MockDerivAPI_Handle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handle'

func (*MockDerivAPI_Handle_Call) Return

func (*MockDerivAPI_Handle_Call) Run

func (*MockDerivAPI_Handle_Call) RunAndReturn

type MockHTTPAPI

type MockHTTPAPI struct {
	mock.Mock
}

MockHTTPAPI is an autogenerated mock type for the HTTPAPI type

func NewMockHTTPAPI

func NewMockHTTPAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockHTTPAPI

NewMockHTTPAPI creates a new instance of MockHTTPAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockHTTPAPI) EXPECT

func (_m *MockHTTPAPI) EXPECT() *MockHTTPAPI_Expecter

func (*MockHTTPAPI) Handle

func (_m *MockHTTPAPI) Handle(_a0 *core.Conn, _a1 *request.HTTPReq) error

Handle provides a mock function with given fields: _a0, _a1

type MockHTTPAPI_Expecter

type MockHTTPAPI_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockHTTPAPI_Expecter) Handle

func (_e *MockHTTPAPI_Expecter) Handle(_a0 interface{}, _a1 interface{}) *MockHTTPAPI_Handle_Call

Handle is a helper method to define mock.On call

  • _a0 *core.Conn
  • _a1 *request.HTTPReq

type MockHTTPAPI_Handle_Call

type MockHTTPAPI_Handle_Call struct {
	*mock.Call
}

MockHTTPAPI_Handle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handle'

func (*MockHTTPAPI_Handle_Call) Return

func (*MockHTTPAPI_Handle_Call) Run

func (*MockHTTPAPI_Handle_Call) RunAndReturn

type Router

type Router struct {
	// contains filtered or unexported fields
}

func New

func New(derivProv DerivAPI, httpProv HTTPAPI) *Router

New creates a new instance of Router with the provided DerivAPI service. It takes derivProv of type DerivAPI. It returns a pointer to a Router instance.

func (*Router) Handle

func (r *Router) Handle(conn *core.Conn, req core.Request) error

Handle processes a request and delegates it to the appropriate provider based on the request type. It takes conn of type *core.Conn and req of type core.Request. It returns an error if the request type is unsupported or if the underlying provider's Handle method returns an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL