Skip to main content

Crate jacs_postgresql

Crate jacs_postgresql 

Source
Expand description

PostgreSQL storage backend for JACS documents.

This crate provides PostgresStorage, a PostgreSQL-backed implementation of JACS storage traits:

§Dual-Column Strategy

Uses TEXT + JSONB dual-column storage:

  • raw_contents (TEXT): Preserves exact JSON bytes for signature verification
  • file_contents (JSONB): Enables efficient queries and indexing

§Append-Only Model with Soft Delete

Documents are immutable once stored. New versions create new rows keyed by (jacs_id, jacs_version). The only UPDATE operation is soft-delete via remove_document, which sets tombstoned = true rather than physically deleting rows.

§Usage

use jacs_postgresql::PostgresStorage;
use jacs::storage::StorageDocumentTraits;
use jacs::storage::DatabaseDocumentTraits;

let storage = PostgresStorage::new(&database_url, None, None, None)?;
storage.run_migrations()?;

Structs§

PostgresStorage
PostgreSQL storage backend for JACS documents.