micro

package module
v0.0.0-...-ad68a05 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 7

README

Build Status Go Report Card GoDoc Mentioned in Awesome Go

micro

A Go distributed systems development framework

framework eference resources base on go-micro

support list

install

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(clientName string) client.Client

GetClient get client from cliet name

func IsExist

func IsExist(name string) bool

IsExist existed

func SetClientServiceAddr

func SetClientServiceAddr(clientName string, ips ...string)

SetClientServiceAddr set service address with client name

func SetClientServiceName

func SetClientServiceName(clientName, serviceName string)

SetClientServiceName set service name with client name

Types

type Option

type Option func(*Options)

Option ...

func WithName

func WithName(n string) Option

WithName of the service . Specify service name (Group)

func WithRegisterInterval

func WithRegisterInterval(t time.Duration) Option

WithRegisterInterval the service with at interval.

func WithRegisterTTL

func WithRegisterTTL(t time.Duration) Option

WithRegisterTTL the service with a TTL

func WithRegistryNaming

func WithRegistryNaming(reg registry.RegNaming) Option

WithRegistryNaming Register for naming service discovery

type Options

type Options struct {
	// Broker    broker.Broker
	// Cmd       cmd.Cmd
	Client   client.Client
	Server   server.Server
	Registry *registry.Registry

	// // Other options for implementations of the interface
	// // can be stored in a context
	Context context.Context
}

Options ...

type Service

type Service interface {
	// The service name
	Name() string
	// Init initialises options
	Init(...Option)
	// Options returns the current options
	Options() Options
	// Client is used to call services
	Client() client.Client
	// Server is for handling requests and events
	Server() server.Server
	// Run the service
	Run() error
	// The service implementation
	String() string
	// stop
	Stop() error

	// stop signal
	NotifyStop()
}

Service is an interface that wraps the lower level libraries within go-micro. Its a convenience method for building and initialising services.

func GetService

func GetService(name string) Service

GetService get service

func NewService

func NewService(opts ...Option) Service

NewService newservice

Directories

Path Synopsis
`grpc_opentracing` adds OpenTracing
`grpc_opentracing` adds OpenTracing
Package profile is for profilers
Package profile is for profilers
http
Package http enables the http profiler
Package http enables the http profiler
pprof
Package pprof provides a pprof profiler
Package pprof provides a pprof profiler

Jump to

Keyboard shortcuts

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