Class QueryMap

java.lang.Object
ortus.boxlang.runtime.bifs.BIF
ortus.boxlang.runtime.bifs.global.query.QueryMap

@BoxBIF(description="Transform query data using a callback function") @BoxMember(type=QUERY) public class QueryMap extends BIF
  • Constructor Details

    • QueryMap

      public QueryMap()
      Constructor
  • Method Details

    • _invoke

      public Object _invoke(IBoxContext context, ArgumentsScope arguments)
      This BIF will iterate over each row in the query and invoke the callback function for each item so you can do any operation on the row and return a new value that will be set at the same index in a new query. The callback function will be passed the row as a struct, the current row number (1-based), and the query itself.
      • If the callback requires strict arguments, it will only receive the row as a struct.
      • If the callback does not require strict arguments, it will receive the row as a struct, the row number (1-based), and the query itself.

      Parallel Execution

      If the parallel argument is set to true, and no max_threads are sent, the map will be executed in parallel using a ForkJoinPool with parallel streams. If max_threads is specified, it will create a new ForkJoinPool with the specified number of threads to run the map in parallel, and destroy it after the operation is complete. Please note that this may not be the most efficient way to map, as it will create a new ForkJoinPool for each invocation of the BIF. You may want to consider using a shared ForkJoinPool for better performance.
      Specified by:
      _invoke in class BIF
      Parameters:
      context - The context in which the BIF is being invoked.
      arguments - Argument scope for the BIF.
      Returns:
      The result of the invocation