gateway

package
v0.0.0-...-194d0c4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownOneofFieldName = errors.New("unknown oneof field name")
	ErrUnknownEnumName       = errors.New("unknown enum name")
	EORF                     = errors.New("end of repeated field")
)
View Source
var NewRealPrompter = func(executor func(string), completer func(prompt.Document) []prompt.Suggest, opt ...prompt.Option) Prompter {
	if executor == nil {
		executor = func(in string) {
			return
		}
	}
	if completer == nil {
		completer = func(d prompt.Document) []prompt.Suggest {
			return nil
		}
	}
	p := &RealPrompter{}
	p.fieldPrompter = prompt.New(
		executor,
		completer,
		append(opt,
			prompt.OptionLivePrefix(p.livePrefix),
			prompt.OptionAddKeyBind(prompt.KeyBind{
				Key: prompt.Enter,
				Fn: func(_ *prompt.Buffer) {
					p.entered = true
				},
			}),
		)...)
	return p
}

NewRealPrompter instantiates a prompt which satisfied Prompter with go-prompt. NewRealPrompter will be replace by a mock when e2e testing.

NewRealPrompter is called to create REPL-CLI and REPL field inputter. NewPrompt is the short-hand method to create *Prompt with no params NewRealPrompter.

Functions

This section is empty.

Types

type DynamicBuilder

type DynamicBuilder struct{}

func NewDynamicBuilder

func NewDynamicBuilder() *DynamicBuilder

func (*DynamicBuilder) NewMessage

func (b *DynamicBuilder) NewMessage(m entity.Message) proto.Message

type GRPCClient

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

func NewGRPCClient

func NewGRPCClient(config *config.Config) (*GRPCClient, error)

func (*GRPCClient) Close

func (c *GRPCClient) Close(ctx context.Context) error

func (*GRPCClient) Invoke

func (c *GRPCClient) Invoke(ctx context.Context, fqrn string, req, res interface{}) error

func (GRPCClient) ListServices

func (c GRPCClient) ListServices() ([]entity.Service, error)

func (*GRPCClient) NewBidiStream

func (c *GRPCClient) NewBidiStream(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error)

func (*GRPCClient) NewClientStream

func (c *GRPCClient) NewClientStream(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error)

func (*GRPCClient) NewServerStream

func (c *GRPCClient) NewServerStream(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error)

func (GRPCClient) ReflectionEnabled

func (c GRPCClient) ReflectionEnabled() bool

type JSONFileInputter

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

func NewJSONFileInputter

func NewJSONFileInputter(in io.Reader) *JSONFileInputter

func (*JSONFileInputter) Input

func (i *JSONFileInputter) Input(reqType entity.Message) (proto.Message, error)

type Prompt

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

Prompt is an implementation of inputting method. it has common logic to input fields interactively. in normal, go-prompt is used as prompt.

func NewPrompt

func NewPrompt(config *config.Config, env entity.Environment) *Prompt

NewPrompt instantiates new *Prompt with NewRealPrompter.

func (*Prompt) Input

func (i *Prompt) Input(reqType entity.Message) (proto.Message, error)

Input is an implementation of port.Inputter

type Prompter

type Prompter interface {
	// Run is called from REPL input prompter
	Run()

	Input() (string, error)
	Select(msg string, opts []string) (string, error)
	SetPrefix(prefix string)
	SetPrefixColor(color color.Color) error
}

Prompter represents prompter which display inputters or selectors.

type RealPrompter

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

func (*RealPrompter) Input

func (p *RealPrompter) Input() (string, error)

func (*RealPrompter) Run

func (p *RealPrompter) Run()

func (*RealPrompter) Select

func (p *RealPrompter) Select(msg string, opts []string) (string, error)

func (*RealPrompter) SetPrefix

func (p *RealPrompter) SetPrefix(prefix string)

func (*RealPrompter) SetPrefixColor

func (p *RealPrompter) SetPrefixColor(color color.Color) error

Jump to

Keyboard shortcuts

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