entity

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateOptionsMissingKey TemplateOptionsKey = "missingkey"

	MissingKeyDefault MissingKeyValue = "default"
	MissingKeyInvalid MissingKeyValue = "invalid"
	MissingKeyZero    MissingKeyValue = "zero"
	MissingKeyError   MissingKeyValue = "error"

	Space      = " "
	Empty      = ""
	Dash       = "-"
	Dot        = "."
	Comma      = ","
	EqualsSign = "="
	LessThan   = "<"
	Tilda      = "~"
	Astrix     = "*"
	NewLine    = "\n"

	LogSliceSep = Comma + Space
)

Variables

View Source
var (
	TemplateFnsMap = map[string]any{
		"random":  func() any { return RandomFn{} },
		"slice":   func() any { return SliceFn{} },
		"strings": func() any { return StringsFn{} },
	}
)

Functions

func MergeKeys added in v0.0.5

func MergeKeys(dst, src map[string]any) map[string]any

func NotNilValues added in v0.0.6

func NotNilValues(values ...any) int

func SliceSet added in v0.1.6

func SliceSet[T comparable](in []T) map[T]struct{}

func Unique added in v0.0.3

func Unique[T comparable](in []T) []T

Types

type Command

type Command struct {
	Cmd  string
	Args []string
	Dir  string
}

type DataFile added in v0.0.2

type DataFile struct {
	FileInfo
	Data []byte
}

type DirStrategy added in v0.1.1

type DirStrategy interface {
	Apply(path string) (string, error)
}

type Executor added in v0.0.11

type Executor interface {
	Exec() error
}

type FileInfo added in v0.0.11

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

func NewFileInfo added in v0.0.13

func NewFileInfo(path string) FileInfo

func (*FileInfo) Dir added in v0.0.11

func (f *FileInfo) Dir() string

func (*FileInfo) Name added in v0.0.11

func (f *FileInfo) Name() string

func (*FileInfo) Path added in v0.0.11

func (f *FileInfo) Path() string

type FileProducer

type FileProducer interface {
	Get() (DataFile, error)
}

type FileStrategy added in v0.1.1

type FileStrategy interface {
	Apply(file DataFile) (DataFile, error)
}

type HTTPClientParams added in v0.0.6

type HTTPClientParams struct {
	URL         string
	Headers     map[string]string
	QueryParams map[string]string
}

type LocalFile added in v0.0.2

type LocalFile struct {
	FileInfo
	LocalPath string
}

type Logger

type Logger interface {
	Infof(format string, args ...any)
	Errorf(format string, any ...any)
	Warnf(format string, any ...any)
	Debugf(format string, any ...any)
	Fatalf(format string, any ...any)
}

type LoggerWrapper added in v0.1.3

type LoggerWrapper interface {
	Logger
	ForceInfof(format string, args ...any)
	Sync() error
}

type MissingKeyValue added in v0.0.11

type MissingKeyValue string

func (MissingKeyValue) Valid added in v0.0.11

func (v MissingKeyValue) Valid() error

type Preprocessor added in v0.0.11

type Preprocessor interface {
	Process() error
}

type RandomFn added in v0.0.10

type RandomFn struct{}

RandomFn has to generate random string value

func (RandomFn) ASCII added in v0.1.0

func (RandomFn) ASCII(n int) string

ASCII Generates a random string of a desired length, containing the set of printable characters from the 7-bit ASCII set. This includes space (’ ‘), but no other whitespace character

func (RandomFn) Alpha added in v0.0.10

func (RandomFn) Alpha(n int) string

Alpha Generates a random alphabetical (A-Z, a-z) string of a desired length.

func (RandomFn) AlphaNum added in v0.0.10

func (RandomFn) AlphaNum(n int) string

AlphaNum Generates a random alphanumeric (0-9, A-Z, a-z) string of a desired length.

func (RandomFn) Num added in v0.1.4

func (RandomFn) Num(n int) string

Num Generates a random numeric (0-9) string of a desired length.

type RegexpChain added in v0.0.6

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

func NewRegexpChain added in v0.0.6

func NewRegexpChain(regexps ...string) *RegexpChain

func (*RegexpChain) MatchString added in v0.0.6

func (c *RegexpChain) MatchString(s string) bool

type RemoteFile

type RemoteFile struct {
	FileInfo
	HTTPClientParams
}

type RmStrategy added in v0.1.7

type RmStrategy interface {
	Apply(path string) error
}

type SliceFn added in v0.1.6

type SliceFn struct{}

func (SliceFn) Append added in v0.1.6

func (sfn SliceFn) Append(s []any, elems ...any) []any

func (SliceFn) New added in v0.1.6

func (sfn SliceFn) New(elems ...any) []any

type StringsFn added in v0.1.6

type StringsFn struct{}

func (StringsFn) Replace added in v0.1.6

func (sfn StringsFn) Replace(input, from, to string, n int) string

type TemplateOptionsKey added in v0.0.11

type TemplateOptionsKey string

type TemplateProc added in v0.0.13

type TemplateProc interface {
	Process(name, text string) (string, error)
}

type TmplProc added in v0.0.13

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

func NewTemplateProc added in v0.0.13

func NewTemplateProc(
	templateData,
	templateFns map[string]any,
	templateOptions []string) *TmplProc

func (*TmplProc) Process added in v0.0.13

func (p *TmplProc) Process(name, text string) (string, error)

Jump to

Keyboard shortcuts

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