grpc¶
import "github.com/Mini-Vending/go-services/packages/grpc"
Index¶
- Constants
- Variables
- func RequestContextInterceptor(logger log.Logger, app string) grpc.UnaryServerInterceptor
- func RequestLoggingInterceptor(logger logger.Logger) grpc.UnaryServerInterceptor
- type Config
- type Endpoint
- type Server
- func NewServer(cfg *Config, logger logger.Logger, options grpc.ServerOption) *Server
- func (s *Server) Start(endpoints []Endpoint) error
- func (s *Server) Stop(ctx context.Context) error
- type TokenData
Constants¶
const TokenDataKey = "token_data"
Variables¶
var (
GrpcErrInsufficientPermissions = status.Error(codes.PermissionDenied, "insufficient permissions")
GrpcErrUnauthenticated = status.Error(codes.Unauthenticated, "unauthenticated")
)
func RequestContextInterceptor¶
func RequestContextInterceptor(logger log.Logger, app string) grpc.UnaryServerInterceptor
func RequestLoggingInterceptor¶
func RequestLoggingInterceptor(logger logger.Logger) grpc.UnaryServerInterceptor
type Config¶
type Config struct {
Port string
}
type Endpoint¶
type Endpoint interface {
Register(srv *grpc.Server)
}
type Server¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer¶
func NewServer(cfg *Config, logger logger.Logger, options grpc.ServerOption) *Server
func (*Server) Start¶
func (s *Server) Start(endpoints []Endpoint) error
func (*Server) Stop¶
func (s *Server) Stop(ctx context.Context) error
type TokenData¶
type TokenData struct {
Email string `json:"email"`
Role string `json:"role"`
AccountID int64 `json:"account_id"`
MerchantID int64 `json:"merchant_id"`
}
Generated by gomarkdoc