postgresql

package
v0.0.0-...-886fcdb Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TooManyIDs       = errors.New("too many ids")
	TooManyAuthors   = errors.New("too many authors")
	TooManyKinds     = errors.New("too many kinds")
	TooManyTagValues = errors.New("too many tag values")
	EmptyTagSet      = errors.New("empty tag set")
)

Functions

This section is empty.

Types

type PostgresBackend

type PostgresBackend struct {
	sync.Mutex
	*sqlx.DB
	DatabaseURL       string
	QueryLimit        int
	QueryIDsLimit     int
	QueryAuthorsLimit int
	QueryKindsLimit   int
	QueryTagsLimit    int
	KeepRecentEvents  bool
}

func (*PostgresBackend) AfterSave

func (b *PostgresBackend) AfterSave(evt *nostr.Event)

func (*PostgresBackend) BeforeSave

func (b *PostgresBackend) BeforeSave(ctx context.Context, evt *nostr.Event)

func (*PostgresBackend) Close

func (b *PostgresBackend) Close()

func (*PostgresBackend) CountEvents

func (b *PostgresBackend) CountEvents(ctx context.Context, filter nostr.Filter) (int64, error)

func (*PostgresBackend) DeleteEvent

func (b *PostgresBackend) DeleteEvent(ctx context.Context, evt *nostr.Event) error

func (*PostgresBackend) EnsureDisappearingSchema

func (b *PostgresBackend) EnsureDisappearingSchema() error

EnsureDisappearingSchema 确保消失消息的 schema 和表存在

func (*PostgresBackend) EnsureGroupCurrentMembers

func (b *PostgresBackend) EnsureGroupCurrentMembers() error

EnsureGroupCurrentMembers 确保当前群成员表存在

func (*PostgresBackend) Init

func (b *PostgresBackend) Init() error

func (*PostgresBackend) InitReadOnly

func (b *PostgresBackend) InitReadOnly() error

InitReadOnly initializes a read-only PostgresBackend (no DDL)

func (*PostgresBackend) QueryEvents

func (b *PostgresBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (ch chan *nostr.Event, err error)

func (*PostgresBackend) ReplaceEvent

func (b *PostgresBackend) ReplaceEvent(ctx context.Context, evt *nostr.Event) error

func (*PostgresBackend) SaveEvent

func (b *PostgresBackend) SaveEvent(ctx context.Context, evt *nostr.Event) error

func (*PostgresBackend) SaveEvents

func (b *PostgresBackend) SaveEvents(ctx context.Context, events []*nostr.Event) error

func that saves a list of events into DB as a transaction, if event is a replace event, it will be replaced

func (*PostgresBackend) SetDefaultLimits

func (b *PostgresBackend) SetDefaultLimits()

SetDefaultLimits sets default query limits if not set

func (*PostgresBackend) UpsertDisappearing

func (b *PostgresBackend) UpsertDisappearing(
	ctx context.Context,
	eventID string, ttlSeconds int64, expiration time.Time, createdAt time.Time,
) error

UpsertDisappearing 插入或更新消失消息记录

Jump to

Keyboard shortcuts

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