2024-07-23 17:22:55 +00:00
|
|
|
package kinds
|
2024-07-23 00:08:04 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-07-23 17:30:29 +00:00
|
|
|
relay "grain/relay/types"
|
2024-07-23 00:08:04 +00:00
|
|
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
)
|
|
|
|
|
2024-07-23 17:30:29 +00:00
|
|
|
func HandleUnknownKind(ctx context.Context, evt relay.Event, collection *mongo.Collection) error {
|
2024-07-23 00:08:04 +00:00
|
|
|
_, err := collection.InsertOne(ctx, evt)
|
|
|
|
if err != nil {
|
2024-07-24 14:16:26 +00:00
|
|
|
return fmt.Errorf("error inserting unknown event into MongoDB: %v", err)
|
2024-07-23 00:08:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("Inserted unknown event into MongoDB:", evt.ID)
|
|
|
|
return nil
|
|
|
|
}
|