Documentation
¶
Overview ¶
Package micro is a pluggable framework for microservices
Index ¶
- Variables
- func NewContext(ctx context.Context, s Service) context.Context
- func RegisterHandler(s server.Server, h interface{}, opts ...server.HandlerOption) error
- func RegisterSubscriber(topic string, s server.Server, h interface{}, opts ...server.SubscriberOption) error
- type Event
- type Group
- type Option
- type Options
- type Publisher
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var Action = service.Action
View Source
var AddListenOption = service.AddListenOption
View Source
var Address = service.Address
View Source
var AfterStart = service.AfterStart
View Source
var AfterStop = service.AfterStop
View Source
var Auth = service.Auth
View Source
var BeforeStart = service.BeforeStart
View Source
var BeforeStop = service.BeforeStop
View Source
var Broker = service.Broker
View Source
var Cache = service.Cache
View Source
var Client = service.Client
View Source
var Cmd = service.Cmd
View Source
var Config = service.Config
View Source
var Context = service.Context
View Source
var Flags = service.Flags
View Source
var Handle = service.Handle
View Source
var HandleSignal = service.HandleSignal
View Source
var Logger = service.Logger
View Source
var Metadata = service.Metadata
View Source
var Model = service.Model
View Source
var Name = service.Name
View Source
var Profile = service.Profile
View Source
var RegisterInterval = service.RegisterInterval
View Source
var RegisterTTL = service.RegisterTTL
View Source
var Registry = service.Registry
View Source
var Selector = service.Selector
View Source
var Server = service.Server
View Source
var Store = service.Store
View Source
var Tracer = service.Tracer
View Source
var Transport = service.Transport
View Source
var Version = service.Version
View Source
var WrapCall = service.WrapCall
View Source
var WrapClient = service.WrapClient
View Source
var WrapHandler = service.WrapHandler
View Source
var WrapSubscriber = service.WrapSubscriber
Functions ¶
func NewContext ¶
NewContext returns a new Context with the Service embedded within it.
func RegisterHandler ¶
func RegisterHandler(s server.Server, h interface{}, opts ...server.HandlerOption) error
RegisterHandler is syntactic sugar for registering a handler.
func RegisterSubscriber ¶
func RegisterSubscriber(topic string, s server.Server, h interface{}, opts ...server.SubscriberOption) error
RegisterSubscriber is syntactic sugar for registering a subscriber.
Types ¶
type Event ¶
type Event interface {
// Publish publishes a message to the event topic
Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error
}
Event is used to publish messages to a topic.
type Service ¶
Service is the interface for a go-micro service.
func FromContext ¶
FromContext retrieves a Service from the Context.
func New ¶
New creates a new service with the given name and options.
service := micro.New("greeter")
service := micro.New("greeter", micro.Address(":8080"))
func NewService ¶
NewService creates and returns a new Service based on the packages within. Deprecated: Use New(name, opts...) instead.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth provides authentication and authorization capability
|
Package auth provides authentication and authorization capability |
|
noop
Package noop provides a no-op auth implementation for testing and development.
|
Package noop provides a no-op auth implementation for testing and development. |
|
jwt
module
|
|
|
Package broker is an interface used for asynchronous messaging
|
Package broker is an interface used for asynchronous messaging |
|
nats
module
|
|
|
Package client is an interface for an RPC client
|
Package client is an interface for an RPC client |
|
grpc
module
|
|
|
Package cmd is an interface for parsing the command line
|
Package cmd is an interface for parsing the command line |
|
micro
command
|
|
|
micro/api
Package api implements the 'micro api' command — a lightweight HTTP-to-RPC gateway that proxies JSON requests to go-micro services.
|
Package api implements the 'micro api' command — a lightweight HTTP-to-RPC gateway that proxies JSON requests to go-micro services. |
|
micro/cli/build
Package build provides the micro build command for building service binaries
|
Package build provides the micro build command for building service binaries |
|
micro/cli/deploy
Package deploy provides the micro deploy command for deploying services
|
Package deploy provides the micro deploy command for deploying services |
|
micro/cli/gen
Package generate provides code generation commands for micro
|
Package generate provides code generation commands for micro |
|
micro/cli/init
Package initcmd provides the micro init command for server setup
|
Package initcmd provides the micro init command for server setup |
|
micro/cli/new
Package new generates micro service templates
|
Package new generates micro service templates |
|
micro/cli/remote
Package remote provides remote server operations for micro
|
Package remote provides remote server operations for micro |
|
micro/cli/util
Package cliutil contains methods used across all cli commands @todo: get rid of os.Exits and use errors instread
|
Package cliutil contains methods used across all cli commands @todo: get rid of os.Exits and use errors instread |
|
micro/resource
Package resource provides CLI commands that map directly onto go-micro's core interfaces — registry, broker, store, and config.
|
Package resource provides CLI commands that map directly onto go-micro's core interfaces — registry, broker, store, and config. |
|
micro/run/config
Package config handles micro.mu and micro.json configuration parsing
|
Package config handles micro.mu and micro.json configuration parsing |
|
micro/run/watcher
Package watcher provides file watching for hot reload
|
Package watcher provides file watching for hot reload |
|
protoc-gen-micro
command
protoc-gen-micro is a plugin for the Google protocol buffer compiler to generate Go code.
|
protoc-gen-micro is a plugin for the Google protocol buffer compiler to generate Go code. |
|
protoc-gen-micro-gateway
command
protoc-gen-micro-gateway generates gateway HTTP rules (gateway/SPEC.md section 2.2) from google.api.http annotations: for each .proto file with annotated methods, a <file>.gateway.yaml next to it (relative to the output directory) holding an http_rules list to merge into the gateway rules document.
|
protoc-gen-micro-gateway generates gateway HTTP rules (gateway/SPEC.md section 2.2) from google.api.http annotations: for each .proto file with annotated methods, a <file>.gateway.yaml next to it (relative to the output directory) holding an http_rules list to merge into the gateway rules document. |
|
protoc-gen-micro/generator
The code generator for the plugin for the Google protocol buffer compiler.
|
The code generator for the plugin for the Google protocol buffer compiler. |
|
Package codec is an interface for encoding messages
|
Package codec is an interface for encoding messages |
|
bytes
Package bytes provides a bytes codec which does not encode or decode anything
|
Package bytes provides a bytes codec which does not encode or decode anything |
|
grpc
Package grpc provides a grpc codec
|
Package grpc provides a grpc codec |
|
json
Package json provides a json codec
|
Package json provides a json codec |
|
jsonrpc
Package jsonrpc provides a json-rpc 1.0 codec
|
Package jsonrpc provides a json-rpc 1.0 codec |
|
proto
Package proto provides a proto codec
|
Package proto provides a proto codec |
|
protorpc
Protorpc provides a net/rpc proto-rpc codec.
|
Protorpc provides a net/rpc proto-rpc codec. |
|
text
Package text reads any text/* content-type
|
Package text reads any text/* content-type |
|
Package config is an interface for dynamic configuration.
|
Package config is an interface for dynamic configuration. |
|
encoder
Package encoder handles source encoding formats
|
Package encoder handles source encoding formats |
|
loader
Package loader manages loading from multiple sources
|
Package loader manages loading from multiple sources |
|
reader
Package reader parses change sets and provides config values
|
Package reader parses change sets and provides config values |
|
secrets
Package secrets is an interface for encrypting and decrypting secrets
|
Package secrets is an interface for encrypting and decrypting secrets |
|
secrets/box
Package box is an asymmetric implementation of config/secrets using nacl/box
|
Package box is an asymmetric implementation of config/secrets using nacl/box |
|
secrets/secretbox
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification
|
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification |
|
source
Package source is the interface for sources
|
Package source is the interface for sources |
|
source/file
Package file is a file source.
|
Package file is a file source. |
|
source/memory
Package memory is a memory source
|
Package memory is a memory source |
|
debug
|
|
|
handler
Package handler implements service debug handler embedded in go-micro services
|
Package handler implements service debug handler embedded in go-micro services |
|
log
Package log provides debug logging
|
Package log provides debug logging |
|
log/memory
Package memory provides an in memory log buffer
|
Package memory provides an in memory log buffer |
|
profile
Package profile is for profilers
|
Package profile is for profilers |
|
profile/http
Package http enables the http profiler
|
Package http enables the http profiler |
|
profile/pprof
Package pprof provides a pprof profiler
|
Package pprof provides a pprof profiler |
|
stats
Package stats provides runtime stats
|
Package stats provides runtime stats |
|
trace
Package trace provides an interface for distributed tracing
|
Package trace provides an interface for distributed tracing |
|
Package errors provides a way to return detailed information for an RPC request error.
|
Package errors provides a way to return detailed information for an RPC request error. |
|
Package events is for event streaming and storage
|
Package events is for event streaming and storage |
|
examples
|
|
|
multi-service
command
Multi-service example: run multiple services in a single binary.
|
Multi-service example: run multiple services in a single binary. |
|
gateway
|
|
|
api
Package api provides HTTP API gateway functionality for go-micro services.
|
Package api provides HTTP API gateway functionality for go-micro services. |
|
push
Package push sends messages to WebSocket clients connected to a gateway (gateway/SPEC.md section 2.3).
|
Package push sends messages to WebSocket clients connected to a gateway (gateway/SPEC.md section 2.3). |
|
Package health provides health check functionality for microservices.
|
Package health provides health check functionality for microservices. |
|
internal
|
|
|
test
Package test implements a testing framwork, and provides default tests.
|
Package test implements a testing framwork, and provides default tests. |
|
util/jitter
Package jitter provides a random jitter
|
Package jitter provides a random jitter |
|
util/pool
Package pool is a connection pool
|
Package pool is a connection pool |
|
util/ring
Package ring provides a simple ring buffer for storing local data
|
Package ring provides a simple ring buffer for storing local data |
|
util/socket
Package socket provides a pseudo socket
|
Package socket provides a pseudo socket |
|
Package log provides a log interface
|
Package log provides a log interface |
|
Package metadata is a way of defining message headers
|
Package metadata is a way of defining message headers |
|
Package model is an interface for structured data storage with schema awareness.
|
Package model is an interface for structured data storage with schema awareness. |
|
memory
Package memory provides an in-memory model.Model implementation.
|
Package memory provides an in-memory model.Model implementation. |
|
Package mdns is a multicast dns registry
|
Package mdns is a multicast dns registry |
|
cache
Package cache provides a registry cache
|
Package cache provides a registry cache |
|
nacos
module
|
|
|
Package selector is a way to pick a list of service nodes
|
Package selector is a way to pick a list of service nodes |
|
p2c
Package p2c implements power-of-two-choices load balancing with EWMA latency feedback: each pick samples two random nodes and routes to the one with the lower load (ewma_latency × (inflight+1)).
|
Package p2c implements power-of-two-choices load balancing with EWMA latency feedback: each pick samples two random nodes and routes to the one with the lower load (ewma_latency × (inflight+1)). |
|
weighted
Package weighted implements weight-based node selection for canary / gray releases.
|
Package weighted implements weight-based node selection for canary / gray releases. |
|
Package server is an interface for a micro server
|
Package server is an interface for a micro server |
|
grpc
module
|
|
|
profile
Package profile provides grouped plugin profiles for go-micro
|
Package profile provides grouped plugin profiles for go-micro |
|
Package store is an interface for distributed data storage.
|
Package store is an interface for distributed data storage. |
|
Package sync provides distributed coordination primitives: locks and leader election.
|
Package sync provides distributed coordination primitives: locks and leader election. |
|
Package transport is an interface for synchronous connection based communication
|
Package transport is an interface for synchronous connection based communication |
|
headers
headers is a package for internal micro global constants
|
headers is a package for internal micro global constants |
|
util
|
|
|
addr
addr provides functions to retrieve local IP addresses from device interfaces.
|
addr provides functions to retrieve local IP addresses from device interfaces. |
|
backoff
Package backoff provides backoff functionality
|
Package backoff provides backoff functionality |
|
tls
Package tls provides TLS utilities for go-micro.
|
Package tls provides TLS utilities for go-micro. |
|
Package web provides a web service for go-micro
|
Package web provides a web service for go-micro |
Click to show internal directories.
Click to hide internal directories.