0.1.9 • Published 3 months ago

esmysqlsync v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

ESMySQLSync

Build Status Coverage Status

A small library for syncing elastic search with mysql using Zong Ji.

Installation

npm install esmysqlsync

Usage

const ESMySQLSync = require('./');

const app = new ESMySQLSync({
  mysql: {
    host: 'localhost',
    user: 'slave',
    password: 'password',
  },
  batch: 10, // default to 10
  index: ({ row, tableMap }) => {
    console.log(tableMap); // additional table data
    return { action: 'index', index: 'products', type: 'product_type', id: row.id, body: row };
  },
  update: ({ row }) => ({ action: 'update', index: 'products', type: 'product_type', id: row.after.id, body: row.after }),
  delete: ({ row }) => ({ action: 'delete', index: 'products', type: 'product_type', id: row.id }),
  success: res => console.log(res), // optional
  error: e => console.log(e), // optional
});

app.start({ startAtEnd: true });
console.log('Running');
0.1.8

3 months ago

0.1.7

3 months ago

0.1.9

3 months ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago