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 broker is an interface used for asynchronous messaging.
|
Package broker is an interface used for asynchronous messaging. |
Package client is an interface for making requests.
|
Package client is an interface for making requests. |
Package cmd is an interface for parsing the command line.
|
Package cmd is an interface for parsing the command line. |
Package codec is an interface for encoding messages.
|
Package codec is an interface for encoding messages. |
protorpc
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Package errors is an interface for defining detailed errors.
|
Package errors is an interface for defining detailed errors. |
examples
|
|
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. |
service/proto
Package greeter is a generated protocol buffer package.
|
Package greeter is a generated protocol buffer package. |
Package metadata is a way of defining message headers.
|
Package metadata is a way of defining message headers. |
Package registry is an interface for service discovery.
|
Package registry is an interface for service discovery. |
Package selector is a way to load balance service nodes.
|
Package selector is a way to load balance service nodes. |
Package server is an interface for a micro server.
|
Package server is an interface for a micro server. |
debug/proto
Package debug is a generated protocol buffer package.
|
Package debug is a generated protocol buffer package. |
Package is an interface for synchronous communication.
|
Package is an interface for synchronous communication. |
Click to show internal directories.
Click to hide internal directories.