prorm API Reference
    Preparing search index...

    Function FromFile

    • Point a decorated routine at a file holding its body.

      Equivalent to passing file in the options, and useful when the rest of the declaration is short enough to read on one line:

      class Reports {
      @Procedure({ name: 'rebuild_totals' })
      @FromFile('./db/procedures/rebuild_totals.sql')
      rebuildTotals!: () => Promise<void>;
      }

      Decorators are applied bottom-up, so @FromFile below the routine decorator runs first and parks the file for it. Placing it above also works — the routine's metadata already exists by then, so the file is attached directly. Either order is fine; below reads better next to the other options.

      Parameters

      Returns (target: object, propertyKey?: string | symbol) => void