diff options
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_clickhouse.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lualib/lua_clickhouse.lua b/lualib/lua_clickhouse.lua index 4a57afd3f..713da6e21 100644 --- a/lualib/lua_clickhouse.lua +++ b/lualib/lua_clickhouse.lua @@ -23,6 +23,7 @@ limitations under the License. local rspamd_logger = require "rspamd_logger" local rspamd_http = require "rspamd_http" local lua_util = require "lua_util" +local rspamd_text = require "rspamd_text" local exports = {} local N = 'clickhouse' @@ -81,9 +82,11 @@ local function row_to_tsv(row) end end - return table.concat(row, '\t') + return rspamd_text.fromtable(row, '\t') end +exports.row_to_tsv = row_to_tsv + -- Parses JSONEachRow reply from CH local function parse_clickhouse_response_json_eachrow(params, data) local ucl = require "ucl" @@ -360,7 +363,6 @@ end --]] exports.insert = function (upstream, settings, params, query, rows, ok_cb, fail_cb) - local fun = require "fun" local http_params = {} for k,v in pairs(params) do http_params[k] = v end @@ -373,9 +375,7 @@ exports.insert = function (upstream, settings, params, query, rows, http_params.user = settings.user http_params.password = settings.password http_params.method = 'POST' - http_params.body = {table.concat(fun.totable(fun.map(function(row) - return row_to_tsv(row) - end, rows)), '\n'), '\n'} + http_params.body = {rspamd_text.from_table(rows, '\n'), '\n'} http_params.log_obj = params.task or params.config if not http_params.url then |