app

package
Version: v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package app provides app-wide data structs and functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// Set in main.go or by wrapper
	In        io.Reader // where to read user input (default: stdin)
	Out       io.Writer // where to print output (default: stdout)
	Hooks     Hooks     // for integration with other code
	Factories Factories // for integration with other code

	// Set automatically in es.Run()
	Options      config.Options // command line options (--addr, etc.)
	EntityType   string
	ReturnLabels []string // query
	Query        string   // query
	EntityId     string   // --update and --delete
	Patches      []string // --update
}

Context represents how to run es. A context is passed to es.Run(). A default context is created in main.go. Wrapper code can integrate with es by passing a custom context to es.Run(). Integration is done primarily with hooks and factories.

type EntityClientFactory

type EntityClientFactory interface {
	Make(Context) (etre.EntityClient, error)
}

type Factories

type Factories struct {
	EntityClient EntityClientFactory
}

type Hooks

type Hooks struct {
	AfterParseOptions func(*config.Options)
	BeforeQuery       func(*Context) error
	AfterQuery        func(Context, []etre.Entity, error)
	BeforeDelete      func(ctx *Context) error
	BeforeUpdate      func(cxt *Context) error
	WriteResult       func(Context, etre.WriteResult, error)
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL