const FileBasedStoreLoader = require('@unitybase/base').FileBasedStoreLoader
let loader = new FileBasedStoreLoader({
entity: me.entity,
foldersConfig: folders,
fileMask: /-fm\.def$/,
onBeforeRowAdd: postProcessing
})
let resultDataCache = loader.load()
# new FileBasedStoreLoader (config: Object)
Arguments:
config
: Objectentity
: UBEntityfoldersConfig
: Array.<{path: string}>Array of folder configuration to scan for files. Necessary param is path - path to folder. You can also pass additional information for use in
onBeforeRowAdd
andonNewFolder
callbacks. Currently processed root folder accessible from FileBasedStoreLoader.processingRootFolderzipToArray
: BooleanTransform result from array of object to array-of-array representation. Default true
uniqueID
: BooleanResult data must contain ID attribute and values must be unique. Default true.
fileMask
: RegExpRegular expression to filter folder files. Each fileName (without path) will be tested by this regExp
attributeRegExpString
: StringString representation of regular expression to found attribute and it value in input content. Default is '^\/\/@(\w+)\s"(.*?)"' what mean find all string like: //@attribute "value" You can pass empty string to disable attribute parsing by regExp and do it manually in
onBeforeRowAdd
handler.onBeforeRowAdd
: functionCallback called for each row BEFORE it added to store. In case it return false row not added. Called with args (this: FileBasedStoreLoader, fullFilePath: string, fileContent: string, oneRow: Object);
onNewFolder
: functionCallback called for each new folder in case of recursive folder. In case callback return false or not defined - folder not processed. Called with args (this: FileBasedStoreLoader, fullFolderPath: string, recursionLevel: integer);
Members
# attributes : Array.<Object> instance
Entity attributes array
# config : Object instance
Configuration
# haveCreateDate : Boolean instance
Is mStore.simpleAudit
enabled for current entity (exist mi_createDate
attribute)
# haveModifyDate : Boolean instance
Is mStore.simpleAudit
enabled for current entity (exist mi_modifyDate
attribute)
# processingRootFolder : * instance
Currently processed root folder
# resultCollection : Array.<Object> instance
Array of Object representing dirty result
Methods
# load () → TubCachedData instance
Perform actual loading.