dvparser

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 13 Imported by: 4

Documentation

Overview

********************************************************************** MicroCore Copyright 2020-2021 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

********************************************************************** MicroCore Copyright 2017 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

********************************************************************** MicroCore Copyright 2020 -2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

********************************************************************** MicroCore Copyright 2020 - 2021 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

Index

Constants

View Source
const (
	CONFIG_RESULT_NOT_CONTAINING_PREMAP         = 1 << iota
	CONFIG_REPLACEMENT_NOT_MANDATORY            = 1 << iota
	CONFIG_IS_NOT_ESCAPED                       = 1 << iota
	CONFIG_IS_NOT_VARIABLES                     = 1 << iota
	CONFIG_DISABLE_INITIAL_MAP_FROM_ENVIRONMENT = 1 << iota
	CONFIG_PRESERVE_SPACE                       = 1 << iota
)
View Source
const (
	IFELSE_ELSE_NOTRUN = 0
	IFELSE_ELSE_RUN    = 1
	IFELSE_ELSE_NOMORE = 2
	IFELSE_ELSE_ERROR  = 3
	IFELSE_LOW_MASK    = 7
	IFELSE_CONSUMED    = 16
	IFELSE_NONEWIF     = 8
)

Variables

View Source
var DvParserLog bool = false
View Source
var GeneralFilePaths []string
View Source
var GeneralMicroCoreFolderIndex int = -1
View Source
var GeneralNamespaceFolderIndex int = -1
View Source
var GlobalProperties map[string]string
View Source
var GlobalPropertiesAsDvObject *dvevaluation.DvObject
View Source
var IsDevelopmentVar = "IS_DEVELOPMENT"
View Source
var MicroCorePathSuffix = "PATH"
View Source
var MicroCorePrexix = "MICROCORE_"
View Source
var MicroCorePropertiesInCurrentFolderFileName = "MicroCore.properties"

MicroCorePropertiesInCurrentFolderFileName is a main property file name, which can be customized

View Source
var NumberOfBracketsInConfigParsing = 3

Functions

func ByteArrayEvaluatorAsInterface

func ByteArrayEvaluatorAsInterface(data []byte, extraParams *dvevaluation.DvObject, source string) (interface{}, error)

func CallInitBySettingFunc

func CallInitBySettingFunc(parameters map[string]string, functionPool map[string]interface{})

func CallInitBySettingFuncDefault

func CallInitBySettingFuncDefault()

func CleanLogByteArray

func CleanLogByteArray(data []byte) string

func CleanLogString

func CleanLogString(data string) string

func CloneGlobalProperties

func CloneGlobalProperties() map[string]string

func ConvertByteArrayByGlobalProperties

func ConvertByteArrayByGlobalProperties(data []byte, sourceName string) (res string, err error)

func ConvertByteArrayByGlobalPropertiesInByteLines

func ConvertByteArrayByGlobalPropertiesInByteLines(data []byte, sourceName string) (res [][]byte, err error)

func ConvertByteArrayByGlobalPropertiesInStringLines

func ConvertByteArrayByGlobalPropertiesInStringLines(data []byte, sourceName string) (res []string, err error)

func ConvertByteArrayByGlobalPropertiesRuntime

func ConvertByteArrayByGlobalPropertiesRuntime(data []byte, sourceName string) (res string, err error)

func ConvertByteArrayBySpecificProperties

func ConvertByteArrayBySpecificProperties(data []byte, sourceName string, properties map[string]string, numberOfBrackets int, configOptions int) ([]byte, error)

func ConvertByteArrayBySpecificPropertiesInLines

func ConvertByteArrayBySpecificPropertiesInLines(data []byte, sourceName string, properties map[string]string, numberOfBrackets int, configOptions int) ([][]byte, error)

func ConvertFileByGlobalProperties

func ConvertFileByGlobalProperties(fileName string) ([]byte, error)

func ConvertStringArrayByGlobalProperties

func ConvertStringArrayByGlobalProperties(data []string, sourceName string) (res []string, err error)

func ConvertStringByGlobalProperties

func ConvertStringByGlobalProperties(data string, sourceName string) (string, error)

func CopyInterfaceMapToStringMap added in v1.0.2

func CopyInterfaceMapToStringMap(src map[string]interface{}, dst map[string]string)

func ExtractFromBufByBeforeAfterKeys

func ExtractFromBufByBeforeAfterKeys(data []byte, before []byte, after []byte) (res []byte, status int)

func FindEol

func FindEol(data []byte) int

func FindInGeneralPaths

func FindInGeneralPaths(name string) string

func FindSubStringSmartInByteArray

func FindSubStringSmartInByteArray(data []byte, needle []byte) (int, int)

func GetByGlobalPropertiesOrDefault

func GetByGlobalPropertiesOrDefault(propName, defValue string) string

func GetCommandLine

func GetCommandLine() []string

func GetGlobalPropertiesAsDvObject

func GetGlobalPropertiesAsDvObject() *dvevaluation.DvObject

func GetPropertiesPrototypedToGlobalProperties added in v1.0.2

func GetPropertiesPrototypedToGlobalProperties(localMap map[string]interface{}) *dvevaluation.DvObject

func InitAndReadCommandLine

func InitAndReadCommandLine() []string

func IsDevelopment added in v1.0.2

func IsDevelopment() bool

func JoinStringsWithClean

func JoinStringsWithClean(data []string) []byte

func LinearSmartConfigFromEnvironment

func LinearSmartConfigFromEnvironment() map[string]string

func LinearSmartConfigFromFile

func LinearSmartConfigFromFile(fileName string, configInfo *ConfigInfo, level int)

************************************************************************* level = -1 if even missing the file is not a problem

>= 0 start looking the file from paths configInfo.FilePaths[level] and up

**************************************************************************

func LinearSmartConfigParse

func LinearSmartConfigParse(data []byte, configInfo *ConfigInfo, sourceName string)

func LogVariables

func LogVariables(name string, vars map[string]string)

func ReadGlobalPropertiesAny added in v1.0.2

func ReadGlobalPropertiesAny(key string) (interface{}, bool)

func ReadPropertiesFileWithEnvironmentVariables

func ReadPropertiesFileWithEnvironmentVariables(currentDir string, propertiesName string, setFilePaths func() error) error

func ReadPropertiesFileWithEnvironmentVariablesInCurrentDirectory

func ReadPropertiesFileWithEnvironmentVariablesInCurrentDirectory(propertiesName string) error

func ReadPropertiesInEnvironment

func ReadPropertiesInEnvironment(name string) map[string]string

func ReadPropertiesOrPanic

func ReadPropertiesOrPanic(name string) map[string]string

func RegisterInitBySettingFunc

func RegisterInitBySettingFunc(initializer InitBySettingFunc) bool

func RemoveGlobalPropertiesValue

func RemoveGlobalPropertiesValue(key string)

func ReplaceTextInsideByteArray

func ReplaceTextInsideByteArray(data []byte, start int, end int, replacement []byte) []byte

func SetGlobalPropertiesAnyValue added in v1.0.2

func SetGlobalPropertiesAnyValue(key string, value interface{})

func SetGlobalPropertiesValue

func SetGlobalPropertiesValue(key string, value string)

func SetMicroCorePrefix

func SetMicroCorePrefix(prefix string)

func SetNumberOfBracketsInConfigParsing

func SetNumberOfBracketsInConfigParsing(n int)

func SetPrefixesByApplicationName

func SetPrefixesByApplicationName(name string)

SetPrefixesByApplicationName must be called at start of the application to customize prefixes and property file names

func SmartReadFileAsString

func SmartReadFileAsString(fileName string) (string, error)

func SmartReadLikeJsonTemplate added in v1.0.2

func SmartReadLikeJsonTemplate(filename string, numberOfBrackets int, params *dvevaluation.DvObject) ([]byte, error)

func SmartReadTemplate

func SmartReadTemplate(filename string, numberOfBrackets int, joiner byte) ([]byte, error)

func SmartReadTemplateLines

func SmartReadTemplateLines(fileName string, numberOfBrackets int, properties *dvevaluation.DvObject) (lines [][]byte, err error, lastOutputMap map[string]string)

func StringEvaluatorAsBoolean

func StringEvaluatorAsBoolean(data string, extraParams *dvevaluation.DvObject) (bool, error)

func StringEvaluatorAsBooleanWithErrorLoggedAsWarning

func StringEvaluatorAsBooleanWithErrorLoggedAsWarning(data string, extraParams *dvevaluation.DvObject, defaultIfError bool) bool

func StringEvaluatorAsString

func StringEvaluatorAsString(data string, extraParams *dvevaluation.DvObject) (string, error)

func StringEvaluatorAsStringWithErrorLoggedAsWarning

func StringEvaluatorAsStringWithErrorLoggedAsWarning(data string, extraParams *dvevaluation.DvObject, defaultIfError string) string

Types

type ConfigInfo

type ConfigInfo struct {
	NumberOfBrackets int
	ParamMap         *dvevaluation.DvObject
	Options          int
	OutputLines      [][]byte
	Err              error
	FilePaths        []string
	// contains filtered or unexported fields
}

type InitBySettingFunc

type InitBySettingFunc func(parameters map[string]string, functionPool map[string]interface{})

Jump to

Keyboard shortcuts

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