types

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: Apache-2.0 Imports: 1 Imported by: 7

Documentation

Overview

Package types provides supporting types that facilitate the various service client implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrServiceClient

func NewErrServiceClient(statusCode int, body []byte) error

NewErrServiceClient returns an instance of the error interface with ErrServiceClient as its implementation.

Types

type EndpointParams

type EndpointParams struct {
	ServiceKey  string // The key of the service as found in the service registry (e.g. Consul)
	Path        string // The path to the service's endpoint following port number in the URL
	UseRegistry bool   // An indication of whether or not endpoint information should be obtained from a service registry provider.
	Url         string // If a service registry is not being used, then provide the full URL endpoint
	Interval    int    // The interval in milliseconds governing how often the client polls to keep the endpoint current
}

EndpointParams is a type that allows for the passing of common parameters to service clients for initialization.

type ErrNotFound

type ErrNotFound struct{}

ErrNotFound represents an error returned from a service indicating the item being asked for was not found.

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type ErrResponseNil

type ErrResponseNil struct{}

ErrResponseNil represents an error returned from a service indicating the response was unexpectedly empty.

func (ErrResponseNil) Error

func (e ErrResponseNil) Error() string

type ErrServiceClient

type ErrServiceClient struct {
	StatusCode int // StatusCode contains the HTTP status code returned from the target service
	// contains filtered or unexported fields
}

ErrServiceClient exposes the details of a service's response in a more granular manner. This is useful when service A calls service B and service A needs to make a decision with regard to how it should respond to its own caller based on the error thrown from service B.

func (ErrServiceClient) Error

func (e ErrServiceClient) Error() string

Error fulfills the error interface and returns an error message assembled from the state of ErrServiceClient.

Jump to

Keyboard shortcuts

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