搜尋套件、儲存庫與 APP 分類

套件詳情v8.0.1

sporran

Dart 的 PouchDB 相似物。使用 lawndart 進行本機儲存,使用 Wilt 存取 CouchDB。

Web
近 30 天下載
66
喜歡數
30
Pub 分數
160

安裝套件

flutter pub add sporran

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Sporran 是一個 Dart 套件,為 Flutter 與 Web 應用程式帶來類似 PouchDB 的功能,支援本地 NoSQL 資料庫操作。它利用 lawndart 實現高效能的本機儲存,並透過 Wilt 與 CouchDB 實現無縫整合。專為離線優先的應用程式設計,Sporran 支援本地與遠端資料庫之間的同步,非常適合需要跨裝置資料持久化與同步的應用。其輕量級架構確保了在 Web 平台上的快速效能。

適用情境

  • 離線優先的行動與Web應用
  • 與CouchDB的資料同步
  • Web應用程序中的本機數據存儲
  • 漸進式網路應用(PWAs)
  • 即時協作應用
  • API 回應快取

主要特色

  • 受 PouchDB 啟發的 API
  • 對 CouchDB 的內建支援
  • 使用 lawndart 進行本機儲存
  • 輕量且快速的網頁體驗
  • 自動衝突解決
  • 本地資料庫與遠端資料庫之間的同步功能

適合對象

  • 使用 Flutter 的 Web 開發人員
  • 需要離線資料持久化的應用
  • 使用 CouchDB 作為後端的團隊
  • 尋求簡單 NoSQL 儲存的開發者
  • 需要即時同步的項目
  • 快速原型數據驅動功能

使用建議

  • 僅限網頁平台
  • 依賴外部服務,如 CouchDB
  • PouchDB 概念的學習曲線
  • 不適合大規模伺服器端資料庫
  • 需要小心處理同步衝突
  • 最適合較小的資料集

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Sporran - a PouchDB alike database client for Dart

Build Status

Introduction

Sporran is a PouchDB alike implementation for Dart.

It uses Lawndart(browser local storage client) and Wilt(browser CouchDB client) to allow browser based CouchDB users to transition between online and offline modes and carry on working normally.

When the browser is online Sporran acts just like Wilt, i.e is a CouchDB client, but all database transactions are reflected into local storage. If the browser goes offline Sporran switches to using local storage only, when the browser comes back online the local database is synced up with CouchDB, all transparent to the user.

The CouchDB change notification interface is also used to keep Sporran in sync with any 3rd party changes to your CouchDB database.

Philosophy of operation

Sporran is designed to be used as a CouchDB client with a similar interface to PouchDb and the fact that like PouchDb it allows offline as well as online usage.

There are differences however, the main one being that the CouchDB database is deemed to be the master in all cases of conflict, in that when syncing if Couch has a different document revision to the local one held then it is deemed to be the master and its document wins. This means any local updates that have been made while offline will be lost. This however will only occur if you are not the only user of your database, if you are a single user and no one else can change your database then this situation will not occur as your local revisions will always match CouchDB.

When online all document and attachment updates are comitted to local storage as NOT_UPDATED, then CouchDb is updated, if successful the document is now marked as UPDATED in local storage and its revision and any new/deleted attachments are updated. If the update fails the document is left in local storage, the document will only be removed from local storage if CouchDB replies with a conflicting revision in which case the document will be updated from the CouchDB document and its revision updated as necessary.

Whilst online CouchDD responds to all read and delete requests, local storage being updated as required.

When the user goes offline all document update/creation requests are performed in local storage with the update being marked a NOT_UPDATED. Reads are from local storage and deletes operate on local storage with the delete itself being written to a pending delete queue for processing by CouchDB when we transition to online again. Note that whilst offline any document/attachment creations do not create a revision, likewise updated documents retain the same revision they had last time they were online. Sporran does not create CouchDB revisions.

When the user comes back online the sync() method is invoked(automatically or by manual call), this as you probably suspect re-syncs local storage and CouchDB. Pending deletes are addressed first, followed by documents and attachments marked as NOT_UPDATED. This procedure updates revision numbers and creates any new documents/ attachments as needed, also deleted attachments are addressed. The sync method operates in conjunction with the CouchDB change notification interface which must be enabled for a full sync to be performed. The sync operation runs in the background, the user can just carry on working, they need not wait for the sync oeration to complete, in fact, syncing is performed transparently all the time the user is online albeit in a more lightweight manner.

所屬分類

依賴

依賴清單 4 項

  • indexed_db^1.0.1
  • json_object_lite^4.0.1
  • web^1.1.1
  • wilt^7.1.1

原始碼儲存庫

使用此套件的專案

暫無相關資料。