logologo
HomeGallery
  • Why?
  • Docs
  • Demo
  • Download
    Start
    Install
    General
    docker-compose
    docker
    Binary
    App Bundle
    Generic Bundle
    Source
    Azure
    Configuration
    CLI
    help
    run
    export meta
    export static
    fetch
    database
    storage
    plugin
    cast
    Webapp
    Search
    FAQ
    API server
    Recipes
    Use Nginx proxy with subpath
    Use Traefik proxy with subpath
    Use IIS Proxy With a Sub-Path
    Internals
    Workflow
    Building Blocks
    Data Structures
    Design Decisions
    Development
    Plugin
    Extractor Plugin
    Database Mapper Plugin
    Query Plugin
    Previous pageExtractor PluginNext pageQuery Plugin

    #Database plugin

    The database plugin maps important meta data from the extrator to a database entry.

    The mapping is synchronous. Asynchronous stuff belongs to the extractor.

    // plugin definition as above
    
    async function factory(manager) {
      await manager.register('database', databaseMapper(manager))
    }
    
    function databaseMapper(manager) (
      const log = manager.createLogger('plugin.acmeMapper')
    
      return {
        name: 'acmeMapper',
        order: 1,
    
        // entry is the storage entry containing all extracted data
        // media is the target database entry
        mapEntry(entry, media) {
          log.info(`Map database entry: ${entry}`)
    
          // Use somehow the data from the extractor task
          media.plugin.acme = entry.meta.acme
        }
      }
    })