presenter

package
v0.0.0-...-cc58ba3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GzipCompress

func GzipCompress(w http.ResponseWriter) (http.ResponseWriter, func() error)

func OptionEquals

func OptionEquals(opt1, opt2 *Option) bool

func TestCandidateChannelHandleFunc

func TestCandidateChannelHandleFunc(t *testing.T, c CandidateChannelHandlerFunc)

func TestCandidateHandleFunc

func TestCandidateHandleFunc(t *testing.T, c CandidateHandlerFunc)

TestCandidateHandleFunc tests that a candidate encodes options correctly

func TestCandidateHandleFunc_Gzip

func TestCandidateHandleFunc_Gzip(t *testing.T, c CandidateHandlerFunc)

Types

type CandidateChannelHandlerFunc

type CandidateChannelHandlerFunc interface {
	CandidateHandlerFunc
	ChannelHandlerFunc(options <-chan *Option) (http.HandlerFunc, error)
}

type CandidateHandlerFunc

type CandidateHandlerFunc interface {
	// HandlerFunc returned must write the given options in the response body
	HandlerFunc(options []*Option) (http.HandlerFunc, error)
	// UnmarshalOptions must take the bytes of a responseBody and unmarshal them to Options
	UnmarshalOptions([]byte) ([]*Option, error)
}

CandidateHandlerFunc is the interface used to benchmark

type Logger

type Logger interface {
	Info(string)
}

func NewLogger

func NewLogger(log *log.Logger) Logger

func NewStdoutLogger

func NewStdoutLogger() Logger

type Option

easyjson:json

func JSONUnmarshalOptions

func JSONUnmarshalOptions(b []byte) ([]*Option, error)

JSONUnmarshalOptions is a valid UnmarshalOptions func for those implementations that write a JSON encoded 'Response' in the response body

func (Option) MarshalEasyJSON

func (v Option) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Option) MarshalJSON

func (v Option) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Option) UnmarshalEasyJSON

func (v *Option) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Option) UnmarshalJSON

func (v *Option) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionsGen

type OptionsGen interface {
	Gen(n int) []*Option
}

func NewOptionsGen

func NewOptionsGen() OptionsGen

type ResolveScale

type ResolveScale string

ResolveScale of fields in the graph Request low: options with 1 field medium: options with half the fields high: options with all the fields

const (
	ResolveScaleLow    ResolveScale = "low"
	ResolveScaleMedium ResolveScale = "medium"
	ResolveScaleHigh   ResolveScale = "high"
)

type Response

type Response struct {
	Data struct {
		HotelX struct {
			Search struct {
				Options []*Option `json:"options"`
				Errors  struct {
					Code        string `json:"code"`
					Type        string `json:"type"`
					Description string `json:"description"`
				} `json:"errors"`
			} `json:"search"`
		} `json:"hotelX"`
	} `json:"data"`
}
to generate a new file for EasyJson: https://github.com/mailru/easyjson:
	go run $GOPATH/src/github.com/mailru/easyjson/easyjson/main.go -all $GOPATH/src/github.com/travelgateX/presenters-benchmark/pkg/presenter/option.go

easyjson:json

func (Response) MarshalEasyJSON

func (v Response) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Response) MarshalJSON

func (v Response) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Response) UnmarshalEasyJSON

func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Response) UnmarshalJSON

func (v *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SearchGraphQLRequester

type SearchGraphQLRequester interface {
	SearchGraphQLRequest(ResolveScale) []byte
}

SearchGraphQLRequester creates a valid Search service request compliant with the schema, ResolveScale is an indicator of the number of option's fields requested

func NewSearchGraphQLRequester

func NewSearchGraphQLRequester() SearchGraphQLRequester

Directories

Path Synopsis
Code generated by easyjson for marshaling/unmarshaling.
Code generated by easyjson for marshaling/unmarshaling.

Jump to

Keyboard shortcuts

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