client

package
v2.0.0-alpha.3+incompa... Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CallFunction(name string, query string, payload []byte) ([]byte, error)
}

Client defines an interface for a function client

type ClientMock

type ClientMock struct {
	// CallFunctionFunc mocks the CallFunction method.
	CallFunctionFunc func(name string, query string, payload []byte) ([]byte, error)
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of Client.

    func TestSomethingThatUsesClient(t *testing.T) {

        // make and configure a mocked Client
        mockedClient := &ClientMock{
            CallFunctionFunc: func(name string, query string, payload []byte) ([]byte, error) {
	               panic("TODO: mock out the CallFunction method")
            },
        }

        // TODO: use mockedClient in code that requires Client
        //       and then make assertions.

    }

func (*ClientMock) CallFunction

func (mock *ClientMock) CallFunction(name string, query string, payload []byte) ([]byte, error)

CallFunction calls CallFunctionFunc.

func (*ClientMock) CallFunctionCalls

func (mock *ClientMock) CallFunctionCalls() []struct {
	Name    string
	Query   string
	Payload []byte
}

CallFunctionCalls gets all the calls that were made to CallFunction. Check the length with:

len(mockedClient.CallFunctionCalls())

type Impl

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

Impl is a simple client for calling functions

func NewClient

func NewClient(gateway string, stats *statsd.Client, logger hclog.Logger) *Impl

NewClient creates a new client

func (*Impl) CallFunction

func (c *Impl) CallFunction(name string, query string, payload []byte) ([]byte, error)

CallFunction calls the function and returns the response

Jump to

Keyboard shortcuts

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