Documentation
¶
Index ¶
- Constants
- func UnmarshalProtoMessage(m Message, pm protoreflect.ProtoMessage) error
- type GenerateFunc
- type GeneratorOption
- type Message
- type Option
- func BufConfig(configs ...string) Option
- func BufDir(dirs ...string) Option
- func BufLock(locks ...string) Option
- func BufModule(module string) Option
- func BufModules(modules []string) Option
- func DisableReflection() Option
- func EnableHealthCheck() Option
- func ImportPath(paths ...string) Option
- func Proto(protos ...string) Option
- func UseTLS(cacert, cert, key []byte) Option
- type Request
- type Response
- type Server
- func (s *Server) Addr() string
- func (s *Server) ClearMatchers()
- func (s *Server) ClearRequests()
- func (s *Server) ClientConn() *grpc.ClientConn
- func (s *Server) Close()
- func (s *Server) Conn() *grpc.ClientConn
- func (s *Server) Match(fn func(req *Request) bool) *matcher
- func (s *Server) Method(method string) *matcher
- func (s *Server) Methodf(format string, a ...any) *matcher
- func (s *Server) Prepend() *Server
- func (s *Server) Requests() []*Request
- func (s *Server) ResponseDynamic(opts ...GeneratorOption) *matcher
- func (s *Server) Service(service string) *matcher
- func (s *Server) Servicef(format string, a ...any) *matcher
- func (s *Server) UnmatchedRequests() []*Request
- type TB
Constants ¶
const ( HealthCheckService_DEFAULT = "default" HealthCheckService_FLAPPING = "flapping" )
Variables ¶
This section is empty.
Functions ¶
func UnmarshalProtoMessage ¶ added in v0.23.0
func UnmarshalProtoMessage(m Message, pm protoreflect.ProtoMessage) error
UnmarshalProtoMessage unmarshals Message to [proto.Message].
Types ¶
type GenerateFunc ¶ added in v0.8.0
type GeneratorOption ¶ added in v0.8.0
type GeneratorOption func(generators) generators
func Generator ¶ added in v0.8.0
func Generator(pattern string, fn GenerateFunc) GeneratorOption
type Message ¶
func MarshalProtoMessage ¶ added in v0.23.0
func MarshalProtoMessage(pm protoreflect.ProtoMessage) (Message, error)
MarshalProtoMessage marshals [proto.Message] to Message.
type Option ¶ added in v0.6.0
type Option func(*config) error
func BufModules ¶ added in v0.20.0
BufModules use buf modules for BSR.
func DisableReflection ¶ added in v0.11.1
func DisableReflection() Option
DisableReflection disable Server Reflection Protocol
func EnableHealthCheck ¶ added in v0.9.0
func EnableHealthCheck() Option
EnableHealthCheck enable grpc.health.v1
func ImportPath ¶ added in v0.8.0
ImportPath set import paths
type Response ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
NewServer returns a new server with registered *grpc.Server protopath is a path of .proto files, import path directory or buf directory.
func NewTLSServer ¶ added in v0.5.0
NewTLSServer returns a new server with registered secure *grpc.Server
func (*Server) ClearMatchers ¶ added in v0.15.3
func (s *Server) ClearMatchers()
ClearMatchers clear matchers.
func (*Server) ClearRequests ¶ added in v0.15.3
func (s *Server) ClearRequests()
ClearRequests clear requests.
func (*Server) ClientConn ¶ added in v0.5.0
func (s *Server) ClientConn() *grpc.ClientConn
ClientConn is alias of Conn
func (*Server) Conn ¶
func (s *Server) Conn() *grpc.ClientConn
Conn returns *grpc.ClientConn which connects *grpc.Server.
func (*Server) Match ¶
Match create request matcher with matchFunc (func(req *grpcstub.Request) bool).
func (*Server) ResponseDynamic ¶ added in v0.8.1
func (s *Server) ResponseDynamic(opts ...GeneratorOption) *matcher
ResponseDynamic set handler which return dynamic response.
func (*Server) UnmatchedRequests ¶ added in v0.14.0
UnmatchedRequests returns []*grpcstub.Request received but not matched by router.