Documentation ¶
Overview ¶
Package codes defines the canonical error codes used by gRPC. It is consistent across various languages.
Package ripo is a generated GoMock package.
Index ¶
- Variables
- func AssertError(t SmallT, err error, code Code, msg string) bool
- func HTTPStatusFromCode(code Code) int
- func SetDefaultParamSources(sources ...FromX)
- func SetErrorDispatcher(dispatcher func(request ExtendedRequest, rpcErr RPCError))
- func TranslateHandler(handler Handler) http.HandlerFunc
- type Code
- type ExtendedRequest
- type FromX
- type Handler
- type MockExtendedRequest
- func (m *MockExtendedRequest) Body() ([]byte, error)
- func (m *MockExtendedRequest) BodyMap() (map[string]any, error)
- func (m *MockExtendedRequest) BodyTo(arg0 any) error
- func (m *MockExtendedRequest) Context() context.Context
- func (m *MockExtendedRequest) Cookie(arg0 string) (*http.Cookie, error)
- func (m *MockExtendedRequest) CookieNames() []string
- func (m *MockExtendedRequest) EXPECT() *MockExtendedRequestMockRecorder
- func (m *MockExtendedRequest) FullMap() map[string]any
- func (m *MockExtendedRequest) GetBool(arg0 string, arg1 ...FromX) (*bool, error)
- func (m *MockExtendedRequest) GetFloat(arg0 string, arg1 ...FromX) (*float64, error)
- func (m *MockExtendedRequest) GetFloatDefault(arg0 string, arg1 float64, arg2 ...FromX) (float64, error)
- func (m *MockExtendedRequest) GetFormValue(arg0 string) string
- func (m *MockExtendedRequest) GetInt(arg0 string, arg1 ...FromX) (*int, error)
- func (m *MockExtendedRequest) GetIntDefault(arg0 string, arg1 int, arg2 ...FromX) (int, error)
- func (m *MockExtendedRequest) GetObject(arg0 string, arg1 reflect.Type, arg2 ...FromX) (any, error)
- func (m *MockExtendedRequest) GetString(arg0 string, arg1 ...FromX) (*string, error)
- func (m *MockExtendedRequest) GetStringDefault(arg0, arg1 string, arg2 ...FromX) (string, error)
- func (m *MockExtendedRequest) GetStringList(arg0 string, arg1 ...FromX) ([]string, error)
- func (m *MockExtendedRequest) GetTime(arg0 string, arg1 ...FromX) (*time.Time, error)
- func (m *MockExtendedRequest) HandlerName() string
- func (m *MockExtendedRequest) Header(arg0 string) string
- func (m *MockExtendedRequest) HeaderKeys() []string
- func (m *MockExtendedRequest) Host() string
- func (m *MockExtendedRequest) RemoteIP() (string, error)
- func (m *MockExtendedRequest) URL() *url.URL
- type MockExtendedRequestMockRecorder
- func (mr *MockExtendedRequestMockRecorder) Body() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) BodyMap() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) BodyTo(arg0 any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) Context() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) Cookie(arg0 any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) CookieNames() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) FullMap() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetBool(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetFloat(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetFloatDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetFormValue(arg0 any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetInt(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetIntDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetObject(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetString(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetStringDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetStringList(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) GetTime(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) HandlerName() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) Header(arg0 any) *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) HeaderKeys() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) Host() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) RemoteIP() *gomock.Call
- func (mr *MockExtendedRequestMockRecorder) URL() *gomock.Call
- type MockReadCloser
- type MockReadCloserMockRecorder
- type MockRequest
- func (m *MockRequest) Body() ([]byte, error)
- func (m *MockRequest) BodyTo(arg0 any) error
- func (m *MockRequest) Context() context.Context
- func (m *MockRequest) Cookie(arg0 string) (*http.Cookie, error)
- func (m *MockRequest) CookieNames() []string
- func (m *MockRequest) EXPECT() *MockRequestMockRecorder
- func (m *MockRequest) FullMap() map[string]any
- func (m *MockRequest) GetBool(arg0 string, arg1 ...FromX) (*bool, error)
- func (m *MockRequest) GetFloat(arg0 string, arg1 ...FromX) (*float64, error)
- func (m *MockRequest) GetFloatDefault(arg0 string, arg1 float64, arg2 ...FromX) (float64, error)
- func (m *MockRequest) GetInt(arg0 string, arg1 ...FromX) (*int, error)
- func (m *MockRequest) GetIntDefault(arg0 string, arg1 int, arg2 ...FromX) (int, error)
- func (m *MockRequest) GetObject(arg0 string, arg1 reflect.Type, arg2 ...FromX) (any, error)
- func (m *MockRequest) GetString(arg0 string, arg1 ...FromX) (*string, error)
- func (m *MockRequest) GetStringDefault(arg0, arg1 string, arg2 ...FromX) (string, error)
- func (m *MockRequest) GetStringList(arg0 string, arg1 ...FromX) ([]string, error)
- func (m *MockRequest) GetTime(arg0 string, arg1 ...FromX) (*time.Time, error)
- func (m *MockRequest) HandlerName() string
- func (m *MockRequest) Header(arg0 string) string
- func (m *MockRequest) HeaderKeys() []string
- func (m *MockRequest) Host() string
- func (m *MockRequest) RemoteIP() (string, error)
- func (m *MockRequest) URL() *url.URL
- type MockRequestMockRecorder
- func (mr *MockRequestMockRecorder) Body() *gomock.Call
- func (mr *MockRequestMockRecorder) BodyTo(arg0 any) *gomock.Call
- func (mr *MockRequestMockRecorder) Context() *gomock.Call
- func (mr *MockRequestMockRecorder) Cookie(arg0 any) *gomock.Call
- func (mr *MockRequestMockRecorder) CookieNames() *gomock.Call
- func (mr *MockRequestMockRecorder) FullMap() *gomock.Call
- func (mr *MockRequestMockRecorder) GetBool(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetFloat(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetFloatDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetInt(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetIntDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetObject(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetString(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetStringDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetStringList(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) GetTime(arg0 any, arg1 ...any) *gomock.Call
- func (mr *MockRequestMockRecorder) HandlerName() *gomock.Call
- func (mr *MockRequestMockRecorder) Header(arg0 any) *gomock.Call
- func (mr *MockRequestMockRecorder) HeaderKeys() *gomock.Call
- func (mr *MockRequestMockRecorder) Host() *gomock.Call
- func (mr *MockRequestMockRecorder) RemoteIP() *gomock.Call
- func (mr *MockRequestMockRecorder) URL() *gomock.Call
- type MockSmallT
- type MockSmallTMockRecorder
- type RPCError
- type Request
- type Response
- type SmallT
- type Traceback
- type TracebackRecord
Constants ¶
This section is empty.
Variables ¶
var ErrorCodeByName = map[string]Code{ "Canceled": Canceled, "Unknown": Unknown, "InvalidArgument": InvalidArgument, "DeadlineExceeded": DeadlineExceeded, "NotFound": NotFound, "AlreadyExists": AlreadyExists, "PermissionDenied": PermissionDenied, "Unauthenticated": Unauthenticated, "ResourceExhausted": ResourceExhausted, "FailedPrecondition": FailedPrecondition, "Aborted": Aborted, "OutOfRange": OutOfRange, "Unimplemented": Unimplemented, "Internal": Internal, "Unavailable": Unavailable, "DataLoss": DataLoss, "MissingArgument": MissingArgument, "ResourceLocked": ResourceLocked, }
Functions ¶
func AssertError ¶
for non-rpc errors, pass code=Unknown
func HTTPStatusFromCode ¶
HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go
func SetDefaultParamSources ¶
func SetDefaultParamSources(sources ...FromX)
SetDefaultParamSources: set default parameter sources for req.Get* methods Typical arguments (that are implemented by the library): FromBody, FromForm, FromContext, FromEmpty Adding `FromEmpty` at the end, makes the parameter optional, meaning Get* methods return empty value with no error if the parameter is missing (or empty) in all these parameter sources You can also write your own implementation of `FromX` interface, and pass it here
func SetErrorDispatcher ¶
func SetErrorDispatcher(dispatcher func(request ExtendedRequest, rpcErr RPCError))
func TranslateHandler ¶
func TranslateHandler(handler Handler) http.HandlerFunc
Types ¶
type Code ¶
type Code uint32
A Code is an unsigned 32-bit error code as defined in the gRPC spec.
const ( // OK is returned on success. OK Code = 0 // Canceled indicates the operation was canceled (typically by the caller). Canceled Code = 1 // Unknown error. An example of where this error may be returned is // if a Status value received from another address space belongs to // an error-space that is not known in this address space. Also // errors raised by APIs that do not return enough error information // may be converted to this error. Unknown Code = 2 // InvalidArgument indicates client specified an invalid argument. // Note that this differs from FailedPrecondition. It indicates arguments // that are problematic regardless of the state of the system // (e.g., a malformed file name). InvalidArgument Code = 3 // DeadlineExceeded means operation expired before completion. // For operations that change the state of the system, this error may be // returned even if the operation has completed successfully. For // example, a successful response from a server could have been delayed // long enough for the deadline to expire. DeadlineExceeded Code = 4 // NotFound means some requested entity (e.g., file or directory) was // not found. NotFound Code = 5 // AlreadyExists means an attempt to create an entity failed because one // already exists. AlreadyExists Code = 6 // PermissionDenied indicates the caller does not have permission to // execute the specified operation. It must not be used for rejections // caused by exhausting some resource (use ResourceExhausted // instead for those errors). It must not be // used if the caller cannot be identified (use Unauthenticated // instead for those errors). PermissionDenied Code = 7 // Unauthenticated indicates the request does not have valid // authentication credentials for the operation. Unauthenticated Code = 16 // ResourceExhausted indicates some resource has been exhausted, perhaps // a per-user quota, or perhaps the entire file system is out of space. ResourceExhausted Code = 8 // FailedPrecondition indicates operation was rejected because the // system is not in a state required for the operation's execution. // For example, directory to be deleted may be non-empty, an rmdir // operation is applied to a non-directory, etc. // // A litmus test that may help a service implementor in deciding // between FailedPrecondition, Aborted, and Unavailable: // (a) Use Unavailable if the client can retry just the failing call. // (b) Use Aborted if the client should retry at a higher-level // (e.g., restarting a read-modify-write sequence). // (c) Use FailedPrecondition if the client should not retry until // the system state has been explicitly fixed. E.g., if an "rmdir" // fails because the directory is non-empty, FailedPrecondition // should be returned since the client should not retry unless // they have first fixed up the directory by deleting files from it. // (d) Use FailedPrecondition if the client performs conditional // REST Get/Update/Delete on a resource and the resource on the // server does not match the condition. E.g., conflicting // read-modify-write on the same resource. FailedPrecondition Code = 9 // Aborted indicates the operation was aborted, typically due to a // concurrency issue like sequencer check failures, transaction aborts, // etc. // // See litmus test above for deciding between FailedPrecondition, // Aborted, and Unavailable. Aborted Code = 10 // OutOfRange means operation was attempted past the valid range. // E.g., seeking or reading past end of file. // // Unlike InvalidArgument, this error indicates a problem that may // be fixed if the system state changes. For example, a 32-bit file // system will generate InvalidArgument if asked to read at an // offset that is not in the range [0,2^32-1], but it will generate // OutOfRange if asked to read from an offset past the current // file size. // // There is a fair bit of overlap between FailedPrecondition and // OutOfRange. We recommend using OutOfRange (the more specific // error) when it applies so that callers who are iterating through // a space can easily look for an OutOfRange error to detect when // they are done. OutOfRange Code = 11 // Unimplemented indicates operation is not implemented or not // supported/enabled in this service. Unimplemented Code = 12 // Internal errors. Means some invariants expected by underlying // system has been broken. If you see one of these errors, // something is very broken. Internal Code = 13 // This is a most likely a transient condition and may be corrected // by retrying with a backoff. // // See litmus test above for deciding between FailedPrecondition, // Aborted, and Unavailable. Unavailable Code = 14 // DataLoss indicates unrecoverable data loss or corruption. DataLoss Code = 15 )
const ( // MissingArgument: added by Saeed Rasooli // MissingArgument means that an input parameter is required but not given // either missing in the input/request, or has empty value MissingArgument Code = 17 // ResourceLocked: added by Saeed Rasooli // ResourceLocked means that the give resource is currently busy or temporarily locked // by abother request (either by the same user or another user) ResourceLocked Code = 18 )
type ExtendedRequest ¶
type FromX ¶
type FromX interface { GetString(req ExtendedRequest, key string) (*string, error) GetStringList(req ExtendedRequest, key string) ([]string, error) GetInt(req ExtendedRequest, key string) (*int, error) GetFloat(req ExtendedRequest, key string) (*float64, error) GetBool(req ExtendedRequest, key string) (*bool, error) GetTime(req ExtendedRequest, key string) (*time.Time, error) GetObject(req ExtendedRequest, key string, _type reflect.Type) (any, error) }
var FromBody FromX = &fromBody{}
var FromContext FromX = &fromContext{}
var FromEmpty FromX = &fromEmpty{}
var FromForm FromX = &fromForm{}
type MockExtendedRequest ¶
type MockExtendedRequest struct {
// contains filtered or unexported fields
}
MockExtendedRequest is a mock of ExtendedRequest interface
func NewMockExtendedRequest ¶
func NewMockExtendedRequest(ctrl *gomock.Controller) *MockExtendedRequest
NewMockExtendedRequest creates a new mock instance
func (*MockExtendedRequest) Body ¶
func (m *MockExtendedRequest) Body() ([]byte, error)
Body mocks base method
func (*MockExtendedRequest) BodyMap ¶
func (m *MockExtendedRequest) BodyMap() (map[string]any, error)
BodyMap mocks base method
func (*MockExtendedRequest) BodyTo ¶
func (m *MockExtendedRequest) BodyTo(arg0 any) error
BodyTo mocks base method
func (*MockExtendedRequest) Context ¶
func (m *MockExtendedRequest) Context() context.Context
Context mocks base method
func (*MockExtendedRequest) Cookie ¶
func (m *MockExtendedRequest) Cookie(arg0 string) (*http.Cookie, error)
Cookie mocks base method
func (*MockExtendedRequest) CookieNames ¶
func (m *MockExtendedRequest) CookieNames() []string
CookieNames mocks base method
func (*MockExtendedRequest) EXPECT ¶
func (m *MockExtendedRequest) EXPECT() *MockExtendedRequestMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockExtendedRequest) FullMap ¶
func (m *MockExtendedRequest) FullMap() map[string]any
FullMap mocks base method
func (*MockExtendedRequest) GetBool ¶
func (m *MockExtendedRequest) GetBool(arg0 string, arg1 ...FromX) (*bool, error)
GetBool mocks base method
func (*MockExtendedRequest) GetFloat ¶
func (m *MockExtendedRequest) GetFloat(arg0 string, arg1 ...FromX) (*float64, error)
GetFloat mocks base method
func (*MockExtendedRequest) GetFloatDefault ¶
func (m *MockExtendedRequest) GetFloatDefault(arg0 string, arg1 float64, arg2 ...FromX) (float64, error)
GetFloatDefault mocks base method
func (*MockExtendedRequest) GetFormValue ¶
func (m *MockExtendedRequest) GetFormValue(arg0 string) string
GetFormValue mocks base method
func (*MockExtendedRequest) GetInt ¶
func (m *MockExtendedRequest) GetInt(arg0 string, arg1 ...FromX) (*int, error)
GetInt mocks base method
func (*MockExtendedRequest) GetIntDefault ¶
GetIntDefault mocks base method
func (*MockExtendedRequest) GetString ¶
func (m *MockExtendedRequest) GetString(arg0 string, arg1 ...FromX) (*string, error)
GetString mocks base method
func (*MockExtendedRequest) GetStringDefault ¶
func (m *MockExtendedRequest) GetStringDefault(arg0, arg1 string, arg2 ...FromX) (string, error)
GetStringDefault mocks base method
func (*MockExtendedRequest) GetStringList ¶
func (m *MockExtendedRequest) GetStringList(arg0 string, arg1 ...FromX) ([]string, error)
GetStringList mocks base method
func (*MockExtendedRequest) HandlerName ¶
func (m *MockExtendedRequest) HandlerName() string
HandlerName mocks base method
func (*MockExtendedRequest) Header ¶
func (m *MockExtendedRequest) Header(arg0 string) string
Header mocks base method
func (*MockExtendedRequest) HeaderKeys ¶
func (m *MockExtendedRequest) HeaderKeys() []string
HeaderKeys mocks base method
func (*MockExtendedRequest) Host ¶
func (m *MockExtendedRequest) Host() string
Host mocks base method
func (*MockExtendedRequest) RemoteIP ¶
func (m *MockExtendedRequest) RemoteIP() (string, error)
RemoteIP mocks base method
func (*MockExtendedRequest) URL ¶
func (m *MockExtendedRequest) URL() *url.URL
URL mocks base method
type MockExtendedRequestMockRecorder ¶
type MockExtendedRequestMockRecorder struct {
// contains filtered or unexported fields
}
MockExtendedRequestMockRecorder is the mock recorder for MockExtendedRequest
func (*MockExtendedRequestMockRecorder) Body ¶
func (mr *MockExtendedRequestMockRecorder) Body() *gomock.Call
Body indicates an expected call of Body
func (*MockExtendedRequestMockRecorder) BodyMap ¶
func (mr *MockExtendedRequestMockRecorder) BodyMap() *gomock.Call
BodyMap indicates an expected call of BodyMap
func (*MockExtendedRequestMockRecorder) BodyTo ¶
func (mr *MockExtendedRequestMockRecorder) BodyTo(arg0 any) *gomock.Call
BodyTo indicates an expected call of BodyTo
func (*MockExtendedRequestMockRecorder) Context ¶
func (mr *MockExtendedRequestMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context
func (*MockExtendedRequestMockRecorder) Cookie ¶
func (mr *MockExtendedRequestMockRecorder) Cookie(arg0 any) *gomock.Call
Cookie indicates an expected call of Cookie
func (*MockExtendedRequestMockRecorder) CookieNames ¶
func (mr *MockExtendedRequestMockRecorder) CookieNames() *gomock.Call
CookieNames indicates an expected call of CookieNames
func (*MockExtendedRequestMockRecorder) FullMap ¶
func (mr *MockExtendedRequestMockRecorder) FullMap() *gomock.Call
FullMap indicates an expected call of FullMap
func (*MockExtendedRequestMockRecorder) GetBool ¶
func (mr *MockExtendedRequestMockRecorder) GetBool(arg0 any, arg1 ...any) *gomock.Call
GetBool indicates an expected call of GetBool
func (*MockExtendedRequestMockRecorder) GetFloat ¶
func (mr *MockExtendedRequestMockRecorder) GetFloat(arg0 any, arg1 ...any) *gomock.Call
GetFloat indicates an expected call of GetFloat
func (*MockExtendedRequestMockRecorder) GetFloatDefault ¶
func (mr *MockExtendedRequestMockRecorder) GetFloatDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetFloatDefault indicates an expected call of GetFloatDefault
func (*MockExtendedRequestMockRecorder) GetFormValue ¶
func (mr *MockExtendedRequestMockRecorder) GetFormValue(arg0 any) *gomock.Call
GetFormValue indicates an expected call of GetFormValue
func (*MockExtendedRequestMockRecorder) GetInt ¶
func (mr *MockExtendedRequestMockRecorder) GetInt(arg0 any, arg1 ...any) *gomock.Call
GetInt indicates an expected call of GetInt
func (*MockExtendedRequestMockRecorder) GetIntDefault ¶
func (mr *MockExtendedRequestMockRecorder) GetIntDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetIntDefault indicates an expected call of GetIntDefault
func (*MockExtendedRequestMockRecorder) GetObject ¶
func (mr *MockExtendedRequestMockRecorder) GetObject(arg0, arg1 any, arg2 ...any) *gomock.Call
GetObject indicates an expected call of GetObject
func (*MockExtendedRequestMockRecorder) GetString ¶
func (mr *MockExtendedRequestMockRecorder) GetString(arg0 any, arg1 ...any) *gomock.Call
GetString indicates an expected call of GetString
func (*MockExtendedRequestMockRecorder) GetStringDefault ¶
func (mr *MockExtendedRequestMockRecorder) GetStringDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetStringDefault indicates an expected call of GetStringDefault
func (*MockExtendedRequestMockRecorder) GetStringList ¶
func (mr *MockExtendedRequestMockRecorder) GetStringList(arg0 any, arg1 ...any) *gomock.Call
GetStringList indicates an expected call of GetStringList
func (*MockExtendedRequestMockRecorder) GetTime ¶
func (mr *MockExtendedRequestMockRecorder) GetTime(arg0 any, arg1 ...any) *gomock.Call
GetTime indicates an expected call of GetTime
func (*MockExtendedRequestMockRecorder) HandlerName ¶
func (mr *MockExtendedRequestMockRecorder) HandlerName() *gomock.Call
HandlerName indicates an expected call of HandlerName
func (*MockExtendedRequestMockRecorder) Header ¶
func (mr *MockExtendedRequestMockRecorder) Header(arg0 any) *gomock.Call
Header indicates an expected call of Header
func (*MockExtendedRequestMockRecorder) HeaderKeys ¶
func (mr *MockExtendedRequestMockRecorder) HeaderKeys() *gomock.Call
HeaderKeys indicates an expected call of HeaderKeys
func (*MockExtendedRequestMockRecorder) Host ¶
func (mr *MockExtendedRequestMockRecorder) Host() *gomock.Call
Host indicates an expected call of Host
func (*MockExtendedRequestMockRecorder) RemoteIP ¶
func (mr *MockExtendedRequestMockRecorder) RemoteIP() *gomock.Call
RemoteIP indicates an expected call of RemoteIP
func (*MockExtendedRequestMockRecorder) URL ¶
func (mr *MockExtendedRequestMockRecorder) URL() *gomock.Call
URL indicates an expected call of URL
type MockReadCloser ¶
type MockReadCloser struct {
// contains filtered or unexported fields
}
MockReadCloser is a mock of ReadCloser interface
func NewMockReadCloser ¶
func NewMockReadCloser(ctrl *gomock.Controller) *MockReadCloser
NewMockReadCloser creates a new mock instance
func (*MockReadCloser) EXPECT ¶
func (m *MockReadCloser) EXPECT() *MockReadCloserMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockReadCloserMockRecorder ¶
type MockReadCloserMockRecorder struct {
// contains filtered or unexported fields
}
MockReadCloserMockRecorder is the mock recorder for MockReadCloser
func (*MockReadCloserMockRecorder) Close ¶
func (mr *MockReadCloserMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
type MockRequest ¶
type MockRequest struct {
// contains filtered or unexported fields
}
MockRequest is a mock of Request interface
func NewMockRequest ¶
func NewMockRequest(ctrl *gomock.Controller) *MockRequest
NewMockRequest creates a new mock instance
func (*MockRequest) Context ¶
func (m *MockRequest) Context() context.Context
Context mocks base method
func (*MockRequest) Cookie ¶
func (m *MockRequest) Cookie(arg0 string) (*http.Cookie, error)
Cookie mocks base method
func (*MockRequest) CookieNames ¶
func (m *MockRequest) CookieNames() []string
CookieNames mocks base method
func (*MockRequest) EXPECT ¶
func (m *MockRequest) EXPECT() *MockRequestMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockRequest) FullMap ¶
func (m *MockRequest) FullMap() map[string]any
FullMap mocks base method
func (*MockRequest) GetBool ¶
func (m *MockRequest) GetBool(arg0 string, arg1 ...FromX) (*bool, error)
GetBool mocks base method
func (*MockRequest) GetFloat ¶
func (m *MockRequest) GetFloat(arg0 string, arg1 ...FromX) (*float64, error)
GetFloat mocks base method
func (*MockRequest) GetFloatDefault ¶
GetFloatDefault mocks base method
func (*MockRequest) GetInt ¶
func (m *MockRequest) GetInt(arg0 string, arg1 ...FromX) (*int, error)
GetInt mocks base method
func (*MockRequest) GetIntDefault ¶
GetIntDefault mocks base method
func (*MockRequest) GetString ¶
func (m *MockRequest) GetString(arg0 string, arg1 ...FromX) (*string, error)
GetString mocks base method
func (*MockRequest) GetStringDefault ¶
func (m *MockRequest) GetStringDefault(arg0, arg1 string, arg2 ...FromX) (string, error)
GetStringDefault mocks base method
func (*MockRequest) GetStringList ¶
func (m *MockRequest) GetStringList(arg0 string, arg1 ...FromX) ([]string, error)
GetStringList mocks base method
func (*MockRequest) HandlerName ¶
func (m *MockRequest) HandlerName() string
HandlerName mocks base method
func (*MockRequest) Header ¶
func (m *MockRequest) Header(arg0 string) string
Header mocks base method
func (*MockRequest) HeaderKeys ¶
func (m *MockRequest) HeaderKeys() []string
HeaderKeys mocks base method
func (*MockRequest) RemoteIP ¶
func (m *MockRequest) RemoteIP() (string, error)
RemoteIP mocks base method
type MockRequestMockRecorder ¶
type MockRequestMockRecorder struct {
// contains filtered or unexported fields
}
MockRequestMockRecorder is the mock recorder for MockRequest
func (*MockRequestMockRecorder) Body ¶
func (mr *MockRequestMockRecorder) Body() *gomock.Call
Body indicates an expected call of Body
func (*MockRequestMockRecorder) BodyTo ¶
func (mr *MockRequestMockRecorder) BodyTo(arg0 any) *gomock.Call
BodyTo indicates an expected call of BodyTo
func (*MockRequestMockRecorder) Context ¶
func (mr *MockRequestMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context
func (*MockRequestMockRecorder) Cookie ¶
func (mr *MockRequestMockRecorder) Cookie(arg0 any) *gomock.Call
Cookie indicates an expected call of Cookie
func (*MockRequestMockRecorder) CookieNames ¶
func (mr *MockRequestMockRecorder) CookieNames() *gomock.Call
CookieNames indicates an expected call of CookieNames
func (*MockRequestMockRecorder) FullMap ¶
func (mr *MockRequestMockRecorder) FullMap() *gomock.Call
FullMap indicates an expected call of FullMap
func (*MockRequestMockRecorder) GetBool ¶
func (mr *MockRequestMockRecorder) GetBool(arg0 any, arg1 ...any) *gomock.Call
GetBool indicates an expected call of GetBool
func (*MockRequestMockRecorder) GetFloat ¶
func (mr *MockRequestMockRecorder) GetFloat(arg0 any, arg1 ...any) *gomock.Call
GetFloat indicates an expected call of GetFloat
func (*MockRequestMockRecorder) GetFloatDefault ¶
func (mr *MockRequestMockRecorder) GetFloatDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetFloatDefault indicates an expected call of GetFloatDefault
func (*MockRequestMockRecorder) GetInt ¶
func (mr *MockRequestMockRecorder) GetInt(arg0 any, arg1 ...any) *gomock.Call
GetInt indicates an expected call of GetInt
func (*MockRequestMockRecorder) GetIntDefault ¶
func (mr *MockRequestMockRecorder) GetIntDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetIntDefault indicates an expected call of GetIntDefault
func (*MockRequestMockRecorder) GetObject ¶
func (mr *MockRequestMockRecorder) GetObject(arg0, arg1 any, arg2 ...any) *gomock.Call
GetObject indicates an expected call of GetObject
func (*MockRequestMockRecorder) GetString ¶
func (mr *MockRequestMockRecorder) GetString(arg0 any, arg1 ...any) *gomock.Call
GetString indicates an expected call of GetString
func (*MockRequestMockRecorder) GetStringDefault ¶
func (mr *MockRequestMockRecorder) GetStringDefault(arg0, arg1 any, arg2 ...any) *gomock.Call
GetStringDefault indicates an expected call of GetStringDefault
func (*MockRequestMockRecorder) GetStringList ¶
func (mr *MockRequestMockRecorder) GetStringList(arg0 any, arg1 ...any) *gomock.Call
GetStringList indicates an expected call of GetStringList
func (*MockRequestMockRecorder) GetTime ¶
func (mr *MockRequestMockRecorder) GetTime(arg0 any, arg1 ...any) *gomock.Call
GetTime indicates an expected call of GetTime
func (*MockRequestMockRecorder) HandlerName ¶
func (mr *MockRequestMockRecorder) HandlerName() *gomock.Call
HandlerName indicates an expected call of HandlerName
func (*MockRequestMockRecorder) Header ¶
func (mr *MockRequestMockRecorder) Header(arg0 any) *gomock.Call
Header indicates an expected call of Header
func (*MockRequestMockRecorder) HeaderKeys ¶
func (mr *MockRequestMockRecorder) HeaderKeys() *gomock.Call
HeaderKeys indicates an expected call of HeaderKeys
func (*MockRequestMockRecorder) Host ¶
func (mr *MockRequestMockRecorder) Host() *gomock.Call
Host indicates an expected call of Host
func (*MockRequestMockRecorder) RemoteIP ¶
func (mr *MockRequestMockRecorder) RemoteIP() *gomock.Call
RemoteIP indicates an expected call of RemoteIP
func (*MockRequestMockRecorder) URL ¶
func (mr *MockRequestMockRecorder) URL() *gomock.Call
URL indicates an expected call of URL
type MockSmallT ¶
type MockSmallT struct {
// contains filtered or unexported fields
}
MockSmallT is a mock of SmallT interface
func NewMockSmallT ¶
func NewMockSmallT(ctrl *gomock.Controller) *MockSmallT
NewMockSmallT creates a new mock instance
func (*MockSmallT) EXPECT ¶
func (m *MockSmallT) EXPECT() *MockSmallTMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSmallT) Fatalf ¶
func (m *MockSmallT) Fatalf(arg0 string, arg1 ...any)
Fatalf mocks base method
type MockSmallTMockRecorder ¶
type MockSmallTMockRecorder struct {
// contains filtered or unexported fields
}
MockSmallTMockRecorder is the mock recorder for MockSmallT
func (*MockSmallTMockRecorder) Fatalf ¶
func (mr *MockSmallTMockRecorder) Fatalf(arg0 any, arg1 ...any) *gomock.Call
Fatalf indicates an expected call of Fatalf
func (*MockSmallTMockRecorder) Helper ¶
func (mr *MockSmallTMockRecorder) Helper() *gomock.Call
Helper indicates an expected call of Helper
type RPCError ¶
type RPCError interface { Error() string // shown to user Code() Code // shown to user GrpcCode() uint32 // shown to user Message() string // shown to user (if set), can be empty Cause() error // not shown to user Unwrap() error // not shown to user Traceback(handlerName string) Traceback // not shown to user Details() map[string]any // not shown to user Add(key string, value any) RPCError }
type Request ¶
type Request interface { RemoteIP() (string, error) URL() *url.URL Host() string HandlerName() string Body() ([]byte, error) BodyTo(model any) error Header(string) string HeaderKeys() []string Cookie(name string) (*http.Cookie, error) CookieNames() []string Context() context.Context GetString(key string, sources ...FromX) (*string, error) GetStringDefault(key string, defaultValue string, sources ...FromX) (string, error) GetStringList(key string, sources ...FromX) ([]string, error) GetInt(key string, sources ...FromX) (*int, error) GetIntDefault(key string, defaultValue int, sources ...FromX) (int, error) GetFloat(key string, sources ...FromX) (*float64, error) GetFloatDefault(key string, defaultValue float64, sources ...FromX) (float64, error) GetBool(key string, sources ...FromX) (*bool, error) GetTime(key string, sources ...FromX) (*time.Time, error) GetObject(key string, _type reflect.Type, sources ...FromX) (any, error) FullMap() map[string]any }