Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. type BaseMongo interface {
  2. Read(ctx context.Context, filter bson.M, db string, collection string, out interface{}) error
  3. }
  4.  
  5. type Mongo struct {
  6. client *mongo.Client
  7. }
  8.  
  9. func (m *Mongo) Read(ctx context.Context, filter bson.M, db string, collection string, out interface{}) error {
  10. return m.client.Database(db).Collection(collection).FindOne(context.Background(), filter).Decode(out)
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement