Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDirUnlessExists(path string)
- func Decompress(fileName string) (string, error)
- func DeleteFile(fileName string) error
- func DiskUsage(path string, checkSize uint64) float64
- func DoCmd(command string, arg ...string) error
- func EnsureFileSave(fileName string)
- func EnvSetBoolIfSet(name string, value *bool)
- func EnvSetIfSet(name string, value *string)
- func EnvSetIntIfSet(name string, value *int64)
- func Exists(path string) bool
- func FileToReader(fileName string) (io.Reader, error)
- func GetEnvBoolOverrideFlag(currValue bool, flagName string) bool
- func GetEnvIntUnlessFlagIsNotDefault(envVar string, defaultValue, flagValue, flagDefaultValue int) int
- func GetEnvUnlessFlagIsNotDefault(envVar, defaultValue, flagValue, flagDefaultValue string) string
- func Hostname() string
- func IsDirectory(path string) bool
- func IsTextData(data []byte) bool
- func IsTextFile(fileName string) (bool, error)
- func ParseNames(input string) []string
- func WriteHeapFile(fileName string) error
- type AtomicIntCounter
- type CliOption
- func (c *CliOption) GetBool(name string) bool
- func (c *CliOption) GetInt(name string) int
- func (c *CliOption) GetString(name string) string
- func (c *CliOption) MakeBool(key, short, envName string, defaultValue bool, description string)
- func (c *CliOption) MakeInt(key, short, envName string, defaultValue int, description string)
- func (c *CliOption) MakeString(key, short, envName, defaultValue, description string)
- func (c *CliOption) ReadConfig() error
- func (c *CliOption) ReadTomlConfigFile(configFolder, fileName string) error
- func (c *CliOption) Viper() *viper.Viper
- type ConfigCheck
- type FsWatcher
- type ParlyDb
- type Store
- func (store *Store) Close() error
- func (store *Store) CreateBucket(bucket string) error
- func (store *Store) Delete(bucket string, key string) error
- func (store *Store) ForEach(bucket string, fn func(k, v []byte) error) error
- func (store *Store) Get(bucket, key string, value *string) error
- func (store *Store) GetDB() *bolt.DB
- func (store *Store) ListBucket(bucket string, filter func(k, v string) (bool, error)) ([]string, error)
- func (store *Store) ListBuckets() ([]string, error)
- func (store *Store) Put(bucket string, key string, value string) error
- type TimerData
- func (timer *TimerData) BatchDuractionSeconds() int64
- func (timer *TimerData) IncError() int64
- func (timer *TimerData) LogFields() log.Fields
- func (timer *TimerData) ShowBatchTime()
- func (timer *TimerData) ShowTotalDuration()
- func (timer *TimerData) Start()
- func (timer *TimerData) Stop() time.Time
- func (timer *TimerData) Tick()
- func (timer *TimerData) TickBatch(cnt int)
- func (timer *TimerData) TotalDuractionSeconds() int64
- func (timer *TimerData) TotalDuration() time.Duration
- type WaitGroup
Constants ¶
const VERSION = "0.14.5"
VERSION of the application
Variables ¶
var ( // ErrNotFound error key not found ErrNotFound = errors.New("store: key not found") // ErrBadValue error bad value ErrBadValue = errors.New("store: bad value") )
Functions ¶
func CreateDirUnlessExists ¶
func CreateDirUnlessExists(path string)
CreateDirUnlessExists creates a directory if to do not exist
func Decompress ¶
Decompress decompresses a file using os utility gzip
func EnsureFileSave ¶
func EnsureFileSave(fileName string)
EnsureFileSave creates directory unless exists for a given file
func EnvSetBoolIfSet ¶
EnvSetBoolIfSet sets boolean variable if environment variable is set and contains a valid entry
func EnvSetIfSet ¶
EnvSetIfSet updates variable with value if os env exists
func EnvSetIntIfSet ¶
EnvSetIntIfSet updates int variable if environment variable exists
func FileToReader ¶
FileToReader gets a buffered reader from a fileName
func GetEnvBoolOverrideFlag ¶
GetEnvBoolOverrideFlag if environment flag is set to 1 it returns true
func GetEnvIntUnlessFlagIsNotDefault ¶
func GetEnvIntUnlessFlagIsNotDefault(envVar string, defaultValue, flagValue, flagDefaultValue int) int
GetEnvIntUnlessFlagIsNotDefault Getting INT env variable unless flagvalue differs from defaultvalue
func GetEnvUnlessFlagIsNotDefault ¶
GetEnvUnlessFlagIsNotDefault Getting String env variable unless flagvalue differs from defaultvalue
func Hostname ¶
func Hostname() string
Hostname returns primary env HOST_HOSTNAME secondary os.Hostname
func IsTextFile ¶
IsTextFile tells if a file is a text file
func ParseNames ¶
ParseNames splits a input string on , trimsspaces and removes all prefixed with # Makes it easier to use list values as (multipline) input params
func WriteHeapFile ¶
WriteHeapFile dumps memory allocation to disc for analytics
Types ¶
type CliOption ¶
type CliOption struct {
// contains filtered or unexported fields
}
CliOption encapsulates viper flag and values
func NewCliOption ¶
NewCliOption creates a new cli option object
func (*CliOption) MakeBool ¶
MakeBool creates a application bool variable both for env and command line
func (*CliOption) MakeInt ¶
MakeInt creates a application int variable both for env and command line
func (*CliOption) MakeString ¶
MakeString creates a application string variable both for env and command line
func (*CliOption) ReadConfig ¶
ReadConfig reads and parses the config options set
func (*CliOption) ReadTomlConfigFile ¶
ReadTomlConfigFile reads config file from a given folder
type ConfigCheck ¶
type ConfigCheck struct {
// contains filtered or unexported fields
}
func (*ConfigCheck) AddIfEmptyStr ¶
func (c *ConfigCheck) AddIfEmptyStr(title, value string)
func (*ConfigCheck) TerminateIfErrors ¶
func (c *ConfigCheck) TerminateIfErrors()
type FsWatcher ¶
type FsWatcher struct {
// contains filtered or unexported fields
}
FsWatcher monitors a given monPath, checks for file updates every pollDur and declares them stable if no updates are detected after stableDur.
type ParlyDb ¶
ParlyDb handles prosessed files
func NewParlyDb ¶
NewParlyDb constructs a new struct to handle file proessesing
func (*ParlyDb) IsProsessed ¶
IsProsessed - Checks if a file is already prosessed
func (*ParlyDb) ReadLines ¶
ReadLines reads a whole file into memory and returns a slice of its lines.
func (*ParlyDb) WriteLines ¶
WriteLines writes the lines to the given file.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is db abstarction on top of bolt db
func (*Store) CreateBucket ¶
CreateBucket creates a buck
func (*Store) Delete ¶
Delete the entry with the given key. If no such key is present in the store, it returns ErrNotFound.
store.Delete("key42")
func (*Store) ListBucket ¶
func (store *Store) ListBucket(bucket string, filter func(k, v string) (bool, error)) ([]string, error)
ListBucket lists all buckets
func (*Store) ListBuckets ¶
ListBuckets lists all buckets
type TimerData ¶
type TimerData struct { Title string Uuid string StartTimeRun time.Time StartTimeBatch time.Time EndTimeRun time.Time BatchSize int64 PrevRows int64 Index AtomicIntCounter ErrorCount AtomicIntCounter Logger *log.Entry // contains filtered or unexported fields }
TimerData containes run time data
func (*TimerData) BatchDuractionSeconds ¶
BatchDuractionSeconds returns durection in seconds
func (*TimerData) ShowBatchTime ¶
func (timer *TimerData) ShowBatchTime()
ShowBatchTime show averages to now
func (*TimerData) ShowTotalDuration ¶
func (timer *TimerData) ShowTotalDuration()
ShowTotalDuration outputs duration to log with fields
func (*TimerData) TotalDuractionSeconds ¶
TotalDuractionSeconds returns total duration in seconds
func (*TimerData) TotalDuration ¶
TotalDuration returns duration as a time.Duration