import gql from "graphql-tag";
import { connect, Process } from "@truffle/db";
const db = connect({
// ...
});
const { Run, resources } = Process;
const { run } = Run.forDb(db);
const sources: (
| Pick<Resources.Resource<"sources">, "contents">
| null
)[] = await run(resources.find, "sources", ["0x...", "0x..."], gql`
fragment Contents on Source {
contents
}
`);
Generated using TypeDoc
resources.findRetrieves full or partial representations of all resources in a list of given IDs. Parameter
documentis a GraphQL DocumentNode that defines a fragment on the resource object type, to control which fields are returned.The resulting array will always have the same length as the provided IDs, with each result corresponding to the ID at the same index. Unknown IDs will have
nullentries in the resulting array.Note: This function returns a generator. For
asyncbehavior, use with a [[Meta.Process.ProcessorRunner | ProcessorRunner]] such as that returned by [[Run.forDb]] or [[Project.run]].