Commit: Bulk unfinished work
This commit is contained in:
37
utils/reflection.go
Normal file
37
utils/reflection.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package utils
|
||||
|
||||
// Keep (used in cmd/api/main.go)
|
||||
|
||||
// Reflection utilities for gRPC services
|
||||
// using connect-go and grpcreflect
|
||||
import (
|
||||
"connectrpc.com/grpcreflect"
|
||||
"git.kocoder.xyz/kocoded/vt/fx"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/mandant/v1/mandantv1connect"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/messagebus/v1/messagebusv1connect"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/project/v1/projectv1connect"
|
||||
"git.kocoder.xyz/kocoded/vt/gen/todo/v1/todov1connect"
|
||||
)
|
||||
|
||||
func NewReflector() *grpcreflect.Reflector {
|
||||
strings := []string{
|
||||
todov1connect.TodoServiceName,
|
||||
projectv1connect.ProjectServiceName,
|
||||
mandantv1connect.MandantServiceName,
|
||||
messagebusv1connect.MessageBusServiceName,
|
||||
}
|
||||
|
||||
return grpcreflect.NewReflector(grpcreflect.NamerFunc(func() []string {
|
||||
return strings
|
||||
}))
|
||||
}
|
||||
|
||||
func NewReflectorV1(reflector *grpcreflect.Reflector) fx.Handler {
|
||||
path, handler := grpcreflect.NewHandlerV1(reflector)
|
||||
return fx.NewRoute(path, handler)
|
||||
}
|
||||
|
||||
func NewReflectorV1Alpha1(reflector *grpcreflect.Reflector) fx.Handler {
|
||||
path, handler := grpcreflect.NewHandlerV1Alpha(reflector)
|
||||
return fx.NewRoute(path, handler)
|
||||
}
|
||||
Reference in New Issue
Block a user