Database related operation files reorganization

This commit is contained in:
Florian Sylvain
2023-01-18 20:55:51 +01:00
parent 0461bb08ef
commit 245ddbc137
5 changed files with 98 additions and 77 deletions
+15
View File
@@ -0,0 +1,15 @@
package database
import "context"
func PushDocument(location Location, document interface{}) error {
client := GetNewClient()
collection := client.Database(location.Database).Collection(location.Collection)
defer client.Disconnect(context.TODO())
_, err := collection.InsertOne(context.TODO(), document)
if err != nil {
return err
}
return nil
}