Code Monkey home page Code Monkey logo

sqlite_crdt's People

Contributors

cachapa avatar janezstupar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sqlite_crdt's Issues

Thoughts on PocketBase/Drift

I currently build and use the package pocketbase_drift which is a dart native client for pocketbase and uses drift as the Sqlite3 layer.

I ended up doing something very similar to a CRDT for the sync (deleted, timestamp, synced) which was possible with the added columns.

As I am looking into this package more I think that this might be a good fit. But would like to make a drift_crdt first or sqlite3_crdt client first. Sqlite3 being an FFI based package.

Curious about your thoughts on this in regards to pocketbase being the source of truth on the server running SQLite, having hooks and can be extended as a framework. Looking through the code I want to find a way to call getChangeSet for a user and only sync specific tables and ones only needed for the user. It wasnt clear to me if the crdt_sync was syncing the whole database to every peer or just the user data.

The applications I am working on are all offline first and have highly connected peers.

Error when running "INSERT INTO table SELECT" syntax

Discussed in #8

Originally posted by mochar February 15, 2024
The error is:

Unhandled exception:
type 'SelectInsertSource' is not a subtype of type 'ValuesSource' in type cast
#0      TimestampedCrdt._insert (package:sql_crdt/src/timestamped_crdt.dart:28:32)
#1      SqlCrdt._insert (package:sql_crdt/src/sql_crdt.dart:28:17)
#2      BaseCrdt.execute (package:sql_crdt/src/base_crdt.dart:48:13)
#3      main (file:///home/mochar/dev/garbage/crdt_insert_bug/main.dart:27:14)
<asynchronous suspension>

Minimal example:

import 'package:sqlite_crdt/sqlite_crdt.dart';

Future<void> onCreate(BaseCrdt crdt, int version) async {
    await crdt.execute('''
        CREATE TABLE test (
            a INTEGER,
            b INTEGER
        )
    ''');
    await crdt.execute('''
        CREATE TABLE test2 (
            a INTEGER,
            b INTEGER
        )
    ''');
}

void main() async {
    final db = await SqliteCrdt.open('/tmp/a.sqlite',
        version: 1,
        onCreate: onCreate);
    
    await db.execute('''
    INSERT INTO test(a, b) VALUES (1, 2)
    ''');

    await db.execute('''
    INSERT INTO test2(a, b)
    SELECT a, b
    FROM test
    ''');
}
```</div>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.