mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Database related operation files reorganization
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user