mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-10-30 09:36:31 +00:00
22 lines
438 B
Go
22 lines
438 B
Go
package kinds
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
relay "grain/relay/types"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
func HandleKind1(ctx context.Context, evt relay.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
|
|
}
|