0.2.13 • Published 12 months ago

@electric-sql/pglite-sync v0.2.13

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

PGlite ElectricSQL Sync Plugin

A sync plugin for PGlite using ElectricSQL. Full documentation is available at pglite.dev/docs/sync.

To install:

npm install @electric-sql/pglite-sync

Then add it to you PGlite instance and create any local tables needed:

import { electricSync } from '@electric-sql/pglite-sync'

const pg = await PGlite.create({
  extensions: {
    electric: electricSync(),
  },
})

await pg.exec(`
  CREATE TABLE IF NOT EXISTS todo (
    id SERIAL PRIMARY KEY,
    task TEXT,
    done BOOLEAN
  );
`)

You can then use the syncShapeToTable method to sync a table from Electric:

const shape = await pg.electric.syncShapeToTable({
  url: 'http://localhost:3000/v1/shape/todo',
  table: 'todo',
  primaryKey: ['id'],
})
0.2.13

12 months ago

0.2.12

12 months ago

0.2.11

12 months ago

0.2.10

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago