opensergo

package module
v0.0.0-...-0a38125 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 15 Imported by: 0

README

OpenSergo

Usage

	osServer, err := opensergo.New(opensergo.WithEndpoint("localhost:9090"))
	if err != nil {
		panic("init opensergo error")
	}

	s := &server{}
	grpcSrv := grpc.NewServer(
		grpc.Address(":9000"),
		grpc.Middleware(
			recovery.Recovery(),
		),
	)
	helloworld.RegisterGreeterServer(grpcSrv, s)

	app := kratos.New(
		kratos.Name(Name),
		kratos.Server(
			grpcSrv,
		),
	)

	osServer.ReportMetadata(context.Background(), app)

	if err := app.Run(); err != nil {
		log.Fatal(err)
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPPatternInfo

func HTTPPatternInfo(pattern interface{}) (method string, path string)

Types

type OpenSergo

type OpenSergo struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*OpenSergo, error)

func (*OpenSergo) ReportMetadata

func (s *OpenSergo) ReportMetadata(ctx context.Context, app kratos.AppInfo) error

type Option

type Option func(*options)

func WithEndpoint

func WithEndpoint(endpoint string) Option

Jump to

Keyboard shortcuts

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