Documentation
¶
Index ¶
- Variables
- func NewContext(ctx context.Context, s Service) context.Context
- type Option
- func Action(a func(*cli.Context)) Option
- func AfterStop(fn func() error) Option
- func BeforeStart(fn func() error) Option
- func Broker(b broker.Broker) Option
- func Client(c client.Client) Option
- func Cmd(c cmd.Cmd) Option
- func Flags(flags ...cli.Flag) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func RegisterInterval(t time.Duration) Option
- func RegisterTTL(t time.Duration) Option
- func Registry(r registry.Registry) Option
- func Server(s server.Server) Option
- func Transport(t transport.Transport) Option
- func Version(v string) Option
- func WrapClient(w ...client.Wrapper) Option
- func WrapHandler(w ...server.HandlerWrapper) Option
- func WrapSubscriber(w ...server.SubscriberWrapper) Option
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var (
HeaderPrefix = "X-Micro-"
)
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
func BeforeStart ¶
func RegisterInterval ¶
func RegisterTTL ¶
func WrapClient ¶
WrapClient is a convenience method for wrapping a Client with some middleware component. A list of wrappers can be provided.
func WrapHandler ¶
func WrapHandler(w ...server.HandlerWrapper) Option
WrapHandler adds a handler Wrapper to a list of options passed into the server
func WrapSubscriber ¶
func WrapSubscriber(w ...server.SubscriberWrapper) Option
WrapSubscriber adds a subscriber Wrapper to a list of options passed into the server
type Options ¶
type Options struct { Broker broker.Broker Cmd cmd.Cmd Client client.Client Server server.Server Registry registry.Registry Transport transport.Transport // Register loop interval RegisterInterval time.Duration // Before and After funcs BeforeStart []func() error AfterStop []func() error // Other options for implementations of the interface // can be stored in a context Context context.Context }
type Service ¶
type Service interface { Init(...Option) Options() Options Client() client.Client Server() server.Server Run() error String() string }
Service is an interface that wraps the lower level libraries within go-micro. Its a convenience method for building and initialising services.
func NewService ¶
Directories
¶
Path | Synopsis |
---|---|
Package client provides a method to make synchronous, asynchronous and streaming requests to services.
|
Package client provides a method to make synchronous, asynchronous and streaming requests to services. |
protorpc
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
examples
|
|
client
command
|
|
client/codegen
command
|
|
client/dc_filter
command
|
|
client/dc_selector
command
|
|
client/pub
command
|
|
client/selector
command
|
|
client/wrapper
command
|
|
pubsub
command
|
|
pubsub/consumer
command
|
|
pubsub/producer
command
|
|
server
command
|
|
server/codegen
command
|
|
server/proto/example
Package go_micro_srv_example is a generated protocol buffer package.
|
Package go_micro_srv_example is a generated protocol buffer package. |
server/wrapper
command
|
|
service
command
|
|
service/proto
Package greeter is a generated protocol buffer package.
|
Package greeter is a generated protocol buffer package. |
service/wrapper
command
|
|
The Selector package provides a way to algorithmically filter and return nodes required by the client or any other system.
|
The Selector package provides a way to algorithmically filter and return nodes required by the client or any other system. |
Server represents a server instance in go-micro which handles synchronous requests via handlers and asynchronous requests via subscribers that register with a broker.
|
Server represents a server instance in go-micro which handles synchronous requests via handlers and asynchronous requests via subscribers that register with a broker. |
debug/proto
Package debug is a generated protocol buffer package.
|
Package debug is a generated protocol buffer package. |
Click to show internal directories.
Click to hide internal directories.