placeholder

package
v28.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MissingPlaceholdersError

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

MissingPlaceholdersError is used as an error when a source file is missing placeholder.

func (*MissingPlaceholdersError) Error

func (e *MissingPlaceholdersError) Error() string

Error implements error interface.

func (*MissingPlaceholdersError) Is

func (e *MissingPlaceholdersError) Is(err error) bool

Is true if both errors have the same list of missing placeholders.

func (*MissingPlaceholdersError) ValidationInfo

func (e *MissingPlaceholdersError) ValidationInfo() string

ValidationInfo implements validation.Error interface.

type Option

type Option func(*Tracer)

Option for configuring session.

func WithAdditionalInfo

func WithAdditionalInfo(info string) Option

WithAdditionalInfo will append info to the validation error.

type Replacer

type Replacer interface {
	Replace(content, placeholder, replacement string) string
	ReplaceAll(content, placeholder, replacement string) string
	ReplaceOnce(content, placeholder, replacement string) string
	AppendMiscError(miscError string)
}

type Tracer

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

Tracer keeps track of missing placeholders or other issues related to file modification.

func New

func New(opts ...Option) *Tracer

New instantiates Session with provided options.

func (*Tracer) AppendMiscError

func (t *Tracer) AppendMiscError(miscError string)

AppendMiscError allows to track errors not related to missing placeholders during file modification.

func (*Tracer) Err

func (t *Tracer) Err() error

Err if any of the placeholders were missing during execution.

func (*Tracer) Replace

func (t *Tracer) Replace(content, placeholder, replacement string) string

Replace placeholder in content with replacement string once.

func (*Tracer) ReplaceAll

func (t *Tracer) ReplaceAll(content, placeholder, replacement string) string

ReplaceAll replace all placeholders in content with replacement string.

func (*Tracer) ReplaceOnce

func (t *Tracer) ReplaceOnce(content, placeholder, replacement string) string

ReplaceOnce will replace placeholder in content only if replacement is not already found in content.

type ValidationMiscError

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

ValidationMiscError is used as a miscellaneous error related to validation.

func (*ValidationMiscError) Error

func (e *ValidationMiscError) Error() string

Error implements error interface.

func (*ValidationMiscError) ValidationInfo

func (e *ValidationMiscError) ValidationInfo() string

ValidationInfo implements validation.Error interface.

Jump to

Keyboard shortcuts

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