UNPKG

envio

Version:

A latency and sync speed optimized, developer friendly blockchain data indexer.

33 lines (29 loc) 1.15 kB
// Generated by ReScript, PLEASE EDIT WITH CARE import * as ClickHouse from "./bindings/ClickHouse.res.mjs"; import * as Client from "@clickhouse/client"; function makeClickHouse(host, database, username, password) { let client = Client.createClient({ url: host, username: username, password: password }); let cache = new WeakMap(); return { name: "clickhouse", initialize: ($staropt$star, $staropt$star$1, $staropt$star$2) => { $staropt$star !== undefined; let entities = $staropt$star$1 !== undefined ? $staropt$star$1 : []; let enums = $staropt$star$2 !== undefined ? $staropt$star$2 : []; return ClickHouse.initialize(client, database, entities, enums); }, resume: checkpointId => ClickHouse.resume(client, database, checkpointId), writeBatch: async (batch, updatedEntities) => { await Promise.all(updatedEntities.map(param => ClickHouse.setUpdatesOrThrow(client, cache, param.changes, param.entityConfig, database))); return await ClickHouse.setCheckpointsOrThrow(client, batch, database); } }; } export { makeClickHouse, } /* ClickHouse Not a pure module */