package
0.0.0-20220417222657-8b058bfbfc36
Repository: https://github.com/flagrantgarden/flfa.git
Documentation: pkg.go.dev
# Functions
ConvertFromTengoMap reverses the process, turning an arbitrary tengo map into a defined struct so that you can pass information back and forth between tengo and your application.
ConvertToTengoMap is a helper function for intelligently transforming an arbitrary struct into a map[string]any object, which tengo can treat as a basic map.
GetEmbeddedFolderLibraries requires the path to a folder containing *.tengo files you want to add as libraries and an embedded file system to use.
GetEmbeddedLibrary requires the path to a *.tengo file you want to add as a library and an embedded file system to use.
GetModule returns a Module instance with all of its submodules.
GetEmbeddedStandaloneLibraries is a helper function for returning the list of all libraries found in a Tympan module folder.
GetFolderLibraries requires the path to a folder containing *.tengo files you want to add as libraries and an afero file system to use.
GetLibrary requires the path to a *.tengo file you want to add as a library and an afero file system to use.
GetModule returns a Module instance with all of its submodules.
GetStandaloneLibraries is a helper function for returning the list of all libraries found in a Tympan module folder.
Creates a new instance of an engine with no settings except that it prepopulates the list of valid standard libraries from tengo.
ParseStructTags() is used to introspect on a struct which is to be converted to a map Tengo can user; it returns the MetaConfig for a given struct field which SetStruct uses to determine behavior.
# Structs
The Engine is the main interface between tengo and a Tympan app and is geared towards loading scripts and libraries from a Tympan module.
The EngineSettings configure how the tengo script engine behaves, providing some useful shorthands so you don't need to understand the tengo interop model in detail.
A Tympan scripting Library is made up of a unique name and the tengo script contents are its body.
The LibraryImporter is an implementation of the tengo.ModuleGetter; it allows the engine to import dynamically defined libraries from modules in addition to tengo's in-the-box libraries.
MetaConfig structs are used when parsing tags on configuration structs; they help turn a mapstructure tag into the name of a viper configuration key and change the behavior of a configuration item via the tympanconfig directive; right now the only supported directive is `tympanconfig:"ignore"` which ensures a struct key is not written to the configuration.
A Tympan scripting module is a Library with zero or more submodules.
The Script is a wrapper around a tengo.Script object, appending the name of the script and the raw string for its body so that a script can be found by name and/or introspected on after compiling.