ioutil

package
v1.4.14 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorDefinition

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

ErrorDefinition defines an error by a regular expression and its error code.

func NewErrorDefinition

func NewErrorDefinition(pattern string) *ErrorDefinition

type FileCreator

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

FileCreator is a tool for: - building a buffer file - running a command with the file - handling errors in the file

func NewFileCreator

func NewFileCreator(ioShim *common.IOShim, maxTryCount int, lineFailurePatterns ...string) *FileCreator

func (*FileCreator) AddErrorToRetryOn

func (creator *FileCreator) AddErrorToRetryOn(definition *ErrorDefinition)

func (*FileCreator) AddLine

func (creator *FileCreator) AddLine(sectionID string, errorHandlers []*LineErrorHandler, items ...string)

func (*FileCreator) RunCommandOnceWithFile

func (creator *FileCreator) RunCommandOnceWithFile(cmd string, args ...string) (bool, error)

RunCommandOnceWithFile runs the command with the file once and increments the try count. It returns whether the file was altered and any error. For automatic retrying and proper logging, use RunCommandWithFile. This method can be used for external testing of file creator contents after each run.

func (*FileCreator) RunCommandWithFile

func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error

func (*FileCreator) ToString

func (creator *FileCreator) ToString() string

ToString combines the lines in the FileCreator and ends with a new line.

type Line

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

Line defines the content, section, and error handlers for a line

type LineErrorHandler

type LineErrorHandler struct {
	Definition *ErrorDefinition
	Method     LineErrorHandlerMethod
	Reason     string
	Callback   func()
}

LineErrorHandler defines an error and how to handle it

type LineErrorHandlerMethod

type LineErrorHandlerMethod string

LineErrorHandlerMethod defines behavior when an error occurs

const (
	SkipLine     LineErrorHandlerMethod = "skip"
	AbortSection LineErrorHandlerMethod = "abort"
)

possible LineErrorHandlerMethod

type Section

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

Section is a logically connected components (not necessarily adjacent lines)

Jump to

Keyboard shortcuts

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