questdb / nodejs-questdb-client

QuestDB Node.js Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Client should skip columns if value is null

javier opened this issue · comments

When adding columns to the sender, if we pass a null value, as in

sender.table('prices').symbol('instrument', 'EURUSD')
            .floatColumn('bid', null).at(Date.now(), 'ms');

It would be convenient that the column was ignored, rather than raising an error. It would make things easier for programmatic access

Current workaround is something like

// start building the sender with the initial required columns
        let builder = sender.table('prices').symbol('instrument', 'EURUSD')
            .floatColumn('bid', 1.0197);

        // conditionally add the ask column
        if (includeAsk) {
            builder = builder.floatColumn('ask', 1.0224);
        }

        // finalize the builder with the timestamp
        await builder.at(Date.now(), 'ms');