client

package
v0.0.0-...-f0f27be Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyValueExpected = errors.New("key/value expected")
	UnknownCommand   = errors.New("unknown command")
)

Functions

This section is empty.

Types

type Executor

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

Executor is and executor of the commands, provided as text

func NewExecutor

func NewExecutor(inputFile *os.File, sqsClient *sqs.Client, queueUrl string) *Executor

NewExecutor creates new executor

func (*Executor) ExecuteCmd

func (e *Executor) ExecuteCmd(ctx context.Context, line string) error

ExecuteCmd executes command

type Processor

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

Processor processes stream of incoming commands

func NewProcessor

func NewProcessor(lines chan string, executor *Executor, responder Responder) *Processor

NewProcessor creates new Processor

func (*Processor) Run

func (p *Processor) Run(ctx context.Context)

Run starts processing loop

type Responder

type Responder interface {
	// Error reports an error
	Error(err error)
	// Ok reports success
	Ok()
	// Bye reports shutdown
	Bye()
	// Help shows help
	Help()
}

Responder is responsible for providing feedback on command execution

func NewBatchResponder

func NewBatchResponder() Responder

NewBatchResponder returns new batch responder, used when input taken from file

func NewInteractiveResponder

func NewInteractiveResponder() Responder

NewInteractiveResponder returns new interactive responder, used when input taken from stdin

Jump to

Keyboard shortcuts

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