synclayer_postgres 1.0.0 copy "synclayer_postgres: ^1.0.0" to clipboard
synclayer_postgres: ^1.0.0 copied to clipboard

discontinuedreplaced by: synclayer

PostgreSQL adapter for SyncLayer - enables offline-first sync with PostgreSQL database.

synclayer_postgres #

PostgreSQL adapter for SyncLayer - enables offline-first synchronization with PostgreSQL database.

Installation #

dependencies:
  synclayer: ^1.4.1
  synclayer_postgres: ^1.0.0

Usage #

import 'package:synclayer/synclayer.dart';
import 'package:synclayer_postgres/synclayer_postgres.dart';
import 'package:postgres/postgres.dart';

final connection = await Connection.open(
  Endpoint(
    host: 'localhost',
    database: 'mydb',
    username: 'user',
    password: 'password',
  ),
);

await SyncLayer.init(
  SyncConfig(
    customBackendAdapter: PostgresAdapter(connection: connection),
    collections: ['todos'],
  ),
);

Database Schema #

CREATE TABLE todos (
  record_id VARCHAR(255) PRIMARY KEY,
  data JSONB NOT NULL,
  updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
  version INTEGER NOT NULL DEFAULT 1
);

CREATE INDEX idx_updated_at ON todos(updated_at);

License #

MIT License

0
likes
140
points
47
downloads

Publisher

verified publisherhostspica.com

Weekly Downloads

PostgreSQL adapter for SyncLayer - enables offline-first sync with PostgreSQL database.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, postgres, synclayer

More

Packages that depend on synclayer_postgres