Documentation
¶
Index ¶
- func CurrentSchemaVersion() int
- func PreflightMigrationTarget(ctx context.Context, dsn string, log zerolog.Logger) storage.MigrationTargetPreflight
- type Notifier
- type Store
- func (s *Store) AdminStorageSnapshot(ctx context.Context) (storage.AdminStorageSnapshot, error)
- func (s *Store) Close() error
- func (s *Store) CountEvents(ctx context.Context, filters []nostr.Filter) (int, error)
- func (s *Store) DeleteEvent(ctx context.Context, id string) error
- func (s *Store) EventIDPrefixExists(ctx context.Context, prefix string, groupID string, requireSameH bool) (bool, error)
- func (s *Store) GetLatestGroupAdmins39001(ctx context.Context, relayPubkey, groupID string) (*nostr.Event, error)
- func (s *Store) GetLatestGroupMetadata39000(ctx context.Context, relayPubkey, groupID string) (*nostr.Event, error)
- func (s *Store) HasEventID(ctx context.Context, id string) (bool, error)
- func (s *Store) IsGroupMember(ctx context.Context, relayPubkey, groupID, memberPubkey string) (bool, error)
- func (s *Store) MigrationRowCounts(ctx context.Context) (storage.MigrationCounts, error)
- func (s *Store) Notifier() storage.EventNotifier
- func (s *Store) QueryEventSyncItems(ctx context.Context, filter nostr.Filter) ([]storage.SyncItem, error)
- func (s *Store) QueryEvents(ctx context.Context, filters []nostr.Filter) ([]*nostr.Event, error)
- func (s *Store) SaveEvent(ctx context.Context, ev *nostr.Event) error
- func (s *Store) ScanEventsForMigration(ctx context.Context, fn func(*nostr.Event) error) error
- func (s *Store) SearchEvents(ctx context.Context, searchQuery string, constraints nostr.Filter) ([]*nostr.Event, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentSchemaVersion ¶
func CurrentSchemaVersion() int
CurrentSchemaVersion is the congee_schema_version / app-expected value for this binary.
func PreflightMigrationTarget ¶
func PreflightMigrationTarget(ctx context.Context, dsn string, log zerolog.Logger) storage.MigrationTargetPreflight
PreflightMigrationTarget inspects a Postgres DSN without running DDL or starting LISTEN.
Types ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier implements storage.EventNotifier using pg_notify and a dedicated pgx LISTEN connection.
func NewNotifier ¶
NewNotifier starts a background LISTEN loop. Close shuts it down.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a PostgreSQL-backed storage.Store with LISTEN/NOTIFY fan-out.
func Open ¶
Open connects with Bun + pgdriver, runs migrations, and starts the event notifier listener. instanceID is sent as NOTIFY payload origin so this process ignores its own writes. log is used for optional debug traces (use zerolog.Nop() when silent).
func (*Store) AdminStorageSnapshot ¶
AdminStorageSnapshot implements storage.EventStore snapshot (events and tags only).
func (*Store) CountEvents ¶
CountEvents returns how many distinct events match any filter (OR) via SQL COUNT.
func (*Store) DeleteEvent ¶
DeleteEvent removes an event and its tags.
func (*Store) EventIDPrefixExists ¶
func (s *Store) EventIDPrefixExists(ctx context.Context, prefix string, groupID string, requireSameH bool) (bool, error)
EventIDPrefixExists implements storage.Store (NIP-29).
func (*Store) GetLatestGroupAdmins39001 ¶
func (s *Store) GetLatestGroupAdmins39001(ctx context.Context, relayPubkey, groupID string) (*nostr.Event, error)
GetLatestGroupAdmins39001 implements storage.Store (NIP-29).
func (*Store) GetLatestGroupMetadata39000 ¶
func (s *Store) GetLatestGroupMetadata39000(ctx context.Context, relayPubkey, groupID string) (*nostr.Event, error)
GetLatestGroupMetadata39000 implements storage.Store (NIP-29).
func (*Store) HasEventID ¶
HasEventID implements storage.Store.
func (*Store) IsGroupMember ¶
func (s *Store) IsGroupMember(ctx context.Context, relayPubkey, groupID, memberPubkey string) (bool, error)
IsGroupMember implements storage.Store (NIP-29).
func (*Store) MigrationRowCounts ¶
MigrationRowCounts returns table row totals for migration verification.
func (*Store) Notifier ¶
func (s *Store) Notifier() storage.EventNotifier
Notifier returns the store's EventNotifier (same instance receives NOTIFY and exposes Listen).
func (*Store) QueryEventSyncItems ¶
func (s *Store) QueryEventSyncItems(ctx context.Context, filter nostr.Filter) ([]storage.SyncItem, error)
QueryEventSyncItems returns id+created_at rows matching filter, ascending for NIP-77.
func (*Store) QueryEvents ¶
QueryEvents returns events matching any of the filters (OR), newest first.
func (*Store) SaveEvent ¶
SaveEvent persists an event, replacing prior replaceable/addressable rows per NIP-01.
func (*Store) ScanEventsForMigration ¶
ScanEventsForMigration iterates all events in stable order.