Documentation
¶
Overview ¶
Package postgres stores independent scoped logs in a host-owned PostgreSQL schema. Append and SQL source triggers queue facts in the mutation transaction; a deferred trigger assigns commit-safe positions after locking all its scopes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
Migrate installs the shared tables/functions once. The host owns and creates the schema. Run before accepting mutations, using a connection allowed DDL.
func MigrationSQL ¶
MigrationSQL returns an immutable version of the shared schema for inclusion in a product's transactional SQL migration. Keep the returned SQL verbatim in a generated segment and verify it against this function in a contract test. Products may add their own FK/cascade constraints after this segment. This lets a single product migration install the engine, copy retained history and switch its SQL capture atomically. Only version 1 is currently defined.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AppendTx ¶
AppendTx queues a fact in the caller's mutation transaction. The log namespace and scope come from this authorized store. Event.Source is product-owned provenance. ID must be stable on retries; an identical retained fact is a no-op; a retained ID with different content fails the transaction rather than overwriting history. Products must never reuse an ID for a different fact, including after pruning. Direct SQL source triggers may insert these same fields into eventlog_pending. Do not force its deferred constraint to immediate or change transaction_id.
func (*Store) EnsureScope ¶
EnsureScope creates a stable empty stream before its first read. It is idempotent; hosts normally call it when creating their tenant/merchant/app.