Documentation
¶
Index ¶
- Variables
- func CreateFileFolders(path string, perm os.FileMode) error
- func DeleteFile(path string) error
- func DeleteOrTruncateFile(path string) error
- func ExistsFile(path string) bool
- func FindFilesIn(path string, recursive bool, searchText string) []string
- func FromJsonCode(jsonCode string, itf interface{}) (interface{}, error)
- func FromJsonFile(path string, itf interface{}) (interface{}, error)
- func FromXmlCode(xmlCode string, itf interface{}) (interface{}, error)
- func FromXmlFile(path string, itf interface{}) (interface{}, error)
- func FromYamlCode(yamlCode string, itf interface{}) (interface{}, error)
- func FromYamlFile(path string, itf interface{}) (interface{}, error)
- func GetCurrentFolder() string
- func GetFiles(path string, recursive bool) []string
- func GetMatchedFiles(path string, recursive bool, matcher func(string) bool) []string
- func GetPathSeparator() string
- func IsFolder(path string) bool
- func Marshall(itf interface{}, format ParserFormat) ([]byte, error)
- func MarshallTo(itf interface{}, filePath string, format ParserFormat) error
- func ToJson(itf interface{}) (string, error)
- func ToXml(itf interface{}) (string, error)
- func ToYaml(itf interface{}) (string, error)
- func Unmashall(code []byte, itf interface{}, format ParserFormat) (interface{}, error)
- func UnmashallFrom(filePath string, itf interface{}, format ParserFormat) (interface{}, error)
- type FormatParser
- type ParserFormat
- type ParserPlugin
- type PluginsCollector
Constants ¶
This section is empty.
Variables ¶
var DefaultLibraryExtension string = common.GetShareLibExt()
var DefaultPluginsFolder string = common.GetCurrentPath() + string(os.PathListSeparator) + "modules"
Functions ¶
func CreateFileFolders ¶
Delete a file or folder, within all sub items
func DeleteOrTruncateFile ¶
Delete a file (or truncate in case not suitable or delete folder, within all sub items
func FindFilesIn ¶
Finds files recursively or not, in a given path folder, with a file name prefix token
func FromJsonCode ¶
Trasform Json code in Object
func FromJsonFile ¶
Load a JSON file and transform it in Object
func FromXmlCode ¶
Trasform Xml code in Object
func FromXmlFile ¶
Load an Xml file and transform it in Object
func FromYamlCode ¶
Trasform Yaml code in Object
func FromYamlFile ¶
Load a Yaml file and transform it in Object
func GetMatchedFiles ¶
Gets files in a folder (eventually recursively), which name matches with given function execution
func Marshall ¶
func Marshall(itf interface{}, format ParserFormat) ([]byte, error)
Marshall an object instance tranforming in byte array, reporting eventually errors based on the required parser format
func MarshallTo ¶
func MarshallTo(itf interface{}, filePath string, format ParserFormat) error
Marshall an object instance tranforming in byte array and saving in a file in an existing path, reporting eventually errors based on the required parser format
func Unmashall ¶
func Unmashall(code []byte, itf interface{}, format ParserFormat) (interface{}, error)
Marshall data byte arrays parsing the data into the interface returned of same type of the given one, reporting eventually errors based on the required parser format
func UnmashallFrom ¶
func UnmashallFrom(filePath string, itf interface{}, format ParserFormat) (interface{}, error)
Marshall file byte arrays parsing the data into the interface returned of same type of the given one, reporting eventually errors based on the required parser format
Types ¶
type FormatParser ¶
type FormatParser interface { // Provided format ParserFormat() ParserFormat // Mashal an interface to the specified format in bytes Marshall(itf interface{}) ([]byte, error) // Mashal a byte array into the specified interface, returning the unmashalled element Unmashall(code []byte, itf interface{}) (interface{}, error) }
Describes as a Plugin Parser executive must expose functions
func CollectAllPlugins ¶
func CollectAllPlugins(pluginsFolder string, libExtension string) ([]FormatParser, error)
Looks up for plugin by a given ParserFormat, using eventually pluginsFolder and library exception excluded the dot, in case one of them is empty string it will be replaced with the package DefaultPluginsFolder and DefaultLibraryExtension variables
func LookupInPlugins ¶
func LookupInPlugins(format ParserFormat, pluginsFolder string, libExtension string) (FormatParser, error)
Looks up for plugin by a given ParserFormat, using eventually pluginsFolder and library exception excluded the dot, in case one of them is empty string it will be replaced with the package DefaultPluginsFolder and DefaultLibraryExtension variables
type ParserFormat ¶
type ParserFormat string
const ( ParserFormatJson ParserFormat = "JSON" ParserFormatXml ParserFormat = "XML" ParserFormatYaml ParserFormat = "YAML" )
type ParserPlugin ¶
type ParserPlugin func(format ParserFormat) (FormatParser, error)
Describe the exposed Plugin interface proxy function (expected function name = ParserPlugin
type PluginsCollector ¶
type PluginsCollector func() ([]FormatParser, error)
Describe the exposed Plugin interface proxy function (expected function name = PluginsCollector