micro

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 13 Imported by: 3

README

Koverto - Micro

Go Go Report Card

Wraps go-micro as a base for gRPC server microservices.

Copyright © 2020 Jesse B. Hannah. Licensed under the GNU GPL version 3 or later.

Documentation

Overview

Package micro is a wrapper package for common features of microservices based on the go-micro framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithRequestID

func ContextWithRequestID(ctx context.Context, rid *uuid.UUID) context.Context

ContextWithRequestID returns a context.Context based on the provided context and containing the provided *uuid.UUID representing a request ID.

func RequestIDFromContext

func RequestIDFromContext(ctx context.Context) (*uuid.UUID, bool)

RequestIDFromContext extracts the *uuid.UUID representing the request ID from the provided context.Context.

Types

type Client

type Client interface {
	Name() string
}

Client is a wrapper interface for Micro clients.

type ClientSet

type ClientSet struct {
	// contains filtered or unexported fields
}

ClientSet is a container for multiple clients used by a Service.

func NewClientSet

func NewClientSet(clients ...Client) *ClientSet

NewClientSet creates a new ClientSet with the given clients.

func (*ClientSet) AddClient

func (c *ClientSet) AddClient(clients ...Client)

AddClient adds a client to a ClientSet.

func (*ClientSet) Get

func (c *ClientSet) Get(key string) Client

Get returns the Client for a given Service name.

func (*ClientSet) Keys

func (c *ClientSet) Keys() []string

Keys returns the service names of clients in the ClientSet.

func (*ClientSet) Length

func (c *ClientSet) Length() int

Length returns the number of clients in the ClientSet.

type Service

type Service struct {
	micro.Service
	Name string
}

Service represents a microservice definition.

func NewService

func NewService(name string, conf interface{}, sources ...source.Source) (*Service, error)

NewService initializes a new microservice instance with the given identifier (e.g. com.example.svc.greeter), and given a configuration struct containing default values, loads configuration values from the given sources into the struct.

Jump to

Keyboard shortcuts

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