pg

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pg keeps the estate in Postgres for fast queries. Snapshots stay the source of truth, so the database can always be wiped and rebuilt, and it holds exactly what snapshots hold: emails and secrets as HMACs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an open estate database.

func Open

func Open(ctx context.Context, url string) (*Store, error)

Open connects and applies any migration not yet applied.

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close ends the connection.

func (*Store) Estate

func (s *Store) Estate(ctx context.Context) (*graph.Estate, error)

Estate loads the estate.

func (*Store) Reset

func (s *Store) Reset(ctx context.Context) error

Reset wipes the estate. Sync rebuilds it from snapshots.

func (*Store) Sync

func (s *Store) Sync(ctx context.Context, dir string, now time.Time) (int, error)

Sync merges every snapshot under dir that the database has not seen, oldest first, skipping those older than a year. It returns how many it merged. If an older snapshot appears after a newer one was merged, the estate is wiped and rebuilt, since merges must run in order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL