grain/server/kinds/kind1.go

22 lines
441 B
Go
Raw Normal View History

2024-07-23 17:22:55 +00:00
package kinds
import (
"context"
"fmt"
server "grain/server/types"
"go.mongodb.org/mongo-driver/mongo"
)
func HandleKind1(ctx context.Context, evt server.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
}