Configure a batch process to query and/or mutate resources.
Batch processes take structured inputs, split those up and extract a list
of entries that can be passed to some process. Given the results of that
process, each result is then converted back to some output form and arranged
into the same given structure as outputs.
This abstraction makes it easier to build bulk iteractions with @truffle/db,
rather than, say, submitting multiple separate add mutations.
For instance, Truffle artifacts each contain two bytecodes - to minimize the
number of bytecodesAdd queries, one might want to convert each input
artifact to a flat list of bytecodes, execute a single mutation request to
@truffle/db, and then automatically pair the resulting bytecode IDs with the
respective artifact bytecodes.
Configure a batch process to query and/or mutate resources.
Batch processes take structured inputs, split those up and extract a list of entries that can be passed to some process. Given the results of that process, each result is then converted back to some output form and arranged into the same given structure as outputs.
This abstraction makes it easier to build bulk iteractions with @truffle/db, rather than, say, submitting multiple separate add mutations.
For instance, Truffle artifacts each contain two bytecodes - to minimize the number of
bytecodesAddqueries, one might want to convert each input artifact to a flat list of bytecodes, execute a single mutation request to @truffle/db, and then automatically pair the resulting bytecode IDs with the respective artifact bytecodes.The process is roughly as follows:
,--------. iterate() ,----------. extract() ,---------. | Inputs | --> | Input... | --> | Entry[] |
--------'----------' `---------',---------. merge() ,----------. convert() ,----------. | Outputs | <-- | Output[] | <-- | Result[] |
---------'----------' `----------'