mock

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncQueryService

type AsyncQueryService struct {
	QueryF func(ctx context.Context, req *query.Request) (flux.Query, error)
}

AsyncQueryService mocks the idep QueryService for testing.

func (*AsyncQueryService) Query

func (s *AsyncQueryService) Query(ctx context.Context, req *query.Request) (flux.Query, error)

Query writes the results of the query request.

type ProxyQueryService

type ProxyQueryService struct {
	QueryF func(ctx context.Context, w io.Writer, req *query.ProxyRequest) (flux.Statistics, error)
}

ProxyQueryService mocks the idpe QueryService for testing.

func (*ProxyQueryService) Check

func (*ProxyQueryService) Query

Query writes the results of the query request.

type Query

type Query struct {
	Metadata flux.Metadata
	// contains filtered or unexported fields
}

Query is a mock implementation of a flux.Query. It contains controls to ensure that the flux.Query object is used correctly. Note: Query will only return one result, specified by calling the SetResults method.

func NewQuery

func NewQuery() *Query

NewQuery constructs a new asynchronous query.

func (*Query) Cancel

func (q *Query) Cancel()

Cancel closes the results channel.

func (*Query) Done

func (q *Query) Done()

func (*Query) Err

func (q *Query) Err() error

Err will return an error if one was set.

func (*Query) Results

func (q *Query) Results() <-chan flux.Result

func (*Query) SetErr

func (q *Query) SetErr(err error) *Query

func (*Query) SetResults

func (q *Query) SetResults(results flux.Result) *Query

func (*Query) Statistics

func (q *Query) Statistics() flux.Statistics

Statistics will return Statistics. Unlike the normal flux.Query, this will panic if it is called before Done.

type QueryLogger

type QueryLogger struct {
	LogFn func(query.Log) error
}

func (*QueryLogger) Log

func (l *QueryLogger) Log(log query.Log) error

type QueryService

type QueryService struct {
	QueryF func(ctx context.Context, req *query.Request) (flux.ResultIterator, error)
}

QueryService mocks the idep QueryService for testing.

func (*QueryService) Check

func (s *QueryService) Check(ctx context.Context) check.Response

func (*QueryService) Query

Query writes the results of the query request.

Jump to

Keyboard shortcuts

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