mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-10-30 01:26:32 +00:00
20 lines
410 B
Go
20 lines
410 B
Go
package events
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
func HandleEventKind1(ctx context.Context, evt Event, collection *mongo.Collection) error {
|
|
// Insert event into MongoDB
|
|
_, err := collection.InsertOne(ctx, evt)
|
|
if err != nil {
|
|
return fmt.Errorf("Error inserting event into MongoDB: %v", err)
|
|
}
|
|
|
|
fmt.Println("Inserted event kind 1 into MongoDB:", evt.ID)
|
|
return nil
|
|
}
|