mongo

package
v0.3.32-nightly Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDuplicateEvent

func CheckDuplicateEvent(ctx context.Context, evt nostr.Event) (bool, error)

CheckDuplicateEvent checks if an event with the same ID already exists in the collection.

func DiagnoseQueryIssues

func DiagnoseQueryIssues(filters []relay.Filter, client *mongo.Client, databaseName string)

DiagnoseQueryIssues performs comprehensive database query diagnostics

func DisconnectDB

func DisconnectDB(client *mongo.Client)

Disconnect from MongoDB

func EnsureIndexes

func EnsureIndexes(client *mongo.Client, databaseName string) error

func GetAllAuthorsFromRelay

func GetAllAuthorsFromRelay(cfg *configTypes.ServerConfig) []string

GetAllAuthorsFromRelay fetches all unique authors from MongoDB.

func GetClient

func GetClient() *mongo.Client

GetClient returns the MongoDB client

func GetCollection

func GetCollection(kind int) *mongo.Collection

func GetDatabaseName

func GetDatabaseName() string

GetDatabaseName returns the database name from config

func InitDB

func InitDB(cfg *config.ServerConfig) (*mongo.Client, error)

func PurgeOldEvents

func PurgeOldEvents(cfg *cfgTypes.EventPurgeConfig)

PurgeOldEvents removes old events based on the configuration and a list of whitelisted pubkeys.

func QueryEvents

func QueryEvents(filters []relay.Filter, client *mongo.Client, databaseName string) ([]relay.Event, error)

QueryEvents queries events from the MongoDB collection(s) based on filters

func ScheduleEventPurging

func ScheduleEventPurging(cfg *cfgTypes.ServerConfig)

ScheduleEventPurging runs the event purging at a configurable interval.

func StoreMongoEvent

func StoreMongoEvent(ctx context.Context, evt relay.Event, client relay.ClientInterface)

StoreMongoEvent processes and stores an event based on its kind

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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