Load: (<N>(collectionName, inputs) => Process<(Resources.IdObject<N> | undefined)[]>)

Type declaration

    • <N>(collectionName, inputs): Process<(Resources.IdObject<N> | undefined)[]>
    • resources.load

      Loads resource inputs and processes into corresponding [[IdObject | IdObjects]].

      The resulting array will always have the same length as the inputs, with each result corresponding to the input at the same index. Invalid inputs correspond to null resource results.

      Note: This function returns a generator. For async behavior, use with a [[Meta.Process.ProcessorRunner | ProcessorRunner]] such as that returned by [[Run.forDb]] or [[Project.run]].

      Type Parameters

      Parameters

      Returns Process<(Resources.IdObject<N> | undefined)[]>

      Example

      import { connect, Resources, Process } from "@truffle/db";

      const db = connect({
      // ...
      });

      const { Run, resources } = Process;

      const { run } = Run.forDb(db);

      const sources: (
      | Resources.IdObject<"sources">
      | null
      )[] = await run(resources.load, "sources", [
      { sourcePath: "...", contents: "..." }
      ]);

Generated using TypeDoc