go-micro: github.com/micro/go-micro Index | Files | Directories

package micro

import "github.com/micro/go-micro"

Package micro is a pluggable framework for microservices

Index

Package Files

function.go micro.go options.go publisher.go service.go wrapper.go

Variables

var (
    HeaderPrefix = "Micro-"
)

func NewContext Uses

func NewContext(ctx context.Context, s Service) context.Context

NewContext returns a new Context with the Service embedded within it.

func RegisterHandler Uses

func RegisterHandler(s server.Server, h interface{}, opts ...server.HandlerOption) error

RegisterHandler is syntactic sugar for registering a handler

func RegisterSubscriber Uses

func RegisterSubscriber(topic string, s server.Server, h interface{}, opts ...server.SubscriberOption) error

RegisterSubscriber is syntactic sugar for registering a subscriber

type Function Uses

type Function interface {
    // Inherits Service interface
    Service
    // Done signals to complete execution
    Done() error
    // Handle registers an RPC handler
    Handle(v interface{}) error
    // Subscribe registers a subscriber
    Subscribe(topic string, v interface{}) error
}

Function is a one time executing Service

func NewFunction Uses

func NewFunction(opts ...Option) Function

NewFunction returns a new Function for a one time executing Service

type Option Uses

type Option func(*Options)

func Action Uses

func Action(a func(*cli.Context)) Option

func Address Uses

func Address(addr string) Option

Address sets the address of the server

func AfterStart Uses

func AfterStart(fn func() error) Option

func AfterStop Uses

func AfterStop(fn func() error) Option

func BeforeStart Uses

func BeforeStart(fn func() error) Option

func BeforeStop Uses

func BeforeStop(fn func() error) Option

func Broker Uses

func Broker(b broker.Broker) Option

func Client Uses

func Client(c client.Client) Option

func Cmd Uses

func Cmd(c cmd.Cmd) Option

func Context Uses

func Context(ctx context.Context) Option

Context specifies a context for the service. Can be used to signal shutdown of the service. Can be used for extra option values.

func Flags Uses

func Flags(flags ...cli.Flag) Option

func Metadata Uses

func Metadata(md map[string]string) Option

Metadata associated with the service

func Name Uses

func Name(n string) Option

Name of the service

func RegisterInterval Uses

func RegisterInterval(t time.Duration) Option

RegisterInterval specifies the interval on which to re-register

func RegisterTTL Uses

func RegisterTTL(t time.Duration) Option

RegisterTTL specifies the TTL to use when registering the service

func Registry Uses

func Registry(r registry.Registry) Option

Registry sets the registry for the service and the underlying components

func Selector Uses

func Selector(s selector.Selector) Option

Selector sets the selector for the service client

func Server Uses

func Server(s server.Server) Option

func Transport Uses

func Transport(t transport.Transport) Option

Transport sets the transport for the service and the underlying components

func Version Uses

func Version(v string) Option

Version of the service

func WrapCall Uses

func WrapCall(w ...client.CallWrapper) Option

WrapCall is a convenience method for wrapping a Client CallFunc

func WrapClient Uses

func WrapClient(w ...client.Wrapper) Option

WrapClient is a convenience method for wrapping a Client with some middleware component. A list of wrappers can be provided. Wrappers are applied in reverse order so the last is executed first.

func WrapHandler Uses

func WrapHandler(w ...server.HandlerWrapper) Option

WrapHandler adds a handler Wrapper to a list of options passed into the server

func WrapSubscriber Uses

func WrapSubscriber(w ...server.SubscriberWrapper) Option

WrapSubscriber adds a subscriber Wrapper to a list of options passed into the server

type Options Uses

type Options struct {
    Broker    broker.Broker
    Cmd       cmd.Cmd
    Client    client.Client
    Server    server.Server
    Registry  registry.Registry
    Transport transport.Transport

    // Before and After funcs
    BeforeStart []func() error
    BeforeStop  []func() error
    AfterStart  []func() error
    AfterStop   []func() error

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

type Publisher Uses

type Publisher interface {
    Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error
}

Publisher is syntactic sugar for publishing

func NewPublisher Uses

func NewPublisher(topic string, c client.Client) Publisher

NewPublisher returns a new Publisher

type Service Uses

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 FromContext Uses

func FromContext(ctx context.Context) (Service, bool)

FromContext retrieves a Service from the Context.

func NewService Uses

func NewService(opts ...Option) Service

NewService creates and returns a new Service based on the packages within.

Directories

PathSynopsis
agentPackage agent provides an interface for building robots
agent/commandPackage command is an interface for defining bot commands
agent/inputPackage input is an interface for bot inputs
agent/input/discord
agent/input/slack
agent/input/telegram
agent/protoPackage go_micro_bot is a generated protocol buffer package.
api
api/handlerPackage handler provides http handlers
api/handler/apiPackage api provides an http-rpc handler which provides the entire http request over rpc
api/handler/brokerPackage broker provides a go-micro/broker handler
api/handler/cloudeventsPackage cloudevents provides a cloudevents handler publishing the event using the go-micro/client
api/handler/eventPackage event provides a handler which publishes an event
api/handler/filePackage file serves file relative to the current directory
api/handler/httpPackage http is a http reverse proxy handler
api/handler/registryPackage registry is a go-micro/registry handler
api/handler/rpcPackage rpc is a go-micro rpc handler.
api/handler/udpPackage udp reads and write from a udp connection
api/handler/unixPackage unix reads from a unix socket expecting it to be in /tmp/path
api/handler/webPackage web contains the web handler including websocket support
api/internal/proto
api/protoPackage go_api is a generated protocol buffer package.
api/resolverPackage resolver resolves a http request to an endpoint
api/resolver/grpcPackage grpc resolves a grpc service like /greeter.Say/Hello to greeter service
api/resolver/hostPackage host resolves using http host
api/resolver/microPackage micro provides a micro rpc resolver which prefixes a namespace
api/resolver/pathPackage path resolves using http path
api/resolver/vpathPackage vpath resolves using http path and recognised versioned urls
api/routerPackage router provides api service routing
api/router/registryPackage registry provides a dynamic api service router
api/serverPackage server provides an API gateway server which handles inbound requests
api/server/httpPackage http provides a http server with features; acme, cors, etc
brokerPackage broker is an interface used for asynchronous messaging
broker/httpPackage http provides a http based message broker
broker/memoryPackage memory provides a memory broker
broker/natsPackage nats provides a NATS broker
clientPackage client is an interface for an RPC client
client/grpcPackage grpc provides a gRPC client
client/mockPackage mock provides a mock client for testing
client/mucpPackage mucp provides an mucp client
client/poolPackage pool is a connection pool
client/proto
client/selectorPackage selector is a way to pick a list of service nodes
client/selector/dnsPackage dns provides a dns SRV selector
client/selector/registryPackage registry uses the go-micro registry for selection
client/selector/routerPackage router is a network/router selector
client/selector/staticPackage static provides a static resolver which returns the name/ip passed in without any change
codecPackage codec is an interface for encoding messages
codec/bytesPackage bytes provides a bytes codec which does not encode or decode anything
codec/grpcPackage grpc provides a grpc codec
codec/jsonPackage json provides a json codec
codec/jsonrpcPackage jsonrpc provides a json-rpc 1.0 codec
codec/protoPackage proto provides a proto codec
codec/protorpcPackage proto is a generated protocol buffer package.
codec/textPackage text reads any text/* content-type
configPackage config is an interface for dynamic configuration.
config/cmdPackage cmd is an interface for parsing the command line
config/encoderPackage encoder handles source encoding formats
config/encoder/hcl
config/encoder/json
config/encoder/toml
config/encoder/xml
config/encoder/yaml
config/loaderpackage loader manages loading from multiple sources
config/loader/memory
config/optionsPackage options provides a way to initialise options
config/readerPackage reader parses change sets and provides config values
config/reader/json
config/sourcePackage source is the interface for sources
config/source/cli
config/source/consul
config/source/env
config/source/filePackage file is a file source.
config/source/flag
config/source/memoryPackage memory is a memory source
data/storePackage store is an interface for distribute data storage.
data/store/consulPackage consul is a consul implementation of kv
data/store/memoryPackage memory is a in-memory store store
debug/handler
debug/proto
errorsPackage errors provides a way to return detailed information for an RPC request error.
metadataPackage metadata is a way of defining message headers
monitorPackage monitor monitors service health
network/linkPackage link provides a measured transport.Socket link
network/proxy/grpcPackage grpc transparently forwards the grpc protocol using a go-micro client.
network/resolverPackage resolver resolves network names to addresses
network/resolver/dnsPackage dns resolves ids to dns srv records
network/resolver/httpPackage http resolves ids to network addresses using a http request
network/resolver/registryPackage registry resolves names using the go-micro registry
network/router/handler
network/router/service
network/transport/grpc/proto
network/transport/memoryPackage memory is an in-memory transport
proxyPackage proxy is a transparent proxy built on the go-micro/server
proxy/grpcPackage grpc transparently forwards the grpc protocol using a go-micro client.
proxy/httpPackage http provides a micro rpc to http proxy
proxy/mucpPackage mucp transparently forwards the incoming request using a go-micro client.
registryPackage mdns is a multicast dns registry
registry/cachePackage cache provides a registry cache
registry/consul
registry/gossipPackage gossip provides a gossip registry based on hashicorp/memberlist
registry/gossip/protoPackage gossip is a generated protocol buffer package.
registry/mdnsPackage mdns provides a multicast dns registry
registry/memoryPackage memory provides an in-memory registry
routerPackage router provides a network routing control plane
router/handler
router/proto
router/service
serverPackage server is an interface for a micro server
server/grpcPackage grpc provides a grpc server
server/grpc/proto
server/mock
server/mucpPackage mucp provides an mucp server
servicePackage service encapsulates the client, server and other interfaces to provide a complete micro service.
service/grpc
service/grpc/proto
service/mucpPackage mucp initialises a mucp service
syncPackage sync is a distributed synchronization framework
sync/eventPackage event provides a distributed log interface
sync/leaderPackage leader provides leader election
sync/leader/consul
sync/lockPackage lock provides distributed locking
sync/lock/consulPackage consul is a consul implemenation of lock
sync/taskPackage task provides an interface for distributed jobs
sync/task/brokerPackage broker provides a distributed task manager built on the micro broker
sync/task/localPackage local provides a local task runner
sync/timePackage time provides clock synchronization
sync/time/localPackage local provides a local clock
sync/time/ntpPackage ntp provides ntp synchronized time
transportPackage transport is an interface for synchronous connection based communication
transport/grpcPackage grpc provides a grpc transport
transport/grpc/proto
transport/httpPackage http returns a http2 transport using net/http
transport/memoryPackage memory is an in-memory transport
transport/quicPackage quic provides a QUIC based transport
tunnelPackage tunnel provides gre network tunnelling
tunnel/transportPackage transport provides a tunnel transport
util/addr
util/backoffPackage backoff provides backoff functionality
util/buf
util/ctx
util/file
util/grpc
util/http
util/ioPackage io is for io management
util/logPackage log is a global internal logger
util/muxPackage mux provides proxy muxing
util/net
util/socketPackage socket provides a pseudo socket
util/tls
webPackage web provides web based micro services

Package micro imports 16 packages (graph) and is imported by 316 packages. Updated 2019-08-23. Refresh now. Tools for package owners.