Simple Data Analysis Core - v2.1.14
    Preparing search index...

    Function mergeOptions

    • Combines a table or database's logging defaults with query-specific options. Use this helper with queryDB() when implementing an extension.

      Parameters

      • simple: { charsToLog: number | undefined; rowsToLog: number }

        The logging defaults from a table or database.

        • charsToLog: number | undefined

          The default maximum characters to display per cell.

        • rowsToLog: number

          The default number of rows to display.

      • options: {
            method: string | null;
            noClean?: boolean;
            parameters: { [key: string]: unknown } | null;
            returnData?: boolean;
            rowsToLog?: number;
            table: string | null;
            values?: DuckDBValue[];
        }

        Query-specific settings, which take precedence over defaults.

        • method: string | null

          The calling method used for diagnostics, or null.

        • OptionalnoClean?: boolean

          Whether to preserve the SQL text without cleaning it.

        • parameters: { [key: string]: unknown } | null

          Arguments included in error diagnostics, or null.

        • OptionalreturnData?: boolean

          Whether to return converted rows. Defaults to false.

        • OptionalrowsToLog?: number

          Overrides the default number of displayed rows.

        • table: string | null

          The table name used for diagnostics, or null.

        • Optionalvalues?: DuckDBValue[]

          DuckDB-native values bound to SQL placeholders, in order.

      Returns {
          charsToLog: number | undefined;
          method: string | null;
          noClean?: boolean;
          parameters: { [key: string]: unknown } | null;
          returnData: boolean;
          rowsToLog: number;
          table: string | null;
          values?: DuckDBValue[];
      }

      The merged query options without modifying either argument.

      import { mergeOptions } from "@nshiab/simple-data-analysis-core/helpers";

      const options = mergeOptions(sdb, {
      table: null,
      method: "example()",
      parameters: null,
      returnData: true,
      });
      console.log(options.rowsToLog, options.returnData);