micro

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 23 Imported by: 0

README

micro

GoDoc Build Status codecov

Microservice prototype with gRPC + Restful + Redoc + Opentracing + Prometheus.

Documentation

Overview

ref: https://opentelemetry.io/docs/demo/services/checkout/

Index

Constants

View Source
const SwaggerFile = "/swagger.json"

SwaggerFile is the swagger file (local path)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedocOpts

type RedocOpts struct {
	// SpecURL the url to find the spec for
	SpecURL string
	// RedocURL for the js that generates the redoc site, defaults to: https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js
	RedocURL string
	// Title for the documentation site, default to: API documentation
	Title string
}

RedocOpts is the Redoc configures type

var RedocOptions RedocOpts

RedocOptions configures the Redoc

type RegisterServiceHandlerFunc added in v1.2.0

type RegisterServiceHandlerFunc func(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

ReverseProxyFunc - a callback that the caller should implement to steps to reverse-proxy the HTTP/1 requests to gRPC type ReverseProxyFunc func(ctx context.Context, mux *runtime.ServeMux, grpcHostAndPort string, opts []grpc.DialOption) error

type Service

type Service struct {
	GRPCServer *grpc.Server
	// contains filtered or unexported fields
}

Service - to represent the microservice

func NewService

func NewService() *Service

NewService - to create the microservice object

func (*Service) AddService added in v1.2.0

func (s *Service) AddService(serviceDesc *grpc.ServiceDesc, srv interface{}, registerServiceHandlerFunc RegisterServiceHandlerFunc)

func (*Service) SetGRPCGatewayPort added in v1.2.0

func (s *Service) SetGRPCGatewayPort(port uint16)

func (*Service) SetGRPCPort added in v1.2.0

func (s *Service) SetGRPCPort(port uint16)

func (*Service) Start

func (s *Service) Start() error

Start - to start the microservice with listening on the ports

func (*Service) Stop added in v1.0.0

func (s *Service) Stop()

func (*Service) UpRedoc

func (s *Service) UpRedoc(up bool) *Service

UpRedoc - to configure redoc server to run up at /docs endpoint

Jump to

Keyboard shortcuts

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