commands

package
v0.0.0-...-78871ee Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 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 Command

type Command interface {
	ExecuteWith(uow UnitOfWork) error
}

Command represents a command that can be executed.

type IndexDocCommand

type IndexDocCommand struct {
	Doc   string // The document to index.
	Index string // The name of the index or data stream to index the document in.
}

IndexDocCommand represents a command to index a document in Elasticsearch.

func (IndexDocCommand) ExecuteWith

func (c IndexDocCommand) ExecuteWith(uow UnitOfWork) error

ExecuteWith executes the command with the given unit of work.

type Runner

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

Runner is a command runner.

func NewRunner

func NewRunner() (*Runner, error)

NewRunner creates a new runner that can execute commands.

func (Runner) Run

func (r Runner) Run(command Command) error

Run executes the given command.

type UnitOfWork

type UnitOfWork struct {
	Client *elasticsearch.Client
}

UnitOfWork is contains the dependencies needed to execute commands.

type VersionCommand

type VersionCommand struct{}

func (VersionCommand) ExecuteWith

func (c VersionCommand) ExecuteWith(uow UnitOfWork) error

type VersionResult

type VersionResult struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
	BuiltBy string `json:"built_by"`
}

func (VersionResult) Data

func (r VersionResult) Data() interface{}

func (VersionResult) String

func (r VersionResult) String() string

Jump to

Keyboard shortcuts

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