micro

package
v0.1.0-2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHealthy added in v0.1.2

func CheckHealthy(c echo.Context) error

Types

type ApiMicroService added in v0.1.2

type ApiMicroService struct {
}

func (*ApiMicroService) NewServer added in v0.1.2

func (a *ApiMicroService) NewServer() *echo.Echo

func (*ApiMicroService) StartApi added in v0.1.2

func (a *ApiMicroService) StartApi(e *echo.Echo, serviceName string, addr string) error

注入nacos

type Group added in v0.1.2

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

func (*Group) DELETE added in v0.1.2

func (g *Group) DELETE(prefix string, f HandleFunc)

func (*Group) Get added in v0.1.2

func (g *Group) Get(prefix string, f HandleFunc)

func (*Group) POST added in v0.1.2

func (g *Group) POST(prefix string, f HandleFunc)

func (*Group) PUT added in v0.1.2

func (g *Group) PUT(prefix string, f HandleFunc)

type GrpcService added in v0.1.2

type GrpcService struct {
	Opts             Options
	Service          *grpc.Server
	ServiceDiscovery func(dsAddress, namespaceId string)
	// contains filtered or unexported fields
}

func (*GrpcService) Init added in v0.1.2

func (gs *GrpcService) Init(groups map[string]*Group)

func (*GrpcService) New added in v0.1.2

func (gs *GrpcService) New() interface{}

func (*GrpcService) Run added in v0.1.2

func (gs *GrpcService) Run()

type HandleFunc added in v0.1.2

type HandleFunc func(c echo.Context) error

type HttpService added in v0.1.2

type HttpService struct {
	Opts             Options
	Service          *echo.Echo
	ServiceDiscovery func(dsAddress, namespaceId string)
	// contains filtered or unexported fields
}

func (*HttpService) Init added in v0.1.2

func (hs *HttpService) Init(groups map[string]*Group)

func (*HttpService) New added in v0.1.2

func (hs *HttpService) New() interface{}

func (*HttpService) Run added in v0.1.2

func (hs *HttpService) Run()

type HttpVerb added in v0.1.2

type HttpVerb uint8
const (
	GET    HttpVerb = 1
	POST   HttpVerb = 2
	PUT    HttpVerb = 3
	DELETE HttpVerb = 4
)

type MicService

type MicService struct {
	GrpcServer *grpc.Server
	Routes     map[string]func(http.ResponseWriter, *http.Request)
}

func (*MicService) NewServer

func (m *MicService) NewServer()

func (*MicService) Start

func (m *MicService) Start(serviceName string)

type MicroService added in v0.1.2

type MicroService interface {
	New() interface{}
	Init(groups map[string]*Group)
	Run()
}

type Option added in v0.1.2

type Option func(opts *Options)

func SetRunMode added in v0.1.2

func SetRunMode(mode RunMode) Option

设置允许模式

func SetServiceName added in v0.1.2

func SetServiceName(name string) Option

设置服务名称

func SetServiceType added in v0.1.2

func SetServiceType(serviceType ServiceType) Option

type Options added in v0.1.2

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

type Route added in v0.1.2

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

type RunMode added in v0.1.2

type RunMode uint8
const (
	ByHost   RunMode = 1
	ByDocker RunMode = 2
	ByK8s    RunMode = 3
)

type Service added in v0.1.2

type Service struct {
	Instance interface{}
	// contains filtered or unexported fields
}

func NewService added in v0.1.2

func NewService(opts ...Option) *Service

创建服务

func (*Service) DELETE added in v0.1.2

func (s *Service) DELETE(prefix string, f HandleFunc)

func (*Service) Get added in v0.1.2

func (s *Service) Get(prefix string, f HandleFunc)

func (*Service) Group added in v0.1.2

func (bs *Service) Group(prefix string) *Group

func (*Service) Init added in v0.1.2

func (bs *Service) Init()

func (*Service) POST added in v0.1.2

func (s *Service) POST(prefix string, f HandleFunc)

func (*Service) PUT added in v0.1.2

func (s *Service) PUT(prefix string, f HandleFunc)

func (*Service) RegisterService added in v0.1.2

func (bs *Service) RegisterService(dsAddress, namespaceId string)

注册服务

func (*Service) Run added in v0.1.2

func (bs *Service) Run()

type ServiceType added in v0.1.2

type ServiceType uint8
const (
	Http ServiceType = 1
	GRPC ServiceType = 2
)

Jump to

Keyboard shortcuts

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