dtmdriver

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 4 Imported by: 50

README

dtmdriver

dtm's driver interface for micro-services

gRPC

dtm has support grpc based micro-services: go-zero, kratos, polaris

HTTP

dtm has support http base micro-services: springclould-alibaba

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Middlewares = middlewares{
	Grpc: []grpc.UnaryClientInterceptor{},
	HTTP: []func(c *resty.Client, r *resty.Request) error{},
}

Middlewares is the middlewares for drivers to implement their function

Functions

func Register

func Register(driver Driver)

Register used by each driver writer to register the driver to system

func Use

func Use(name string) error

Use called by users who want to use dtmgrpc.

Types

type Driver

type Driver interface {
	// GetName return the name of the driver
	GetName() string

	// RegisterAddrResolver will be called when driver used
	// for gRPC: register grpc resolver
	// for HTTP: add your http middleware
	RegisterAddrResolver()

	// RegisterService register dtm endpoint to target.
	// for both http and grpc
	RegisterService(target string, endpoint string) error

	// ParseServerMethod parse the gRPC url to server and method.
	// server will be passed to grpc.Dial, and method to grpc.ClientConn.invoke
	ParseServerMethod(uri string) (server string, method string, err error)
}

Driver is the interface to do grpc service register and discover

func GetDriver

func GetDriver() Driver

GetDriver called by dtm

Jump to

Keyboard shortcuts

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